How does the Mac OS determine which localization.strings file to use? - macos

I have and XCode project with a list of supported languages. By default, XCode only lists 4 default languages when you click on "Add Localization" on the Localized Group info window. I just followed a sample project and added Localizations in a mix of full language names and some using the what I think is ISO 639-1 notation. What is weird is this:
I added a localization name "zh_CN" (just imitated the existing project) for Simplified Chinese. When the project is compiled, it has the .app/Contents/Resources/zh_CN.lproj/Localizable.strings. I change the system's language to Simiplified Chinese and run the app. Voila, it works and gets the Simplified Chinese Localizable.strings.
However, if I use NSLocale's API, I get "zh-Hans". "zh_CN" strings were loaded yet NSLocale returns "zh-Hans".
How does the Mac OS determine to use the "zh_CN" strings when using Simplified Chinese as the locale? Is there an API to know that the current system language will use the "zh_CN"?

zh_CN is a old way to indicate Simiplified Chinese.
and now it's better to use "zh-Hans" instead. (in order to support old vernon of iOS and OSX, I think Apple will still support old style names like zh_cn.
(this document "Language and Locale Designations" explains everything :D)

Related

Selecting different strings resource file based on app preference (translation vs localization)

For the app I am working on I want to give the user the ability to select a different language than their phone is set to.
I have set everything up according to: https://www.c-sharpcorner.com/article/multilingual-implementation-using-xamarin-forms/ and it works great for 'official' languages like French, English, Indonesian, etc. However, since the app is pretty much about any and all spoken (or signed) language, I also want to offer the option to select Klingon, Toki pona, Esperanto, Ido, etc.
When I try to set the language to Esperanto with
CultureInfo language = new CultureInfo("eo");
the app crashes with:
Message (System.Globalization.CultureNotFoundException) "Culture name eo is not supported.\nParameter name: name" string
I have all the strings in resource files, I know exactly what the name of the file is for each language, and I don't need full localisation for these languages, so a way to force the use of 'AppResources.eo.resx' through code (after checking if the user has indeed set this preference) would also work.
Does anyone have ideas on how to do this? I feel like I'm missing something really obvious…
In case it matters, I have:
Visual Studio Community 2019 for Mac
Version 8.10.8 (build 0)
Mac OS X 10.16.0

How to localize C++ app (win and mac) with common solution?

I have a cross platform app (Win and Mac) using C++. I want this app to be localized for both platforms to support few languages like German, French, etc., I am looking for a common approach to support for both platforms otherwise I have to go with platform specific localization. That will double the work.
Platform specific:
Use Localizable.strings file for Mac
User .xml file keeping it in resources for Win
I am looking for a common solution to support both platforms.
You could parse the related localization files into a const list of key-value tables on startup where each list would correspond to a language and each table in the list would contain localized strings for the specific language. Then reference the strings with keys from your code.

How to change spell checker language

I'm using Poedit/1.8.11 on Windows 10 to manage translations for a CakePHP project, namely English and Spanish.
For each catalog, I've chosen the translation language from the drop down list so I presume they are correct:
In source *.po they look like this:
"Language: en_GB\n"
"Language: es_AR\n"
Nonetheless, spell checker is checking both translations as Spanish. The program does not seem to recognise the language and I can't find any menu item to pick it manually:
Online help does not even mention spelling. How do you set the spell checking language in Poedit?
This isn’t a programming question, but a “how to use Windows 10” one. In Windows 8+, the spellchecker always uses the language of your keyboard (which is a different thing from its layout!).
See https://superuser.com/questions/480540/how-can-i-change-the-spell-check-and-auto-correction-language-of-ie10-windows8 for detailed instructions.
As Václav Slavík explains, Poedit does not implement its own spell checking solution. Instead, it relies on Windows builtin spell checker.
In any case, Windows spell engine appears to ignore both current input language at OS level:
... and current translation language set in gettext catalogue:
Instead, it appears to merge the dictionaries of all available languages and run a simultaneous check on all of them:
I understand it's a feature aimed at mobile users since it's similar to what Android virtual keyboard does but in this particular case it renders the entire tool useless.
Given that configuring languages is particularly difficult and counter-intuitive, I recommend to just ignore the feature.

Computer Aided Translation and Xcode

Is it somehow possible to use CAT Tools (Computer Aided Translation) like Swordfish in any senseful way to get i18n done? Copy/pasting strings is error prone and any MS Word is not exactly a pro application for translations.
Any other app/system/format that could work well with XCode for that job?
It looks like AppleGlot is such a tool I looked for. It doesn't translate, but extracts strings and allows incremental localization. It has XLIFF support (as Swordfish, mentioned above).
AppleGlot is available in the developers.apple.com area.

MFC localization not working with MUI install of Windows 7

OK, so we're writing our MFC application to make use of the built-in localization support with satellite DLL's since MFC 7. Everything seem to be working fine, except that my Windows 7 Enterprise Edition install with MUI support and using a Swedish UI instead of an English UI still displays the English UI in our application.
The application uses Swedish as its default language, with an English localization DLL in the form AppNameENU.dll, so MFC is actually intentionally switching to English language under these circumstances, as if it's not caring for the user choice in the MUI-enabled Windows OS, and only the default shipping language of the Windows install?
From the MSDN page on this (the link above), I read it as MFC should actually take these settings into account though, but I'm not 100% sure. Can someone please clarify?
It's because the MFC support for language selection has a design bug: It will decide to load resources from the exe only if no DLL match user OR system language.
In your case: It sets up its (ordered) list of languages as such:
Swedish (User language)
English (System language)
Then it looks up your DLLs (Bug: only the dlls, not the exe!): No match for Swedish. But there's a match for English!
Solution: Use my CLanguageSupport class. It works fine even in your use case.
Feel free to use it. You'll need only a couple of minutes to incorporate it into your app and it uses the exact same DLL scheme as the one you already implemented. (Hint: Don't forget the step where you must get rid of the CWinApp::InitInstance() call!)
In addition, if you are interested (this is optional), you can get an automatic languages menu to let user pick his own preference in case the default is not what he wants.
And if you're looking for a great tool to help you manage your translations, think appTranslator ;-)
HTH,

Resources