I am developing an OSX app with very minimum UI. For internalization/localization, I used a 3rd party library to replace all my text with appropriate language (I detect the language using [NSLocale preferredLanguages]). The problem is my NSAlert always displays its content (including text, button layout...) in Left-to-Right direction, even when I switch the system language to, says, Arabic.
From my research it would seem that NSAlert should automatically switch the direction correctly (though no where it is explicitly said so). I also check this
NSUserInterfaceLayoutDirection direction = [NSApplication sharedApplication].userInterfaceLayoutDirection;
and direction
would always (even in the case of system language being set to Arabic), equal to
NSUserInterfaceLayoutDirection::NSUserInterfaceLayoutDirectionLeftToRight
. I suspect this is the problem, but don't quite know how to address this.
Anybody know how to:
- Make sure NSApplication knows the right layout direction?
or
- Make sure NSAlert display with the correct direction (particularly in RLF language)?
Note:
I look at this question, NSAlert for right to left languages (reversed layout), but the answer is not helpful at all for me.
I also look at this guide here:
and it still does not help, because in order to add support for languages, it looks like this guide requires that I have xib or a storyboard file. My project happens to not have either of these.
Thank you all in advance.