nativescript-localize icon indicating copy to clipboard operation
nativescript-localize copied to clipboard

Comptibility with Nativescript 6.0.1

Open lepokle opened this issue 5 years ago • 3 comments

I've installed nativescript-localized as noted in the installation instructions.

However, localization does not work as expected.

Version information:

✔ Getting NativeScript components versions information...
✔ Component nativescript has 6.0.1 version and is up to date.
✔ Component tns-core-modules has 6.0.1 version and is up to date.
✔ Component tns-android has 6.0.0 version and is up to date.
✔ Component tns-ios has 6.0.1 version and is up to date.

Any help would be appreciated.

lepokle avatar Jul 21 '19 20:07 lepokle

Hi @lepokle Can you elaborate as to how it isn't working as expected?

schnapzz avatar Sep 16 '19 14:09 schnapzz

Hello together, I have the same issue here. Cannot get the plugin working with 6.0.1. The key string to be translated is returned rather than the translated version of it.

In localize.android.ts the returned identifier from getStringId = 0. I added the plugin to app.module.ts and added the i18n folder to app folder. My en.default.json file looks as follows: { "app.name": "My app", "strHello": "Hello World" }

export function localize(key: string, ...args: string[]): string { let localizedString; try { const identifier = utils.ad.resources.getStringId(encodeKey(key)); localizedString = identifier === 0 ? key : getResources().getString(identifier); } catch (error) { localizedString = key; } return vsprintf(localizedString, args); }

Update, if I move the i18n folder from app to src than the strings are detected and the plugin works as expected

cjohn001 avatar Mar 15 '20 20:03 cjohn001

Update, if I move the i18n folder from app to src than the strings are detected and the plugin works as expected

Thank you it's work

@EddyVerbruggen can you update readme please ?

youtpout avatar Apr 29 '20 14:04 youtpout