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

Migration from 0.4.0 to 1.1.0 fails because of the <span> tag in 1.1.0 #101

Closed
wingedfox opened this issue Sep 3, 2014 · 6 comments
Closed

Comments

@wingedfox
Copy link
Contributor

Hi,

Is there an easy way to migrate from 0.4.0 to 1.1.0?
As long as 1.1.0 starts to add with translated string, it fails in certail scenarios like

  <option translate>default</option>

which ends up with

  <option translate>
    <span class="ng-scope">Default value</span>
  </option>
@rubenv
Copy link
Owner

rubenv commented Sep 3, 2014

Is this causing problems for you?

We're doing exactly that in a project, without issues:

screen shot 2014-09-03 at 11 29 59

@wingedfox
Copy link
Contributor Author

Yes, this causes different problems with migration, mainly with the autotests, but we met the side effects too with the <title> and <textarea>.

For sure, starting right from 1.0 we will consider this as a feature, but now I'll be glad to see a sort of migration guide.

@circlingthesun
Copy link
Contributor

The reason why the translation gets wrapped in a span tag probably has something to do with https://github.com/rubenv/angular-gettext/blob/master/src/directive.js#L49. The translation is wrapped because angular.element() fails when given text. Further down element.contents() should extract the translation from the wrapping and replace the existing translation. For some reason here the translation is still wrapped when swapped in.

@circlingthesun
Copy link
Contributor

It seems $compile wraps root text elements in span's so that it can attach data elements. (angular/angular.js#1059)

@circlingthesun
Copy link
Contributor

Angular 1.6 fixes the span issue. See:
Spans in 1.5.9: http://plnkr.co/edit/tKloB8LFk3GCAsu0UEUx?p=preview
No spans in 1.6.0: http://plnkr.co/edit/tE96QrOPtqxuxR4xbxRL?p=preview

@wingedfox
Copy link
Contributor Author

Great to see this fixed =)

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

No branches or pull requests

3 participants