My app has not been approved by the Apple Store (Mac desktop) because the export modal alert is showing mixed localizations. My app is set to use the default localization, but the reviewer mentioned that when running the app on their English computer, the save dialog appears in Portuguese. I am using the default dialog. Can anyone help me understand why the app is not displaying the default language?
Thanks in advance for any assistance!
Is this a save as dialog? If so are you using any add ons that add, for example, an accessory panel?
Do you have an example of the text that is shown? If you search your application for that text does it show up?
I am using no plugin or addon.
This is the code:
dim nsd as new SaveAsDialog
nsd.Filter = "text/plain"
nsd.SuggestedFileName = "export.csv"
This is the image that app revisor sent to me:
As my computer is in Portuguese, this is also what I see in my computer.
Did you test the app in a computer set to English?
Are you building with Language: Default, English or Portuguese?
Is there any Portuguese constants in your application at all?
- Right click on the built application
- Select “Show Package Contents”
- Open the “Contents” folder
- Open the “Resources” folder
- Look for a folder labeled “pt.lproj”
If you find one then there is a contact with Portuguese localisation. Within the folder there will be a file called “Localizable.strings”. Open that in a text editor and you can see the name of the constants and the text.
Hunt down those constants and if you don’t intend your app to be localised of that language then remove the Portuguese version from the constants.
If it is all of your constants and they’re all in English then you need to set the system language to English when you build the application.
Show the package contents after building to make sure the “pt.lproj” isn’t there.
Finally, make sure that there are only folders for the languages that you have decided to localised for.
For Xojo localisable string constants you several options:
- The value labelled “Default” over on the right.
- The value(s) defined in each row as a given language.
In my example:
- “Default” is “Centre”
- “English (UK)” is “Centre”
- “English” is “Center”
The Xojo setting for language in the build decides how it treats the “Default” value.
- If Xojo is set to a given language then the “Default” value for each constant is said to be in that language.
- If Xojo is set to “Default” then the “Default” language for the constant is set to be in the first language you have chosen in System Preferences at build time. In the following example German:
If a language is defined in even one constant then the Open and Close dialogs will show the correct localisation for that language.
Make sure the Default Language in the Shared build settings is set to Default and not something else.
@Greg_O I think his app is only in English and the system language is set to Portuguese. Which is what I think caused this in the first place?
Ah yes. I remember that the Xojo IDE would periodically have French dialogs when Stéphane was doing builds and he’s forget to switch the language.
Lesson number one for localisation: never ever have the language at default. I even have a check for it.
If I was not clear, I’m asking about this setting:
As mentioned in this thread, that could cause problems.
I am building it as Default
I only created those constants because I found a very old thread here about this (the problem existed before I created this)
this here: Understanding localization and some tests
What should I leave it?
If there is no important text to be translated in the app, it should adapt the dialog to system language. I thought default would be the right solution… am I wrong?
Is your app only in English?
If you don’t have localized constants, then the app build with Xojo will not change to the language the macOS is running and will show Portuguese as that is the Default language you build your app (computer language). You can change from Default to English to show English language.
And make an IDE Script with the following text:
dim dbg as String
if debugBuild then dbg = ".debug"
dim appNameForShell as string = PropertyValue("App.MacOSXAppName") + dbg +".app" + "/Contents/Info.plist"
appNameForShell = replaceall(appNameForShell, " ", "\ ")
Dim AppPath As String = CurrentBuildLocation + "/" + ReplaceAll(CurrentBuildAppName, " ", "\ ")
if right(AppPath, 4) <> ".app" then appPath = appPath + ".app"
dim theResult as string
'ensure english as basic language
theResult = DoShellCommand("/usr/bin/defaults read " + AppPath + "/Contents/Info ""CFBundleDevelopmentRegion""")
if instr(theResult, "en") = 0 then print "Language is not english anymore."
In later versions of Xojo you do not need to add .app to the name of the app in scripts. It will already be there.
Having just one constant in a given language will result in the dialogs being localised to that language. Remove the languages you do not want to support.
Setting Xojo to default will result in it adding your Default version of the constants to your application in the language defined in system preferences at the time of building. If you don’t want this then set Xojo to the true language used in the Default values of your constants.
What I usually see from shared examples created by German friends is the Edit Menu, MenuItems Names in German… on my French MacOS.
Setting Xojo “Language setting” to “Default” on a Mac will do the following, and may not be what you require:
- Tells Xojo to ask the operating system which is the default language, given the order in System Preferences.
- Defines the language that the “Default” value for constants are set as, no matter what the text contains.
For example, if Xojo is set to “Default” and your system is set to “Portuguese” then:
- The constants default values will be treated as Portuguese.
- Xojo will create a “pt.lproj” folder and inform the operating system that your application supports Portuguese.
- System provided dialogs, such as save, open etc will be shown in that language on systems that are set to that language.
If your constants default values are English then choose English, leaving it as Default will mean that others that may load and build the project could get dialogs that are in their native language.
If you define constants in a given language then Xojo will generate a language specific folder within the application resources and the application will still show the correct language for the system dialogs.
The take home from this, on a Mac, is never use “Default” in Xojo’s Shared settings value. Set it to the language you use in your constants Default values. Otherwise your system dialogs will come out in what ever language the system is set to when you build the application.