Changeset - 84b4fc9db016
[Not reviewed]
stable
0 1 0
Mads Kiilerich (mads) - 3 years ago 2023-04-09 16:38:31
mads@kiilerich.com
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.
1 file changed with 4 insertions and 0 deletions:
0 comments (0 inline, 0 general)
kallithea/config/app_cfg.py
Show inline comments
 
@@ -69,24 +69,28 @@ base_config.update_blueprint({
 

	
 
    # Use custom error page for these errors. By default, Turbogears2 does not add
 
    # 400 in this list.
 
    # Explicitly listing all is considered more robust than appending to defaults,
 
    # in light of possible future framework changes.
 
    'errorpage.status_codes': [400, 401, 403, 404],
 

	
 
    # Disable transaction manager -- currently Kallithea takes care of transactions itself
 
    'tm.enabled': False,
 

	
 
    # 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.
 
# (https://github.com/TurboGears/tgext.debugbar)
 
# To enable it, install 'tgext.debugbar' and 'kajiki', and run Kallithea with
 
# 'debug = true' (not in production!)
 
# See the Kallithea documentation for more information.
 
try:
 
    import kajiki  # only to check its existence
 
    from tgext.debugbar import enable_debugbar
 
    assert kajiki
 
except ImportError:
0 comments (0 inline, 0 general)