nativescript-localize
nativescript-localize copied to clipboard
Identifiers are changed after export happens
So we store our localization strings in a javascript file, which looks like this:
module.exports = {
"yes": "Yes",
"no": "No",
"type-a-message": "Type a message",
}
In the strings.xml and Localizable.strings however the entries look like this:
Android:
<string name="no">"No"</string>
<string name="yes">"Yes"</string>
<string name="_type_a_message_Z13yvex">"Type a message"</string>
iOS:
"no" = "Nein";
"yes" = "Ja";
"_type_a_message_Z13yvex" = "Nachricht schreiben";
As we use firebase cloud messaging and want to generate localized push notifications with titleLocKey and bodyLocKey (see FCM Documentation for details) it is extremely annoying that "type-a-message" is converted to "_type_a_message_Z13yvex".
Is this a bug? Is this expected behaviour because we use "-" in the identifiers?
It is definitely strange that any identifier would change like this.
I'm experiencing the same thing when using a -
within the key name.
The other plugin nativescript-i18n does not allow using a -
within keys at all, as the build fails on Android saying Error: '-' is not a valid resource name character
.
So I think it is generally a better idea to prevent using '-' within key names