Bug 12855 - AppleLanguages Argument
Summary: AppleLanguages Argument
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: Library (Xamarin.Mac.dll) ()
Version: 1.4.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Aaron Bockover [MSFT]
Depends on:
Reported: 2013-06-24 14:49 UTC by Ryan
Modified: 2013-09-26 13:19 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Ryan 2013-06-24 14:49:22 UTC
Xamarin Mac applications are not affected by the "AppleLanguages" argument. For example, executing the command '/Applications/MyApp.app/Contents/MacOS/MyApp -AppleLanguages "(ar)"' should cause the application to use Arabic resources and display in right to left. I've tried the same command with non Xamarin projects (pure Objective-C), and those apps change the layout to be Right-To-Left and load Arabic resource strings if available.

Setting the "AppleLanguages" argument in the global defaults domain (NSGlobalDomain) doesn't have any effect either. This can be accomplished by executing "defaults write <ApplicationIdentifier> AppleLanguages -array ar".
Comment 1 Aaron Bockover [MSFT] 2013-06-24 16:19:44 UTC
I do not think this is necessarily a bug in Xamarin.Mac. Those arguments are parsed by NSUserDefaults as they are passed through to NSApplicationMain (NSApplication.Main, in Xamarin.Mac). I can see this happening with a simple test.

I added the following code to my AppDelegate's FinishedLaunching method:

foreach (var lang in NSUserDefaults.StandardUserDefaults.ArrayForKey ("AppleLanguages")) {
    Console.WriteLine (lang);

When run without passing arguments to the application, the following list is output on my system (this is based on the configured system/session languages for the user):

… (about 25 more)

When I pass -AppleLanguages '(ar,pt)' I see:


This indicates that the NSUserDefaults.StandardUserDefaults are in fact being influenced by the command line arguments.

Note that only UI elements with string values returned through NSLocalizedString/NSBundle.MainBundle.LocalizedString will be localized according to AppleLanguages.

If you have a test case we could look through, that might help. Otherwise, I can't see anything that's wrong with Xamarin.Mac itself.
Comment 2 Aaron Bockover [MSFT] 2013-09-26 13:19:41 UTC
Closing due to no followup in 3 months. Research in my previous comment implies this isn't actually a bug anyway.