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

Backend missing files prevents angular app from starting, when fallback should be applied #9

Closed
Merwer opened this issue Nov 30, 2017 · 5 comments

Comments

@Merwer
Copy link

Merwer commented Nov 30, 2017

As per the issue listed at i18next/i18next-xhr-backend#261, if a file is missing, the i18next-xhr-backend issues an error message to the callback indicating the missing files.

The system would normally continue with a graceful fallback, but due to the handling by I18NextService in init the app initialization is rejected.

(err: any) => {
if (err) {
console.error(err);
reject(err);
} else {

When using this project in the app initialization as defined in the cookbook section of the README (https://github.com/Romanchuk/angular-i18next#initialize-i18next-before-angular-application), the reject prevents the angular app from initializing, and only a blank screen is presented.

@Romanchuk
Copy link
Owner

Thank you for info.
The issue is about fallback to generic culture (en) if there is no specific culture translation file loaded (en-US). Fix me if i am missunerstood you.
I'm going to dive into problem in a next week.

Temporary fix for this case is to wrap init promise in a new promise and resolve both positive and negative results.

@Romanchuk
Copy link
Owner

@Merwer i've reproduced an issue. Library should behave as i18next framework.
In the upcomming version (3.0) i'm going to change this behavior to be the same as native and set it by default.
Current strict error handling would be also available to be set with a parameter.

@Merwer
Copy link
Author

Merwer commented Dec 5, 2017

@Romanchuk Thanks for the quick response. I'm glad you were able to reproduce the issue, and I think your proposed solution would work out perfectly.

@Romanchuk
Copy link
Owner

Romanchuk commented Dec 6, 2017

@Merwer
version 3.0.0-alpha.2 with a new feature ErrorHandlingStrategy now available.
https://github.com/Romanchuk/angular-i18next#other-breaking-changes
npm install angular-i18next@3.0.0-alpha.2

Demo app repository updated to use latest angular-i18next version

@Romanchuk
Copy link
Owner

angular-i18next v3.0.0 released

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

2 participants