Understanding localization and some tests

I’m learning/testing the localization features and the differences between macOS and Windows.

After a lot of tests I found out that:

  • on macOS if I build with Language Spanish, I get the Save Dialog in Spanish even if the computer is in English (no dynamic constants used)
  • on Windows the same build will display the language it is running
  • there is a case <https://xojo.com/issue/49505> and it looks like some strings are missing

What I don’t understand is why Xojo needs to ship Localizable.strings inside the framework when they (some?) are handled within macOS. For example, create a new project and use this code:

Dim f As FolderItem f = GetSaveFolderItem("", "test")
Then change build language to Spanish and run the project. Expand the save window (by clicking the button on the right side of “Guardar como:”), you can see every button/label in Spanish even when they are missing from Localizable.strings, like “New Folder” (Nueva carpeta), “Save As:” (Guardar como), “Tags:” (Etiquetas), “Hide extension” (Ocultar extensin).

So, if this dialog can change everything from English to Spanish even if the strings are not in Localizable.strings, then why the need to supply that file for MessageDialog strings (case 49505) or other values, can’t you let the OS handle that?

From my tests, on Windows, it doesn’t matter if you compile with Language Spanish or English, the MsgBox and Save dialog will show the language your windows is using as the main one.

One tip, if you want your app on macOS to have the same behavior as in windows (MsgBox and Dialog in OS language) then you just need to add a localizable variable to your project with the languages you want, even if you don’t use the variable. For example, you created a project above that change the Save dialog to Spanish or English when you change the Build Language. Now create App.Constat kTest, type Text, Scope protected, Dynamic On, add language English, value test, Spanish, value test and run your project again. Your save dialog will be in the language your mac is set as default language no matter if you build language English or build language Spanish.

I hope this is clear.

After a few more tests I know that the Save Dialog box is not using any of the strings in es.lproj/Localizable.strings

This is what I did.
The original Yes, No, Cancel MsgBox only has Cancel translated as “Cancelar”:

I changed the string “Cancelar” to “Cancelada”:

The Save dialog still shows “Cancelar”, so every button on that dialog box is using the system values (or maybe there is another file with those strings?):

Not knowing how the internals with the framework works, I guess case 49505 could be fixed by:
1.- Setting the strings missing as localizable:

  • Abort
  • Retry
  • Ignore
  • Yes
  • No
    2.- use the same technique that is used with the Save dialog box (if possible)

If #2 is possible I guess that’s better, that way there is no need to translate and provide the localizable.strings at all, but I guess that is not possible and that’s why all those language files are included.

Note: I tried to add the missing strings, but I guess they are not set as localizable (the app doesn’t look for “Yes” in Spanish), and also removing the file (in that case 2 buttons in Spanish reverted back to English).