rubenv/angular-gettext

Interpolation Issue with static HTML string when switching languages

xamino opened this issue · 0 comments

Consider the following:

<span translate
    translate-params-email="'<a href=\'email@example.com\'>email@example.com</a>'"
    translate-params-url="'<a href=\'http://example.com\' target=\'_blank\'>example.com</a>'">
Some text which refers to the clickable email address {{email}} and also points to the url {{url}}.
</span>

This works for the initial page load, meaning the interpolation will correctly insert the email and url links. However if I then switch the language to German, the German text is shown without the interpolation. Instead the variables are simply missing (they don't show at the locations where the variables are placed in the translation).

I tried using an unsafe filter since that may be related, but it starts an endless iteration loop (since it changes the string) and thus doesn't work either. It does not seem to an issue with the way I specify the string (Using HTML escaping for the quotes etc) either.

Please let me know if I'm doing something wrong or if this may be an issue in search of a fix.

I believe this pull request and this issue may be related since they implemented this feature.

EDIT: Just checked to make sure: this doesn't work even with just a normal string given, so it does not seem to be an issue related to safe / unsafe HTML insertion (replacing string with 'email@example.com' still won't show up when switching languages).