File tree Expand file tree Collapse file tree 1 file changed +7
-16
lines changed Expand file tree Collapse file tree 1 file changed +7
-16
lines changed Original file line number Diff line number Diff line change @@ -192,27 +192,18 @@ def load_lang_config():
192
192
},
193
193
"default" : "en"
194
194
}
195
- try :
196
- # If environment variable is set, use the directory specified by it
197
- if CONFIG_DIR :
198
- config_path = Path (CONFIG_DIR ) / "lang.json"
199
- else :
200
- # Otherwise use default directory
201
- config_path = Path (__file__ ).parent / "config" / "lang.json"
202
195
203
- logger . info ( f"Loading language configuration from { config_path } " )
196
+ loaded_config = load_json_config ( "lang.json" ) # Let load_json_config handle path and loading
204
197
205
- if not config_path .exists ():
206
- logger .warning (f"Language configuration file { config_path } does not exist" )
207
- return default_config
208
- return load_json_config (config_path )
209
- except json .JSONDecodeError as e :
210
- logger .error (f"Error decoding JSON from language configuration file { config_path } : { str (e )} " )
198
+ if not loaded_config :
211
199
return default_config
212
- except Exception as e :
213
- logger .error (f"Error loading language configuration file { config_path } : { str (e )} " )
200
+
201
+ if "supported_languages" not in loaded_config or "default" not in loaded_config :
202
+ logger .warning ("Language configuration file 'lang.json' is malformed. Using default language configuration." )
214
203
return default_config
215
204
205
+ return loaded_config
206
+
216
207
# Default excluded directories and files
217
208
DEFAULT_EXCLUDED_DIRS : List [str ] = [
218
209
# Virtual environments and package managers
You can’t perform that action at this time.
0 commit comments