Skip to content

feat(i18n): initial $localize functionality #31609

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

Conversation

petebacondarwin
Copy link
Contributor

@petebacondarwin petebacondarwin commented Jul 17, 2019

Blocked on #31943

TODOs

For this PR:

  • fix AOT tests to provide a runtime implementation of $localize
  • fix material legacy tests to update with @angular/localize etc (perhaps via a migration?)
  • fix integration tests to update with @angular/localize etc (perhaps via a migration?)

For next PR?

  • write the update migration schematic
  • write the new project schematic
  • write compile-time inliner (Babel plugin/standalone tool)

@petebacondarwin petebacondarwin force-pushed the i18n-localize-init branch 2 times, most recently from fa4213d to 84eff89 Compare July 17, 2019 16:07
@mhevery mhevery added the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Jul 17, 2019
@googlebot
Copy link

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only "I consent." in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@matsko matsko added the area: i18n Issues related to localization and internationalization label Jul 17, 2019
@ngbot ngbot bot added this to the needsTriage milestone Jul 17, 2019
@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@googlebot googlebot removed the cla: no label Jul 18, 2019
@googlebot
Copy link

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only "I consent." in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@petebacondarwin petebacondarwin marked this pull request as ready for review July 18, 2019 20:25
@petebacondarwin petebacondarwin requested review from IgorMinar and a team as code owners July 18, 2019 20:25
@petebacondarwin petebacondarwin force-pushed the i18n-localize-init branch 2 times, most recently from 0b49661 to 416d8b6 Compare July 18, 2019 21:06
@petebacondarwin petebacondarwin added action: review The PR is still awaiting reviews from at least one requested reviewer and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews state: WIP labels Jul 18, 2019
@mhevery
Copy link
Contributor

mhevery commented Aug 30, 2019

GLOBAL APPROVAL: misko

@mhevery mhevery closed this in b34bdf5 Aug 30, 2019
mhevery pushed a commit that referenced this pull request Aug 30, 2019
mhevery pushed a commit that referenced this pull request Aug 30, 2019
This commit changes the Angular compiler (ivy-only) to generate `$localize`
tagged strings for component templates that use `i18n` attributes.

BREAKING CHANGE

Since `$localize` is a global function, it must be included in any applications
that use i18n. This is achieved by importing the `@angular/localize` package
into an appropriate bundle, where it will be executed before the renderer
needs to call `$localize`. For CLI based projects, this is best done in
the `polyfills.ts` file.

```ts
import '@angular/localize';
```

For non-CLI applications this could be added as a script to the index.html
file or another suitable script file.

PR Close #31609
mhevery pushed a commit that referenced this pull request Aug 30, 2019
This has been replaced by the `$localize` tag.

PR Close #31609
mhevery pushed a commit that referenced this pull request Aug 30, 2019
This has been replaced by the `loadTranslations()` function in
`@angular/localize/run_time`.

PR Close #31609
mhevery pushed a commit that referenced this pull request Aug 30, 2019
mhevery pushed a commit that referenced this pull request Aug 30, 2019
This test uses localization in the `AppComponent` component:

* an `i18n` attribute in the template
* a call to the `$localize` tag in the component constructor

PR Close #31609
@petebacondarwin petebacondarwin deleted the i18n-localize-init branch August 30, 2019 20:19
@mhevery
Copy link
Contributor

mhevery commented Sep 3, 2019

This needs to be reverted as it breaks g3.

/checkbox_logo.closure.js:47: ERROR - [JSC_UNDEFINED_VARIABLE] variable $localize is undeclared
    I18N_6 = $localize `User portrait`;
             ^^^^^^^^^

sabeersulaiman pushed a commit to sabeersulaiman/angular that referenced this pull request Sep 6, 2019
sabeersulaiman pushed a commit to sabeersulaiman/angular that referenced this pull request Sep 6, 2019
sabeersulaiman pushed a commit to sabeersulaiman/angular that referenced this pull request Sep 6, 2019
…31609)

This commit changes the Angular compiler (ivy-only) to generate `$localize`
tagged strings for component templates that use `i18n` attributes.

BREAKING CHANGE

Since `$localize` is a global function, it must be included in any applications
that use i18n. This is achieved by importing the `@angular/localize` package
into an appropriate bundle, where it will be executed before the renderer
needs to call `$localize`. For CLI based projects, this is best done in
the `polyfills.ts` file.

```ts
import '@angular/localize';
```

For non-CLI applications this could be added as a script to the index.html
file or another suitable script file.

PR Close angular#31609
sabeersulaiman pushed a commit to sabeersulaiman/angular that referenced this pull request Sep 6, 2019
This has been replaced by the `$localize` tag.

PR Close angular#31609
sabeersulaiman pushed a commit to sabeersulaiman/angular that referenced this pull request Sep 6, 2019
)

This has been replaced by the `loadTranslations()` function in
`@angular/localize/run_time`.

PR Close angular#31609
sabeersulaiman pushed a commit to sabeersulaiman/angular that referenced this pull request Sep 6, 2019
sabeersulaiman pushed a commit to sabeersulaiman/angular that referenced this pull request Sep 6, 2019
This test uses localization in the `AppComponent` component:

* an `i18n` attribute in the template
* a call to the `$localize` tag in the component constructor

PR Close angular#31609
sabeersulaiman pushed a commit to sabeersulaiman/angular that referenced this pull request Sep 6, 2019
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Oct 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker area: i18n Issues related to localization and internationalization cla: yes target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants