You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Suresh Chandrasekharan (JIRA)" <ji...@apache.org> on 2015/01/07 09:50:34 UTC

[jira] [Created] (CB-8258) iOS getPreferredLanguage should be from the list of available localizations for the app

Suresh Chandrasekharan created CB-8258:
------------------------------------------

             Summary: iOS getPreferredLanguage should be from the list of available localizations for the app
                 Key: CB-8258
                 URL: https://issues.apache.org/jira/browse/CB-8258
             Project: Apache Cordova
          Issue Type: Bug
          Components: iOS, Plugin Globalization
            Reporter: Suresh Chandrasekharan


In CDVGlobalization.m, the following line is used to get the preferredLanguage from getPreferredLanguage

 NSString* language = [[NSLocale preferredLanguages] objectAtIndex:0];

The issue with this is, for an application, if the system preferred language is not available in Application Resource bundle,all framework messages will appear in the system preferred language and all app specific strings will appear in a fallback language like en_US. 

A second scenario is, like for a language like Portuguese, if only viewControllerBundle_pt.xlf is existing as application resource but the system language selected is pt_BR, with the current code, the fallback resource bundle viewControllerBundle_pt.xlf won't be activated and application will appear in en_US

Using the following, instead we can get a preferred language from the list of available localizations for the an application, which is independent of the preferredLanguage for the system.

NSString *language = [[[NSBundle mainBundle] preferredLocalizations] objectAtIndex:0];



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org