zh_Hant does not render as expected


I resurrected the translations from https://github.com/freedomofpress/securedrop/pull/753 for zh_Hant. The good news is that a number of strings are still valid :slight_smile: However they do not render properly in firefox and I’m not sure what the problem is.

Help ?

It now renders correctly (not sure what the problem was initially). But the locale matching is tricky. When the Accept-Language header is set to zh-CN as the first possibility, babel tries to load the messages.mo from zh_Hans_CN for some reason (and silently fails to do so when there only is a zh_CN directory. I suspect that’s the kind of subtle divergence that drive people to select languages based on a fixed list instead of sophisticated but difficult to debug matching strategies.

I have reworked the language negotiation entirely (as part of the https://github.com/dachary/securedrop/tree/wip-i18n-base patch series). It was too simplistic and did not account for:

  • the script part of zh_Hans_CN or zh_Hant_CN
  • aliases such as fr instead of fr_FR

It’s all better now !

1 Like