changeset 8985:84b4fc9db016 stable

i18n: make sure 'en' in Accept-Language is recognized as having 100% coverage The workaround in 7c7d6b5c07c7 no longer works after upstream addressed the main issue and released the changes in TurboGears 2.4.3 . Setting `i18n.native = en` in the .ini works as a workaround. The native language for translations is an implementation detail that users shouldn't have to configure, so we define it as a default value without making it explicit in the generated .ini template files. Note that even though TG will figure out that languages like `en_US` should fall back to using the `en` `kallithea.mo`, it doesn't consider `en_US` native if `en` is in the native list but `en_US` isn't. We thus include the most common aliases for `en` in the list.
author Mads Kiilerich <mads@kiilerich.com>
date Sun, 09 Apr 2023 16:38:31 +0200
parents 55715fe0a8e1
children 0a9ddb8cd8c1
files kallithea/config/app_cfg.py
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/config/app_cfg.py	Fri Mar 31 21:17:02 2023 +0200
+++ b/kallithea/config/app_cfg.py	Sun Apr 09 16:38:31 2023 +0200
@@ -78,6 +78,10 @@
 
     # Set the default i18n source language so TG doesn't search beyond 'en' in Accept-Language.
     'i18n.lang': 'en',
+
+    # For TurboGears 2.4.3, define the native language for translations to
+    # prevent fall-through to languages requested with lower priority.
+    'i18n.native': ['en', 'en_US', 'en_GB'],
 })
 
 # DebugBar, a debug toolbar for TurboGears2.