Core: Treat empty string as valid translations (at least conditionally)

Created on 8 Sep 2016  路  2Comments  路  Source: ngx-translate/core

I'm submitting a ...

[x] bug report

Current behavior
If translation yields empty string, the translation is considered missing.

Expected/desired behavior
Empty strings, should either be considered valid translations always, or with a conditional switch, like

translateService.tolerateEmptyStrings();

Reproduction of the problem
See this plunker

What is the motivation / use case for changing the behavior?
Use case is pretty much described in #223 . When localizing links, this is essential.

* Comments *
One could add a space there:

{
  "SOME_KEY": " "
}

but this is error-prone as such kinda redundant whitespace can be lost when localization team does its job.

Please tell us about your environment:

  • ng2-translate version: 2.4.3
  • Angular version: 2.0.0-rc.6
  • Browser: all
  • Language: all
low TODO bug

Most helpful comment

would you be willing to accept a PR that adds the suggested conditional switch?
I'd rather have empty values displayed with something like "[MISSING]: KEY" then just empty strings. At least this is the way I'm used to it with the old angular-gettext
@ocombe

All 2 comments

You're right, empty string shouldn't be an error ! Sorry about that, I think it's a regression

would you be willing to accept a PR that adds the suggested conditional switch?
I'd rather have empty values displayed with something like "[MISSING]: KEY" then just empty strings. At least this is the way I'm used to it with the old angular-gettext
@ocombe

Was this page helpful?
0 / 5 - 0 ratings

Related issues

briancullinan picture briancullinan  路  3Comments

crebuh picture crebuh  路  3Comments

egornoveo picture egornoveo  路  4Comments

pndewit picture pndewit  路  3Comments

guysan picture guysan  路  4Comments