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

ng serve should watch i18n messages files #16341

Closed
cexbrayat opened this issue Dec 3, 2019 · 8 comments · Fixed by #19888
Closed

ng serve should watch i18n messages files #16341

cexbrayat opened this issue Dec 3, 2019 · 8 comments · Fixed by #19888

Comments

@cexbrayat
Copy link
Member

🚀 Feature request

Command (mark with an x)

- [ ] new
- [ ] build
- [x] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Description

When using the new i18n support with CLI v9 (rc.4 at the time of writing), it is possible to run:

ng serve --configuration=fr

with fr:

"i18n": {
  "locales": {
    "fr": "src/locale/messages.fr.xlf"
  }
},
"fr": {
  "localize": ["fr"]
}

This works great, but does not pick up translation changes in messages.fr.xlf, requiring a stop and restart of ng serve.

Describe the solution you'd like

It would be nice to have ng serve watch the files defined in the locales configuration.

Describe alternatives you've considered

It is possible to stop and restart the server to have the up-to-date translations.

@clydin clydin added area: @angular-devkit/build-angular feature Issue that requests a new feature labels Dec 3, 2019
@ngbot ngbot bot added this to the Backlog milestone Dec 3, 2019
@fetis
Copy link

fetis commented Aug 18, 2020

it's still an issue with v10 :(

I would also re-qualify it from feature to bug/regression because it worked fine in v8

@alan-agius4 alan-agius4 changed the title ng serve should watch messages files ng serve should watch i18n messages files Aug 18, 2020
clydin added a commit to clydin/angular-cli that referenced this issue Jan 27, 2021
…h dev server

When using i18n with the dev server, the translation files will now be linked as a dependency to any file containing translated text. This allows translation files to be watched and the application to be rebuilt using the changed translation files.
This change should also provide some performance improvements as well since now only files containing `$localize` will be parsed and processed by the babel-based localization inliner.

Closes angular#16341
clydin added a commit to clydin/angular-cli that referenced this issue Jan 29, 2021
…h dev server

When using i18n with the dev server, the translation files will now be linked as a dependency to any file containing translated text. This allows translation files to be watched and the application to be rebuilt using the changed translation files.
This change should also provide some performance improvements as well since now only files containing `$localize` will be parsed and processed by the babel-based localization inliner.

Closes angular#16341
clydin added a commit to clydin/angular-cli that referenced this issue Jan 30, 2021
…h dev server

When using i18n with the dev server, the translation files will now be linked as a dependency to any file containing translated text. This allows translation files to be watched and the application to be rebuilt using the changed translation files.
This change should also provide some performance improvements as well since now only files containing `$localize` will be parsed and processed by the babel-based localization inliner.

Closes angular#16341
clydin added a commit to clydin/angular-cli that referenced this issue Mar 1, 2021
…h dev server

When using i18n with the dev server, the translation files will now be linked as a dependency to any file containing translated text. This allows translation files to be watched and the application to be rebuilt using the changed translation files.
This change should also provide some performance improvements as well since now only files containing `$localize` will be parsed and processed by the babel-based localization inliner.

Closes angular#16341
clydin added a commit to clydin/angular-cli that referenced this issue Mar 2, 2021
…h dev server

When using i18n with the dev server, the translation files will now be linked as a dependency to any file containing translated text. This allows translation files to be watched and the application to be rebuilt using the changed translation files.
This change should also provide some performance improvements as well since now only files containing `$localize` will be parsed and processed by the babel-based localization inliner.

Closes angular#16341
@montogeek
Copy link

I have to restart my dev server when changing anything in the .xlf files to see the change reflected in the server. Is this issue related?

@dev054
Copy link

dev054 commented Sep 21, 2021

@clydin sorry to bother you, but I just saw that you have a PR that address this issue... so allow me to kindly ask: is there a plan to merge this before v13 comes out? If not, does anyone know if there's any workaround available? Currently is too tedious to restart server to see the changes in the file.

Thanks.

@clydin
Copy link
Member

clydin commented Oct 6, 2021

Unfortunately, the referenced PR is not complete and will not be available in 13.0 but should be available in an upcoming v13 minor release.

clydin added a commit to clydin/angular-cli that referenced this issue Nov 23, 2021
…h dev server

When using i18n with the dev server, the translation files will now be linked as a dependency to any file containing translated text. This allows translation files to be watched and the application to be rebuilt using the changed translation files.
This change should also provide some performance improvements as well since now only files containing `$localize` will be parsed and processed by the babel-based localization inliner.

Closes angular#16341
clydin added a commit to clydin/angular-cli that referenced this issue Nov 23, 2021
…h dev server

When using i18n with the dev server, the translation files will now be linked as a dependency to any file containing translated text. This allows translation files to be watched and the application to be rebuilt using the changed translation files.
This change should also provide some performance improvements as well since now only files containing `$localize` will be parsed and processed by the babel-based localization inliner.

Closes angular#16341
clydin added a commit to clydin/angular-cli that referenced this issue Nov 24, 2021
…h dev server

When using i18n with the dev server, the translation files will now be linked as a dependency to any file containing translated text. This allows translation files to be watched and the application to be rebuilt using the changed translation files.
This change should also provide some performance improvements as well since now only files containing `$localize` will be parsed and processed by the babel-based localization inliner.

Closes angular#16341
clydin added a commit to clydin/angular-cli that referenced this issue Nov 24, 2021
…h dev server

When using i18n with the dev server, the translation files will now be linked as a dependency to any file containing translated text. This allows translation files to be watched and the application to be rebuilt using the changed translation files.
This change should also provide some performance improvements as well since now only files containing `$localize` will be parsed and processed by the babel-based localization inliner.

Closes angular#16341
clydin added a commit to clydin/angular-cli that referenced this issue Nov 24, 2021
…h dev server

When using i18n with the dev server, the translation files will now be linked as a dependency to any file containing translated text. This allows translation files to be watched and the application to be rebuilt using the changed translation files.
This change should also provide some performance improvements as well since now only files containing `$localize` will be parsed and processed by the babel-based localization inliner.

Closes angular#16341
clydin added a commit to clydin/angular-cli that referenced this issue Nov 25, 2021
…h dev server

When using i18n with the dev server, the translation files will now be linked as a dependency to any file containing translated text. This allows translation files to be watched and the application to be rebuilt using the changed translation files.

Closes angular#16341
dgp1130 pushed a commit that referenced this issue Nov 29, 2021
…h dev server

When using i18n with the dev server, the translation files will now be linked as a dependency to any file containing translated text. This allows translation files to be watched and the application to be rebuilt using the changed translation files.

Closes #16341
@bbarry
Copy link
Contributor

bbarry commented Dec 15, 2021

Is anyone else having an issue with this change now giving a warning every time you save a file that every message in your translation file is a duplicate?


WARNING [src/locale/messages.fr.xlf]: Duplicate translations for message 'bd56617283412e79a0b08b6cf2a9409c548ac187' when merging

WARNING [src/locale/messages.fr.xlf]: Duplicate translations for message 'ngb.alert.close' when merging

WARNING [src/locale/messages.fr.xlf]: Duplicate translations for message 'ngb.carousel.next' when merging

WARNING [src/locale/messages.fr.xlf]: Duplicate translations for message 'ngb.carousel.previous' when merging

WARNING [src/locale/messages.fr.xlf]: Duplicate translations for message 'ngb.carousel.slide-number' when merging

WARNING [src/locale/messages.fr.xlf]: Duplicate translations for message 'ngb.datepicker.next-month' when merging

WARNING [src/locale/messages.fr.xlf]: Duplicate translations for message 'ngb.datepicker.previous-month' when merging

every time I save a file while running ng serve now I get a few hundred of these if I have translations in use.

@dgp1130
Copy link
Collaborator

dgp1130 commented Dec 15, 2021

@bbarry, I think #22209 should add an option to suppress these warnings, though they typically do point to a real issue, so it might be worth investigating why there are duplicate translations.

@bbarry
Copy link
Contributor

bbarry commented Dec 16, 2021

Yes I don't like the idea of suppressing the warning; my concern isn't seeing the warnings, it is that they only appear after a watched file rebuilds.

I am not getting the warnings on the initial builds. It seems like the variable isn't being properly re-initialized.

@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 Jan 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants