[ 
https://issues.apache.org/jira/browse/CB-8258?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15108639#comment-15108639
 ] 

jcesarmobile commented on CB-8258:
----------------------------------

But on a regular cordova project, that it's created with just english language, 
if you want to use javascript to localize your app and you use the 
globalization plugin to get the device language, your suggestion doesn't make 
sense.

Example:
I have my device language set to Spanish. 
Using current implementation of the globalization plugin I'll get "es-ES", so 
using a javascript library that will show the UI deppending on the language I 
pass (or something custom made) will show the UI in Spanish.
Using your suggestion, the globalization plugin will return "en" as it's the 
only language the project includes, so the UI will be displayed in English 
despite having Spanish selected.


System messages have nothing to do with the value returned by the globalization 
plugin, they are handled by the project localizations if I add the "es" string 
in the CFBundleLocalizations key, my app will show system messages on Spanish, 
if I don't add it, it will show the messages in English, that is not handled by 
cordova and has nothing to do with the globalization plugin.





> 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: Plugin Globalization
>         Environment: iOS
>            Reporter: Suresh Chandrasekharan
>              Labels: ios, triaged
>
> 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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to