I'm starting this thread as a place to discuss a couple ideas brought up by @Qiaeru in the issue tracker:
These two suggestions ought to be discussed together, since it seems to me that we ought to be able to kill both these birds with a single stone. (Yikes, there I go again. We need a better idiom for that.)
As @Qiaeru pointed out in the issues linked above, getting a language pack started is currently a somewhat involved, rather technical process. Any translator starting fresh with a copy of the English language pack (or the French one, for that matter 😃 ) will have to:
Specify the pluralization rules used by the localized strings,
Specify whether gender is used by the localized strings, and
Extract and adapt the Moment.js code for their locale.
While it's true that some translators may lack the coding skills to do these things, the real issue here is the fact that these are all things that we could do for the translator. All we need to know is is the locale code.
What I'd suggest is that Flarum provide a way to create a language pack skeleton, similar to the extension skeleton that developers can create using the "php flarum/flarum generate:extension
" command.
Let's call it the "php flarum/flarum generate:langpack
" command. When executed, it would begin by asking the translator to provide the following information:
- Vendor name
- Language pack name
- Language pack title
- IETF language tag
That's the bare minimum; we might also want to ask for things like the translator's name and contact address, etc. Once it has this information, it would be able to do the following:
Create a properly-named directory for the new language pack to reside in.
Add a fresh copy of the English language pack YAML files.
Construct an appropriate configuration file with the following information:
- Pluralization rules appropriate to the specified locale
- Grammatical gender flag, if needed for the locale
- Moment.js code appropriate to the specified locale
Add or remove pluralization keys from the YML files (if we want to get fancy).
Modify the license file to reflect the translator's name (again, the fancy option).
The information necessary to insert the pluralization rules and gender flag could be provide by means of a simple lookup table. The same lookup table could also provide the coordinates of the necessary Moment.js information, which would be added to the configuration automatically.
Ultimately all the translator would have to do is translate the strings. This would simplify the l10n docs dramatically, since many of the most difficult to explain concepts would be done automatically.