When I GET /project/<project_slug>/resource/<resource_slug>/translation/<lang_code>/, I receive the JSON data that I expect.
I am puzzled by one detail, however. In the following example, the source string is pluralized. What I don’t understand is the meaning of the keys in the dictionary.
{
"comment": "\n",
"context": "",
"key": "You have {num} attempt left.:You have {num} attempts left.",
"string_hash": "0d4813690c5a3f4a4e1b68669285f5be",
"reviewed": false,
"pluralized": true,
"source_string": {
"1": "You have {num} attempt left.",
"5": "You have {num} attempts left."
},
"translation": {
"1": "Il vous reste {num} chance.",
"5": "Il vous reste {num} chances."
}
},
Why “1” and “5”? What do these numbers mean?
Can I rely on my English-plurals to always be stored under “5”?
I suspect that if my source language had been Russian I would have had other numbers there. Is that correct?
Why “1” and “5”? What do these numbers mean? Answer:
1 refers to the form “one” and “5” refers to the form “other”
Can I rely on my English-plurals to always be stored under “5”? Answer:
I am not sure I have understood your question. Could you elaborate a little bit on this?
I suspect that if my source language had been Russian I would have had other numbers there. Is that correct? Answer:
Correct! Each language has its own plural rules specified here
Where can I find some documentation about this? Answer:
Except for the link provided above, you can also check our documentation guide here and here
I hope this helps.
Please let me know if you need any additional clarification.
Please note that the number of forms depends on the language. Each language has its own rules so for example, if you are referring to English then only 2 forms will be defined:
‘1’ for ‘one’
‘5’ for ‘other’
If you are referring to Arabic, though, we need to have the following forms instead:
Hello Nina,
But there is still a challenge in Arabic when translating in such method, for example when i translate django and django related packages, i face an issue that I can’t drop %1d for example from the translated form of ‘2’ for ‘two’ for example, because in Arabic we don’t use the number 2 when saying 2 items, we have a special word for two when describing items such as ‘2 hours’ or ‘2 weeks’ or ‘2 servers’ etc… which is not allowing me to save unless i actually write ‘2 the-two-word-here’ which is funny and not accurate.
is that related to django or how transifex works?
btw that’s not the only case, even with number 1 we don’t say 1 hour we say an hour or a week or “one week” as two words for “1 week”
Hello @Bashar thank you for the additional clarifications. If I understood correctly, some Arabic plural forms do not need to render a variable at all. If this is true then:
Dropping a variable from a plural form in Transifex will result in a translation check (QA check) warning or error, that a variable is missing thus not saving the translation. To overcome this issue in Transifex, you will need to speak with the administrator of the project you are translating into setting the translation check as warning.
Even if the above translations are allowed in Transifex editor, there might be problems when the translations reach the actual application. The compiler might through an error if a variable is missing in a specific plural form. I’m not 100% sure for these cases as it depends on the specific frameworks used, e.g. Django, Ruby, node.js
A possible improvement on Transifex side would be to have a set of languages that it will allow dropping of variables from some plural forms, so that no changes on the translation checks are needed from the administrators. If you are aware of any other languages that have similar linguistic behaviour like the Arabic please share here.