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

Use of useFallbackTranslation makes sure no error is reported when an error in the language file #290

Closed
jospotargent opened this issue May 28, 2020 · 1 comment
Labels
enhancement New feature or request PRs welcome

Comments

@jospotargent
Copy link

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ X] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:

Current behavior

When there is an error in the language file and/or it can't be read via http, the useFallbackTranslation value is the language with the file in error, you don't get any error or warning, but the translations fails (showing unpredictable results in html). Dropping the useFallbackTranslation item gives an error because there is not fallback language for the language in error.

Expected behavior

At the minimum, whenever a file can't be read a logging line should be written in the console (warning or error), so that the developer can focus on it.
Whenever there is a problem with a language file and it is also the fall back language, the error should not be "erased" when it's the same language as the language in error.

Minimal reproduction of the problem with instructions

  1. take the language file of your fallback translation language and make the json invalid (for example by adding a comma where it should not appear. Then the error appears.
  2. Drop the fallback language option and you see the error exception in the console.

For bug reports please provide the STEPS TO REPRODUCE and if possible a MINIMAL DEMO of the problem, for that you could use our stackblitz example

What is the motivation / use case for changing the behavior?

Environment


Angular version: 8 (@angular/core 8.2.14) 

"@ngneat/transloco": "^2.17.1",

Browser:
- [ X] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
 
For Tooling issues:
- Node version: v13.3.0
- Platform:  Windows 

Others:

@itayod
Copy link
Contributor

itayod commented May 31, 2020

@jospotargent would you like to open a PR for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request PRs welcome
Projects
None yet
Development

No branches or pull requests

3 participants