aurelia / i18n

A plugin that provides i18n support.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot use namespaces when using the `$t(key)` markup in the `t` custom attribute

pmanu93 opened this issue · comments

I'm submitting a bug report

  • Library Version:
    2.1.2

Please tell us about your environment:

  • Operating System:
    Linux Mint 17.3 Rosa

  • Node Version:
    v8.10.0

  • NPM Version:
    5.8.0
  • Browser:
    all

  • Language:
    all

Current behavior:
When using the attribute with combined translations, I can't use namespace because it breaks the translation.
Example:

 <h4 t="$t(global.open) $t(app:activities)"></h4>

renders as

activities)

but

 <h4 t="$t(global.open) $t(global.open)"></h4>

renders as

Abrir Abrir

If I use t="app:activities" it works fine, so the problem must be related to the $t(key) markup

Expected/desired behavior:

  • What is the expected behavior?
    The template with
 <h4 t="$t(global.open) $t(app:activities)"></h4>

should render as

 Abrir atividades

I'm not sure we can really do a lot about that. Nevertheless this example seems like to be anyway better solved with two BindingBehaviors

<h4>${'global.open' & t) ${'app:activities' & t}</h4>

That's what I ended up doing ... however I thought I should inform you, because in the i18next documentation it shows that this should be possible :)

I will look into this more closely