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

Optimize localization #417

Merged
merged 8 commits into from
May 3, 2024
Merged

Optimize localization #417

merged 8 commits into from
May 3, 2024

Conversation

CGNonofr
Copy link
Contributor

@CGNonofr CGNonofr commented Apr 30, 2024

Apply the same optimization than VScode in vscode.dev, which replaces string translation keys by their indexes within the module

in the localization file:

{
  "vs/common/random/module": {
    "some.random.translation.key": "The actual wording",
    "some.other.translation.key": "The other wording"
  }
}

is replaced by

{
  "vs/common/random/module": [
    "The actual wording",
    "The other wording"
  ]
}

and in the modules:

localizeWithPath(moduleId,  "some.random.translation.key", "The default wording")

is replaced by

localizeWithPath(moduleId,  0,  "The default wording")

This PR:

  • reduce the size of the main package alone by about 400ko (not counting the service override packages)
  • reduce each localization package by about 300ko

Note that the localization keys can't be minified and neither be compressed very well (each key is different) so the final compressed size ratio should be even bigger

@CGNonofr CGNonofr requested review from CompuIves and kaisalmen April 30, 2024 13:21
@CGNonofr CGNonofr self-assigned this Apr 30, 2024
@CGNonofr CGNonofr force-pushed the optimize-localization branch from b7fc924 to 35b66ee Compare April 30, 2024 15:55
Copy link
Collaborator

@kaisalmen kaisalmen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. Tested locally. Have not seen anything obvious. Changing languages works nicely. I did not perform an in-depth review of the code. Will test the new release as usual.

@CGNonofr CGNonofr merged commit 656c48c into main May 3, 2024
2 checks passed
@CGNonofr CGNonofr deleted the optimize-localization branch May 3, 2024 06:27
Copy link

github-actions bot commented May 3, 2024

🎉 This PR is included in version 4.5.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@CGNonofr CGNonofr mentioned this pull request May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants