Xojo translation improvment?

Hello,

I am trying to localize a large application in multiple language but I found options to be limited. I am used to vue-i18n package that I use for web development and they come

I got issues with the following;

  • Pluralization
  • Linked message

The issue is that I duplicate a lot of constants and got custom code to set the correct translation / pluralization or to link multiple translations.

It would take the following form:

  • Pluralization: no apples | one apple | {count} apples
    Screenshot 2023-01-03 at 17.57.05

  • Linked locale messages: @:hello @:world !!!
    Screenshot 2023-01-03 at 17.57.40

  • Formatting linked locale messages: Please provide @.lower:homeAddress
    Screenshot 2023-01-03 at 17.58.01

I tried to start a project but I do not if it’s useful.

Created a sample but nearly everything is hard coded and limited. It just to get the idea of what I am looking for.

MacOS

Windows

(Apps are not notarized)

The goal is to create an open source project but I got some issues looping through constants, inspecting a module, etc

Or it there a simple way to achieve that?

Julien

Edit: Added screenshots

You have to find workaround yourself. But it’s not that complicated. Most of my pluralisation comes in form of 2 constants:


I make a pair and then add the constant to the data that I want displayed:

dim AppLogData as Pair = kMessageAddedSi : kMessageAddedPl
Globals.theAppLog.AddToAppLog(AppLogData, 1)

The AppLog data has a count and therefore it knows which constant to show.

I’m not sure what you want to do with “linked locale messages”.

Beatrix, in French you shouldn’t put the s in exporté not plural.

1 Like

Bad developer. The email in the Spanish translation should be capitalized and the Italian posta also looks bad.

For linked locale, it was to reduce the amount of constant and reuse constant already defined to avoid different translations for the same term.

If you are going to hire someone to do the translations, keep it as simple as possible.

Asking a translator to translate three versions of the same string in one line is prone to error:
No apples | 1 apple | 2 apples
Might become
No apples| 1 apple |2 apples
(notice the difference of spacing in the separators)

Moreover I advise to implement some sort of automatic testing for your translations:

  • check each translated string for placeholders
  • check each translated string for double space characters
  • check each translated string for missing/additional spaces
  • …

One of my translators who works for a big translation company told me:
Never trust a translator to do a 100% perfect job, if you can afford it, have someone else proof-read the translation.

1 Like

Leading & trailing carriage returns can also cause issues.

Indeed, in the second screen shot, it should be “exporté” But in the first screen shot where there are several exported emails, “exportés” is correct.

Funny how spoken languages are like code. Sometimes, we have excessively complicated conventions, but that is the way it is.

Thank you for the feedback

I used trim to remove the space in my code but it can have a lot of thing happening and errors from the user that will lead to issues of course

What I wanted with that is to suggest a way of working or to create a kind of standard so that new users will have something easy to use instead of developing their own translation management.

I know there are a lot of rules but as I am translating the app since a few months, I find it hard to accomplish and time consuming.

For constants, my approach to this (for my apps in french), is what the Finder did in Mac OS Classic.
Example: I define this constant:
image

Then in code:

Var Cnt As Integer=2
Var Result As String=CstContains

Result=Result.ReplaceAll("^0",Cnt.ToString).ReplaceAll("^1",if(Cnt>1,"s","")).ReplaceAll("^2",if(Cnt>1,"sont","est"))

MessageBox Result

This gives:
0 élément est identique.
1 élément est identique.
2 éléments sont identiques.

(well, for 0, the message may look weird, but you certainly want a completely message when there’s no result, anyway).

You can have some variation:

Var Cnt As Integer=2
Var Result As String=CstContains

Var Rpl() As String

Rpl.Add cnt.ToString
Rpl.Add if(Cnt>1,"s","")
Rpl.Add if(Cnt>1,"sont","est")

for i as Integer=0 to 2
  Result=Result.ReplaceAll("^"+i.ToString,Rpl(i))
next

MessageBox Result

Or:

Var Cnt As Integer=2
Var Result As String=CstContains

Var Rpl() As String=Array(cnt.ToString,if(Cnt>1,"s",""),if(Cnt>1,"sont","est"))

for i as Integer=0 to 2
  Result=Result.ReplaceAll("^"+i.ToString,Rpl(i))
next

MessageBox Result

(that’s a quick example written right now)

While you might completely understand this, good luck explaining it to a translator.
I do not recommend this.

I’m not saying I recommend it either. Just saying the Finder (and other Mac apps) were designed that way. Now, if you think Apple made mistakes… that’s not impossible.

Just a side note here: when talking about software localization, it is good to remember that some languages (like Polish, Ukrainian, Russian…) have more plural forms and go beyond the simple “one” & “many” distinction known from English or French.

In English you can safely use two forms, {one} apple and {many} apples. Works great for French, German and Spanish as well. However, if you wanted to translate your app into Polish, you would cause the translator’s headache, as the two strings are not enough and a third form is required:

1 apple = 1 jabłko
2 apples = 2 jabłka (also 3, 4, 22, 23, 24, 32, 33, 34 and so on)
5 apples = 5 jabłek (and any other amount, including 11, 12 and 13)

See the great article about plurals on Unicode website:

Also, check out this table with plural rules for many languages (yep, the crazy complexity here and there might be hard to even believe for those using only the basic two forms :slight_smile:):
http://www.unicode.org/cldr/cldr-aux/charts/22/supplemental/language_plural_rules.html

Modern macOS uses stringsdict files to ensure correct plural forms beyond one/many, see:

4 Likes

Raymond Chen talks about this briefly in one of his MS-Windows blog articles.