Opened 15 years ago
Closed 14 years ago
#2183 closed enhancement (fixed)
Optimize i18n to save space
Reported by: | stoecker | Owned by: | framm |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | Core | Version: | |
Keywords: | Cc: |
Description
Currently we use the gettext functions to have i18n. Each language copies all english strings which is a terrible waste of space. We have 21 copies of each string. This could be reduced to 2.
As we anyway have a wrapper we can change it like that:
- store English strings in a hash containing a array index as value
- store i18n strings in arrays
- on tr() parse get the array index from hash and get string from array with the index
Problem: How to handle plural forms?
Attachments (0)
Change History (4)
comment:1 by , 15 years ago
comment:2 by , 15 years ago
gettext already has a system (using a numeric syntax to define the forms I believe). The question is how we should handle that when we replace gettext:
- use gettext for plurals also in future
- copy gettext plural stuff into josm
- reimplement it
- something else
Above described hash/array method works as is only for non-plurals.
Plural Forms: I suggest implementing the same method that is used by Firefox:
https://developer.mozilla.org/en/Localization_and_Plurals
(I followed development at that time and it took quite a while until the devs found something suitable that works for all languages, see https://bugzilla.mozilla.org/show_bug.cgi?id=394516 ).