How does gettext handle a / an or d '/ de?

Submit this line for translation:

"Your path is blocked by% s."

What if the variable is "anaconda". Now it should be "Your path is blocked% s".

How does gettext handle this, or how should a client programmer handle it, or how do other systems handle it?

Imagine this line:

"% s Page".

We want to go to Brian or Jim or Lucinda. All is well and good.

But in a French translation this is:

"Page de% s".

This is fine for Jean-Paul or Claudette, but what about poor Anais? She needs a Page d'Anais, not a Page de Anais.

Does gettext help handle this? What is the standard practice?

+4
source share
1 answer

As you expect, gettext will not help you build grammatically correct strings. Even when you have no problems in English, creating text text programmatically is a great no-no localization, since language-related problems can occur. If this is manageable, you should, for example, have separate lines for each case, such as “Your path is blocked by a dinosaur,” “Your path is blocked by a rabbit,” “Your path is blocked by an anaconda,” etc. This means that duplications, but translation systems help automate the process using translation memories and even in more complex cases of automatic translation (translators just need proofreading and correct if necessary).

Your "Page d'Anais" / "Page de Claudette" is a great example. The only solution in such cases is to save the format string in the localizable string table (and it looks like you are already doing this) so that the localizers can find a workable solution. (for example, "Page de: Anais", although it does not work very well in each case, therefore they will localize "% s Page" as "Page de:% s"). But localizers must understand where these format strings will go and how they are built, so you need to make this clear.

One of the most widely incorrect lines is "% n of% n" (used to print pages like on the page "1 of 4"), which without context are often translated completely incorrectly. For instance. in French, the literal translation is “1 de 4”, which in this context does not make sense, it should be “1 sur 4”.

+3
source

All Articles