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

Remove i18n tags from compiled angular templates #11042

Closed
StephenFluin opened this Issue Aug 24, 2016 · 6 comments

Comments

Projects
7 participants
@StephenFluin
Copy link
Member

StephenFluin commented Aug 24, 2016

I'm submitting a feature request

Currently when I build an Angular application with internationalization, I add i18n attributes to many of my tags. After compilation, it would be nice for these tags to be removed and not included in the rendered site.

@StephenFluin

This comment has been minimized.

Copy link
Member

StephenFluin commented Aug 24, 2016

To clarify, this only happens when running ngc without an i18nFile or locale. Without those files, it leaves the attributes on all of my HTML tags.

@marclaval

This comment has been minimized.

Copy link
Member

marclaval commented Feb 16, 2017

It means that the i18n and i18n-* attributes would become reserved keywords, i.e. they would be removed during compilation even if the user is not using the built-in i18n feature, or if he is using them for something else.
Are we sure that this is what we want?

@ocombe

This comment has been minimized.

Copy link
Contributor

ocombe commented Mar 13, 2017

I don't think that's a good idea, those attributes can be used as css selectors, or for custom directives. Is there really a problem in keeping them? Angular adds custom attributes all the time (just look at the dom)

@zbitname

This comment has been minimized.

Copy link

zbitname commented Apr 9, 2017

I think any css styles don't need to use selector i18n-*. I think using i18n-* selector for css is bad.

@ocombe ocombe self-assigned this Jul 5, 2017

ocombe added a commit to ocombe/angular that referenced this issue Jul 6, 2017

ocombe added a commit to ocombe/angular that referenced this issue Jul 6, 2017

ocombe added a commit to ocombe/angular that referenced this issue Jul 6, 2017

ocombe added a commit to ocombe/angular that referenced this issue Jul 6, 2017

ocombe added a commit to ocombe/angular that referenced this issue Jul 6, 2017

ocombe added a commit to ocombe/angular that referenced this issue Jul 6, 2017

ocombe added a commit to ocombe/angular that referenced this issue Jul 6, 2017

fix(compiler): remove i18n markup even if no translations
BREAKING CHANGE: If you were relying on the same attributes used by angular, without using angular i18n, then those won't be available anymore, which means that it will break your application.
For example if you wrote a directive that uses `[i18n]` as a selector, it won't work anymore, because even if you don't use angular i18n, those attributes will be removed from your templates.

Fixes angular#11042

ocombe added a commit to ocombe/angular that referenced this issue Jul 6, 2017

ocombe added a commit to ocombe/angular that referenced this issue Jul 6, 2017

ocombe added a commit to ocombe/angular that referenced this issue Jul 7, 2017

ocombe added a commit to ocombe/angular that referenced this issue Jul 7, 2017

ocombe added a commit to ocombe/angular that referenced this issue Jul 7, 2017

ocombe added a commit to ocombe/angular that referenced this issue Jul 7, 2017

vicb added a commit to vicb/angular that referenced this issue Jul 7, 2017

jasonaden added a commit that referenced this issue Jul 7, 2017

@jcimoch

This comment has been minimized.

Copy link

jcimoch commented Sep 20, 2017

@jasonaden I think it shouldn't be classified as a bug. This "fix" assumes that nothing is using those attributes which might not be true. My project had custom dynamic translations solution which was relaying on those attributes in runtime, when they are not available it can't work without some stupid workarounds. I think you should provide compiler flag which by default is set to true and i18n attributes are deleted, but when set to false they will remain in produced build.

@camueller

This comment has been minimized.

Copy link

camueller commented Oct 31, 2017

I fully agree with @jcimoch : Having the attribute at runtime allows to use a different style for translated elements (e.g. a green border). This is useful to identify elements not yet translated.
A compiler switch would be sufficient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment