Plurals rules error on uploading translation file to Transifex Project

/config/locales/de.yml
Error while uploading translation: b"Could not import file: expected plurals rules '['other']' instead got '['one', 'other']' for resource string '174391802' and language 'de', expected plurals rules '['other']' instead got '['one', 'other']' for resource string '174391862' and language 'de', expected plurals rules '['other']' instead got '['one', 'other']' for resource string '174391822' and language 'de', expected plurals rules '['other']' instead got '['one', 'other']' for resource string '174391820' and language 'de'"
/config/locales/ru.yml
Error while uploading translation: b"Could not import file: expected plurals rules '['other']' instead got '['one', 'few', 'many', 'other']' for resource string '174391802' and language 'ru', expected plurals rules '['other']' instead got '['one', 'few', 'many', 'other']' for resource string '174391862' and language 'ru', expected plurals rules '['other']' instead got '['one', 'few', 'many', 'other']' for resource string '174391820' and language 'ru', expected plurals rules '['other']' instead got '['one', 'few', 'many', 'other']' for resource string '174391822' and language 'ru', expected plurals rules '['other']' instead got '['one', 'few', 'many', 'other']' for resource string '174391796' and language 'ru'"
/config/locales/pt-BR.yml
Error while uploading translation: b"Could not import file: expected plurals rules '['other']' instead got '['one', 'other']' for resource string '174391802' and language 'pt_BR', expected plurals rules '['other']' instead got '['one', 'other']' for resource string '174391862' and language 'pt_BR', expected plurals rules '['other']' instead got '['one', 'other']' for resource string '174391820' and language 'pt_BR', expected plurals rules '['other']' instead got '['one', 'other']' for resource string '174391822' and language 'pt_BR'"
/config/locales/gr.yml
Error while uploading translation: b"Could not import file: Language 'Italian (it)' specified in the YAML file does not match with the language 'Greek (el)' for which it was uploaded."
/config/locales/hi-IN.yml
Error while uploading translation: b"Could not import file: expected plurals rules '['one', 'other']' instead got '['other']' for resource string '174391829' and language 'hi_IN', expected plurals rules '['one', 'other']' instead got '['other']' for resource string '174391812' and language 'hi_IN', expected plurals rules '['one', 'other']' instead got '['other']' for resource string '174391852' and language 'hi_IN'"
/config/locales/es.yml
Error while uploading translation: b"Could not import file: expected plurals rules '['other']' instead got '['one', 'other']' for resource string '174391820' and language 'es', expected plurals rules '['other']' instead got '['one', 'other']' for resource string '174391822' and language 'es'"
/config/locales/ar.yml
Error while uploading translation: b"Could not import file: expected plurals rules '['other']' instead got '['zero', 'one', 'two', 'few', 'many', 'other']' for resource string '174391850' and language 'ar'"

While trying to sync Transifex Project with the Github repository we are getting this error. I guess this is because some languages have more plural forms for a string than the source language and in some languages, there are fewer. Is there a way to keep the number of plural forms flexible ?

Hi Ajit,

This took a while for us to figure out, so I apologize for not getting back to you sooner. Here is what is happening…

There are strings in the translation files that are defined as plurals, however, those same strings are not defined as plurals in the source file (en.yml). For example, for German (de), here are the errors…

​/config/locales/de.yml
Error while uploading translation: b"Could not import file: expected plurals rules ‘[‘other’]’ instead got ‘[‘one’, ‘other’]’ for resource string ‘174391802’ and language ‘de’, expected plurals rules ‘[‘other’]’ instead got ‘[‘one’, ‘other’]’ for resource string ‘174391862’ and language ‘de’, expected plurals rules ‘[‘other’]’ instead got ‘[‘one’, ‘other’]’ for resource string ‘174391822’ and language ‘de’, expected plurals rules ‘[‘other’]’ instead got ‘[‘one’, ‘other’]’ for resource string ‘174391820’ and language ‘de’"
/config/locales/ru.yml

​Now, if we take a source string identifier from that error message, such as 174391802, and add it to the end of this URL…

​https://www.transifex.com/publiclab/publiclaborg/translate/#de/config-locales-en-yml–main/174391802

…it will bring up the string in the Editor (“Billion”), and it shows it being non-plural. Therefore, it cannot have plurals in the translation files. So the fix is to pluralize these strings in the source file.

1 Like