Closed puzrin closed 5 years ago
Format. Something like this:
'en-GB':
Nut: [ Nut, Nuts ]
'ru-RU':
Settings: Настройки
Nut: [ Гайка, Гайки, Гаек ]
'LVGL is awesome!': ~ # null, added by extractor as mark to translate
Notes:
zero, ``one
, two
, few
, many
, other
) are not used, because sequence is strict for each language, and optional (skippable) forms are at the end.Looks good to me. en_GB
and ru_RU
should be compiled to C file and array names as I suggested here (I used different naming but doesn't really matter)
http://docs.translatehouse.org/projects/translate-toolkit/en/latest/formats/index.html - hear is nice list of available translations formats
My suggestion is close to Ruby, by they supports plurals in different way: https://github.com/translate/translate/issues/3615
Still not sure what is better:
Probably we just need to support both and add format option to scripts. Need to dig web translator docs to decide.
For info: at web projects plurals are ~ 15% of phrases.
Ruby's way:
'en-GB':
Nut:
one: Nut
many: Nuts
'ru-RU':
Settings: Настройки
Nut:
one: Гайка
few: Гайки
many: Гаек
'LVGL is awesome!': ~ # null, added by extractor as mark to translate
May be, not so bad...
Can one
, few
, many
or similar expressions describe complicated plural cases?
Have look at Slovenia here: https://www.gnu.org/software/gettext/manual/html_node/Plural-forms.html
Can
one
,few
,many
or similar expressions describe complicated plural cases?
Yes. See https://github.com/nodeca/plurals-cldr#references
I did plurals codegen for js. It uses Unicode CLDR data to build code & tests automatically. Works with all languages.
We just will use a bit different template to generate C code instead of JS. Not a big deal.
I see, fine!
It seems to we still need a config
file where we describe the languages. For example:
The yaml
files for the translations should be created based on the languages declared in this file.
yaml is self-sufficient. It's created by user and extended by user/extractor. I can't imagine extra info, missed in yaml and required to update is.
- number of plurals
- plural rule (one-line rules here )
This is NOT for yaml file. This is for generated C source. Different abstraction layer. Info is generated automatically from locale name, CLDR data and so on.
And where will be the mentioned info (number of plurals, plural rules) stored to automatically generated from the local name?
Generated translations.c
can contain any additional data you may wish for proper work.
I guess, this is more for #7.
Close - landed to docs
For user, translations are expected to be in text format:
C sources will be generated by compiler utility, and to expected to be edited.
Default file type is YAML. Alternative - JSON (will be supported automatically as YAML subset).
Format
TBD