Rebuilding translations in nativescript-localize

plugins

#1

I was having a weird problem with nativescript-localize, where only some text entries in a page were getting localized to a different language, while the other remain in English despite having entries in the language.json file. On one page, it also completely blanked out the text (instead of at least having something there. It was funny :stuck_out_tongue: )

Optimally, all text entries would translate to the other language, and anything that didn’t have an entry in the translation file would be used as-is.

I tried rebuilding, and deleting the node_modules and platforms before rebuilding: neither worked.

What eventually worked was rebuilding the app after also deleting the values-en and values-“your language here” folders in app/App_Resources/Android for Android; and deleting the en.lproj, and “your-language-here”.lproj files in the app/App_Resources/iOS folder for iOS.

I think the plugin doesn’t always re-create the strings.xml file, OR the app/plugin caches the older files somewhere so changes to the translations file doesn’t happen or something like that. Deleting the older version forced the pre-build hook of nativescript-localize to make new strings.xml files, which got it to work as expected!

Hope this helps someone in the future!

Tech specs:
Nativescript android/iOS v3.2.0
nativescript-localize v2.0.5


#2

Hey @ksbhat
Thanks for sharing this. Cheers!