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

feat: load translations with webpack #655

Merged
merged 4 commits into from
Jun 7, 2021

Conversation

dhhyi
Copy link
Collaborator

@dhhyi dhhyi commented Apr 17, 2021

PR Type

[x] Feature

What Is the Current Behavior?

ngx-translate translation files are loaded with TranslateHttpLoader on the browser side and a special translate loader on the server side. Due to this handling, the translation files are not automatically output-hashed via Angular CLI. This can lead to misbehavior, when new keys are added but the browser still holds the old translation file in the browser cache.

What Is the New Behavior?

  • Translation files are consistently loaded via webpack and automatically output-hashed
  • The old mechanism of registerLocaleData is exchanged with the new one Doesn't work with FF
  • Translation file and Angular locale data is put into its own bundle and pulled when needed.

Does this PR Introduce a Breaking Change?

[ ] Yes
[x] No

@dhhyi dhhyi self-assigned this Apr 17, 2021
@dhhyi dhhyi added the enhancement Enhancement to an existing feature label Apr 17, 2021
@dhhyi dhhyi force-pushed the feature/translations-output-hashed branch from c0028a7 to 8c725de Compare April 17, 2021 18:35
@dhhyi dhhyi marked this pull request as ready for review April 17, 2021 18:36
@dhhyi dhhyi removed their assignment Apr 17, 2021
@dhhyi dhhyi force-pushed the feature/translations-output-hashed branch from 8c725de to 828dc50 Compare April 17, 2021 18:49
@dhhyi dhhyi force-pushed the feature/translations-output-hashed branch from 828dc50 to 4b07610 Compare April 18, 2021 19:09
@MaxKless MaxKless assigned MaxKless and unassigned MaxKless Apr 28, 2021
@MaxKless MaxKless self-requested a review April 28, 2021 11:41
@MaxKless MaxKless self-assigned this Apr 28, 2021
@MaxKless
Copy link
Collaborator

MaxKless commented Jun 2, 2021

Hi Danilo, thanks for the PR.
We had some issues with this PR but I see you saw some webpack issues yourself and fixed them. As in #661, we built our own loader during the localization rework (#695). We are not generally opposed to this change. If you want to, you can rebase on our latest release and reimplement these changes. If you decide against it you can close this PR and we will track this enhancement ourselves.
Thanks again!

@dhhyi dhhyi force-pushed the feature/translations-output-hashed branch from aab383f to 658afe8 Compare June 3, 2021 11:36
@dhhyi dhhyi force-pushed the feature/translations-output-hashed branch from 658afe8 to ba32a09 Compare June 3, 2021 12:09
@dhhyi
Copy link
Collaborator Author

dhhyi commented Jun 3, 2021

@MaxKless I rebased and put in some refactoring. Please test if everything still works properly.

@shauke shauke added this to the 0.32 milestone Jun 4, 2021
@MaxKless MaxKless merged commit 267395c into develop Jun 7, 2021
@MaxKless MaxKless deleted the feature/translations-output-hashed branch June 7, 2021 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement to an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants