kelvinhokk / cordova-plugin-localization-strings

Cordova Plugin for Localization of Strings on the App
MIT License
119 stars 106 forks source link

Be able to specify different keys for iOS and Android #37

Closed JanMisker closed 4 years ago

JanMisker commented 5 years ago

It would be great to be able to specify different keys for iOS and Android, in the "app" section of the json, not just in the config.

Reason for this is that iOS makes it very easy to not use proper keys, but just the entire string as key-to-be-localized, for example in phonegap-plugin-barcodescanner, they just use NSLocalizedString around a full sentence in English. https://github.com/phonegap/phonegap-plugin-barcodescanner/issues/732#issuecomment-433970310

I can get that to work in iOS with this plugin, but now my Android strings.xml files contain invalid characters.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<resources>
    <string name="Access to the camera has been prohibited; please enable it in the Settings app to continue.">Er is geen toestemming om de camera te gebruiken; geef deze toestemming in de Instellingen app om door te gaan.</string>
</resources>
dsanchez1988 commented 5 years ago

I'm having the same issue with the cordova-camera-plugin and the same string, when building on Android it throws this error: xml: Error: ' ' is not a valid resource name character

JanMisker commented 5 years ago

I created a pull request with a (hacky?) fix.