Replies: 2 comments 3 replies
-
Resources: |
Beta Was this translation helpful? Give feedback.
-
As you can see from your link, pluralisation is not easy. Russian, for example, does this:
You can imagine how complex the logic would get if we need to manually implement pluralisation for all languages.ç I think we would need a macro to decide, based on the language and the number, the translation # This macro needs two values:
# - language
# - number
if language == "ar":
if number == 1:
key_prefix = "one_"
elif number == 2:
key_prefix = "two_"
# etc.
# At the end, if key_prefix is still unset, use a default which should match current behaviour.
if not key_prefix:
if number == 1:
# Would match to "singular_result", for example, which would be the new name for the current `result` string.
key_prefix = "singular_"
else:
key_prefix = "plural_" # 0 and > 1
return key_prefix Then use it (not sure this would work):
The first line determines the word we're looking for. The second line joins the prefix (the job of the new macro) with that word. Finally, we used the join Something like this would be my first approach. The new macro (say, In summary: I don't like the idea of doing proper pluralisation, but I do like the end result. Many i18n strings would need to change (say, to include Is this the approach you had in mind? |
Beta Was this translation helpful? Give feedback.
-
Hello @welpo, I want to support plural forms in Tabi, but this needs to be done in the
i18n
directory. So do you mind?My language is Arabic, and it has a few plural forms (unlike English, which only has two). I can help you with the translations if you want.
Note
I don't know if aouther languages have more than two plural forms, I'll add to Arabic only and keep the rest as they are.
For example, the word "minute" in Arabic has three plural forms:
So, I will add the following to the translations file:
And the same thing for posts and tags, I think that's only.
Beta Was this translation helpful? Give feedback.
All reactions