How to change cordova-camera-plugin language in iOS?

自作多情 提交于 2019-12-18 15:33:38

问题


I wish to change the cordova-camera-plugin language. Apparently it is dependent on a variety of things. My development environment is Tools for Cordova in Visual Studio 2015. It is unlikely that it matters but I am using the Ionic framework in my app. We build our app for iOS on a MacBook Pro laptop running Xcode 7. The device I am testing on is an Ipad running iOS 9.1 with Dutch as first language and english as second.

In my app when you open the camera you have a few options such as Cancel, Use Photo and Retake Photo.

The things I have done to try and make the plugin localized to the Dutch language are the following.

In config.xml I have changed the following line to

<widget xmlns:cdv="http://cordova.apache.org/ns/1.0" 
xmlns:vs="http://schemas.microsoft.com/appx/2014/htmlapps" 
id="hop.test1" 
version="1.0.1" 
xmlns="http://www.w3.org/ns/widgets" 
defaultlocale="nl-NL">

And in my /platforms/ios/projectname/projectname-Info.plist I have added the following lines:

<plist version="1.0">
  <dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>nl</string>
    <key>CFBundleLocalizations</key>
    <array>
      <string>nl</string>
    </array>
  <!-- other values omitted !-->
  </dict>
</plist>

nl appears to be the correct localization notation for dutch based on my search results around google and stackoverflow.

The problem is that when I build my app and test the camera, the camera buttons are still written in english. Have I implemented something wrong, am I missing some values somewhere or is this the wrong way to go about localizing a plugin in cordova?


回答1:


Just make the settings in Xcode. They will not be overwritten after you make another cordova build:

UPDATE:

If you don't have the entry «Localization native development region», then:

– Go to info -> select your target

– Right click on an existing key entry and choose Add Row

– Type «Localization …», when Xcode autocompletes your input, then select under value your language.




回答2:


If you go to the cordova-plugin-camera .plist file and comment out:

<!-- <key>CFBundleDevelopmentRegion</key>
<string>nl</string> -->

Then the plugin will use the systems set language. This is likely the most practical solution.



来源:https://stackoverflow.com/questions/34286524/how-to-change-cordova-camera-plugin-language-in-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!