File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -71,7 +71,15 @@ def create_app(args): # noqa: C901
71
71
app .config ['SEND_FILE_MAX_AGE_DEFAULT' ] = 30
72
72
73
73
app .config ['BABEL_DEFAULT_LOCALE' ] = default_language
74
- babel = Babel (app )
74
+
75
+ def get_locale ():
76
+ lang = args .language
77
+ if not lang or lang not in support_language :
78
+ lang = request .accept_languages .best_match (support_language )
79
+ return lang
80
+
81
+ babel = Babel (app , locale_selector = get_locale ) # noqa:F841
82
+ # Babel api from flask_babel v3.0.0
75
83
api_call = create_api_call (args .logdir , args .model , args .cache_timeout )
76
84
profiler_api_call = create_profiler_api_call (args .logdir )
77
85
inference_api_call = create_model_convert_api_call ()
@@ -88,13 +96,6 @@ def append_query_string(url):
88
96
query_string = '?' + request .query_string .decode ()
89
97
return url + query_string
90
98
91
- @babel .localeselector
92
- def get_locale ():
93
- lang = args .language
94
- if not lang or lang not in support_language :
95
- lang = request .accept_languages .best_match (support_language )
96
- return lang
97
-
98
99
if not args .api_only :
99
100
100
101
template = Template (
You can’t perform that action at this time.
0 commit comments