EddyVerbruggen / nativescript-localize

Internationalization plugin for NativeScript using native capabilities of each platform
MIT License
79 stars 31 forks source link

Question/Enhancement: Don't overwrite strings.xml on android #66

Open bradmartin opened 5 years ago

bradmartin commented 5 years ago

Just digging into this plugin. Setup in a project which already had some custom strings in strings.xml for Android. Currently the plugin recreated the strings.xml based on the i18n asset files the plugin uses.

So first the question: is this intended currently or possibly a bug? If not, then I'd like to suggest the enhancement of not overwriting but look into possibly appending the i18n strings to any values currently in the strings.xml file to avoid causing build issues for people who add the plugin after they already have strings.xml created.

It might be more work than it's worth to implement a solution, in that case, maybe it's sufficient to have some warning about the overwriting. Then it overwrites and people can go back and add their current strings to the generated strings.xml with their i18n string values.

Thoughts?

bradmartin commented 5 years ago

Ah okay so my initial suggestion wouldn't work because the current hook implementation will overwrite the strings.xml even with modifying after a failed build (where the hook was ran successfully).

abhayastudios commented 5 years ago

@bradmartin hey man I had the same issue for which I opened issue #60 initially for iOS but true for Android as well. I ended up using a custom hook that I use for multiple environments (dev vs prod) to copy the relevant original strings.xml and Info.plist to the right places. This way the original files stay untouched.

TwistedTamarin commented 4 years ago

Hi. I have added a fix for android. in this #88