[OpenStack-I18n] Generate horizon language list automatically
amotoki at gmail.com
Mon Mar 27 09:15:49 UTC 2017
Hi I18n team,
I just push my patch which changes horizon to generate the language
list automatically 
and the this topic is traced by the bug .
I would like to share my long-standing idea with the team.
Does it sound reasonable?
* The basic idea is to generate the language list based on message
catalogs (PO files) availability.
* Horizon now has four types of message catalogs (django, djangojs) in
horizon and openstack_dashboard respectively.
If all message catalogs are present, such languages are listed in
the language list.
There are some corner case logic.
* Some languages share a same locale prefix.
Good example is Spanish variants: es, es-ar, es-mx and es-ve.
When horizon searches message catalogs for es-ar, a locale "es_AR"
is first checked
and then "es" (prefix) locale is checked. In this case, if "es-ar"
has no corresponding
translations ("es_AR") and "es" is already registered in the
language list, "es-ar" will
not be added in the language list.
* For the source language (i.e., English), message catalog existence
check is skipped.
* The current setting LANGUAGES still has effect. Operators can use e
used to limit
the initial set of languages to exclude languages they want to show
to their users.
(Note that even when a language is specified in LANGUAGES setting,
if not all message catalogs for the language exist the language
will be skipped.)
More information about the OpenStack-I18n