Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comptibility with Nativescript 6.0.1 #81

Open
lepokle opened this issue Jul 21, 2019 · 3 comments
Open

Comptibility with Nativescript 6.0.1 #81

lepokle opened this issue Jul 21, 2019 · 3 comments

Comments

@lepokle
Copy link

lepokle commented Jul 21, 2019

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.

@schnapzz
Copy link

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

@cjohn001
Copy link

cjohn001 commented Mar 15, 2020

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

@youtpout
Copy link

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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants