@@ -179,15 +179,28 @@ def mobile_user_manual_images(path):
179179 return send_from_directory (os .path .join (app .root_path , "static/mobile-images" ), path )
180180
181181
182+ def _serve_user_manual (base_filename ):
183+ language = request .args .get ("lang" )
184+ static_dir = os .path .join (app .root_path , "static" )
185+
186+ if language and language [:2 ].isalpha ():
187+ file_name = f"{ base_filename } _{ language [:2 ]} .html"
188+ file_path = os .path .join (static_dir , file_name )
189+ if os .path .exists (file_path ):
190+ return send_from_directory (static_dir , file_name )
191+
192+ return send_from_directory (static_dir , f"{ base_filename } .html" )
193+
194+
182195@app .route ("/subsurface-user-manual/" )
183196def static_user_manual ():
184- return send_from_directory ( os . path . join ( app . root_path , "static" ), " user-manual.html " )
197+ return _serve_user_manual ( " user-manual" )
185198
186199
187200@app .route ("/subsurface-mobile-v3-user-manual/" )
188201@app .route ("/subsurface-mobile-user-manual/" )
189202def static_mobile_user_manual ():
190- return send_from_directory ( os . path . join ( app . root_path , "static" ), " mobile-user-manual.html " )
203+ return _serve_user_manual ( " mobile-user-manual" )
191204
192205
193206@app .route ("/release-changes/" )
0 commit comments