The list of available languages currently follows this dataflow:
The file xml/templates/languages.tpl contains a prototype of a SQL statement to insert a list of languages in a table.
GenCode calls CRM/Core/CodeGen/I18n.php, which does regex-foo to extract the list of languages. It writes the list to install/langs.php.
The plugin AvailableLangs.civi-setup.php reads the list of from install/langs.php.
Complaints with this arrangement:
(Primary complaint) Using civicrm-setup to install requires that you previously ran GenCode (or copied the files)
Using civicrm-setup to install requires that you have the old install/ folder.
It is aesthetically displeasing to read data by running regex against a SQL statement.
Possible solutions:
Commit install/langs.php to git (like we do with DAOs). Sounds easy - and fixes the primary complaint (#1).
Copy the static list of languages into AvailableLangs.civi-setup.php. Sounds easy - and eventually fixes everything (if we manage to deprecate the install/ folder). But in the interim, adding a language requires an extra step. (Patch both civicrm-core and civicrm-setup.)
Update civicrm-core so that the canonical list of languages is not in a SQL file. (Put it in something easy to parse -- like .json or .csv or .php.) Update both CRM/Core/CodeGen/I18n.php and AvailableLangs.civi-setup.php to read from this file. (This is prettiest, but a little more work/coordination.)
The list of available languages currently follows this dataflow:
xml/templates/languages.tpl
contains a prototype of a SQL statement to insert a list of languages in a table.GenCode
callsCRM/Core/CodeGen/I18n.php
, which does regex-foo to extract the list of languages. It writes the list toinstall/langs.php
.AvailableLangs.civi-setup.php
reads the list of frominstall/langs.php
.Complaints with this arrangement:
civicrm-setup
to install requires that you previously ranGenCode
(or copied the files)civicrm-setup
to install requires that you have the oldinstall/
folder.Possible solutions:
install/langs.php
to git (like we do with DAOs). Sounds easy - and fixes the primary complaint (#1
).AvailableLangs.civi-setup.php
. Sounds easy - and eventually fixes everything (if we manage to deprecate theinstall/
folder). But in the interim, adding a language requires an extra step. (Patch bothcivicrm-core
andcivicrm-setup
.)civicrm-core
so that the canonical list of languages is not in a SQL file. (Put it in something easy to parse -- like.json
or.csv
or.php
.) Update bothCRM/Core/CodeGen/I18n.php
andAvailableLangs.civi-setup.php
to read from this file. (This is prettiest, but a little more work/coordination.)