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

Differentiation between undefined and blank translations #42

Closed
blackmjck opened this issue Aug 27, 2019 · 2 comments · Fixed by #43
Closed

Differentiation between undefined and blank translations #42

blackmjck opened this issue Aug 27, 2019 · 2 comments · Fixed by #43
Labels
enhancement New feature or request

Comments

@blackmjck
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

Blank translation strings (e.g. LANGUAGE.KEY: '') in a translation file result in a Missing translation for 'LANGUAGE.KEY' 🤔🕵🏻‍♀ console warning and a returned LANGUAGE.KEY value.

Expected behavior

It would be nice if the missing handler differentiated between missing values (where the key and/or value is undefined) and blank values (where the value is provided as a blank string).

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

It's a bit of an edge case, but we've been using it for years with ngx-translate to test for missing translation strings in non-English files.

If nothing shows up on screen for a given non-English run, then we know we're just waiting for the i18n team to finish making translations for that language. If APP.KEY shows up onscreen, then the dev team missed adding the key/string to the language file in question.

It's non-critical, but would be a nice to have as part of the migration path.

@blackmjck blackmjck changed the title Differentiation between undefined and missing translations Differentiation between undefined and blank translations Aug 27, 2019
NetanelBasal pushed a commit that referenced this issue Aug 27, 2019
add option to allow empty keys

Closes: #42
@NetanelBasal NetanelBasal added the enhancement New feature or request label Aug 27, 2019
@NetanelBasal
Copy link
Contributor

#43

@NetanelBasal
Copy link
Contributor

NetanelBasal commented Aug 28, 2019

You can use it with the latest version:

{
  provide: TRANSLOCO_CONFIG,
   useValue: {
	 ....
     allowEmpty: true
   }
  }
}

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

Successfully merging a pull request may close this issue.

2 participants