Skip to content

Nodes with children are not translated in IE8 #51

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

Closed
scomma opened this issue Mar 23, 2014 · 2 comments
Closed

Nodes with children are not translated in IE8 #51

scomma opened this issue Mar 23, 2014 · 2 comments

Comments

@scomma
Copy link

scomma commented Mar 23, 2014

Hi, thanks for an excellent library. I'd like to report an issue I found with IE8, tested against the latest stable versions of angular (1.2.15) and angular-gettext.

Normally sometimes you put the translate directive on an element which has child elements, and all of it would be translated in one chunk. For example:

<p translate><b>Note:</b> keep out of reach of children</p>

Both gettext_extract and the localization engine would handle this without a hitch in modern browsers. Under IE8, it refuses to find the correct translation. If debug mode is turn on, a [MISSING] tag is prepended to the output.

So far, I have taken a wild guess and sneaked into the po file and changed the embedded tags to capital form, i.e.

msgid "<B>Note:</B> keep out of reach of children"

and this seems to work in simple phrases but not in complex cases where there are more tags. But more importantly, this breaks the translation that otherwise works in all other browsers, so it's not an acceptable fix.

Do you have an idea of what could have caused the issue, and how hard it would be to workaround?

@maxpeterson
Copy link
Contributor

I think I have encountered the same problem. In IE8 all tags are transformed to upper case. As you pointed out @scomma capitalising the tags will fix the translations for IE8, however this will break other browsers, unless you also change the actual templates to include capitalised tags (which sounds like a bad idea to me).

I have a working fix that uses angular.element to transform the strings keys when they are set in setStrings: key = angular.element('<span>' + key + '</span>').html()

Currently I have this working in an version 1.0.1 as this is the version we are using as the latest version has some other issues in IE8.

I will create a fork with the fix over the weekend or next week.

maxpeterson added a commit to maxpeterson/angular-gettext that referenced this issue Nov 21, 2014
maxpeterson added a commit to maxpeterson/angular-gettext that referenced this issue Nov 21, 2014
Related to rubenv#51

Conflicts:
	dist/angular-gettext.js
	dist/angular-gettext.min.js
maxpeterson added a commit to maxpeterson/angular-gettext that referenced this issue Nov 24, 2014
@rubenv rubenv modified the milestone: 2.0 Dec 8, 2014
@rubenv
Copy link
Owner

rubenv commented Dec 8, 2014

Should work now. Thanks @maxpeterson.

@rubenv rubenv closed this as completed Dec 8, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants