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

Language change does not work if this package is used #2

Open
derwaldgeist opened this issue Jan 25, 2016 · 4 comments
Open

Language change does not work if this package is used #2

derwaldgeist opened this issue Jan 25, 2016 · 4 comments

Comments

@derwaldgeist
Copy link

I was glad that this package was there, since I would like to support my Cordova app with offline language files. Setup was easy, and the i18n files are generated as expected. They are located in the /public/i18n folder, and they contain the right keys.

However, my application always shows up in English. Switching the language using TAPi18n.setLanguage() does not seem to work anymore. I can see in the browser's networking console that the language files are retrieved from the server, but then nothing happens.

The fail() callback says:

Couldn't load language 'de' JSON: parsererror

I ran a JSON linter on it, and it reported the JSON as being clean.

The language dropdown provided by tap:i18n also does not have any effect.

What may cause this?

I kept the project-tap.i18n file lean, it just contains the cdn_path required for this package.

{
  "cdn_path" : "i18n"
}
@derwaldgeist
Copy link
Author

I found out what the problem was. In the project-tap.i18n file, it should read:

{
  "cdn_path" : "/i18n"
}

The package always tried to get the language files relative to the current URL. I recommend to update the docs.

@JesperWe
Copy link

JesperWe commented Mar 1, 2016

I would maybe suggest to improve the error message when there are issues in the project-tap.i18n file.
I came across this today too, and just having .setLanguage() silently fail is not very helpful.

@IstoraMandiri
Copy link
Contributor

Thanks for the suggestion @JesperWe; this is a http://github.com/tapevents/tap-i18n (main repo) issue. Would certainly be useful to have better error messages.

Can you confirm whether or not it's working now? If so, I'll close the issue.

@JesperWe
Copy link

JesperWe commented Mar 3, 2016

Sure, it works if you get the cdn_path settings right. But if you don't it just silently fails without any message.

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

3 participants