WIP: feat: add vite-plugin-i18n #2676

Closed
dpschen wants to merge 1 commits from dpschen:feature/vite-plugin-i18n into main
Member

I took a look at https://github.com/intlify/bundle-tools/tree/main/packages/vite-plugin-vue-i18n
The package will shortly be replaced by https://github.com/intlify/bundle-tools/tree/main/packages/unplugin-vue-i18n but as of now the latter doesn't support rollup 3 which we are already using.

image

Looking at the stats I was surprised to find out that per default all messages are loaded and included in the main bundle. I couldn't yet find out how one can split this.

When using the plugin the message compiler isn't included in the final build, which is a good thing! See https://vue-i18n.intlify.dev/guide/advanced/optimization.html#performance

If I undertand it correctly it's possible to split the translations over all vue components. But then all translations are loaded for that component.
Also syncing via Crowdin would be more complex and would need help of: https://github.com/intlify/vue-i18n-locale-message#api
I don't really like that latter tool, seems a bit risky to depend the whole translation process on such a tool. What happens if that doesn't get updated anymore?

EDIT
I also had to delete the nl-NL.json in order for the build to succeed, meaning that the actual bundle should be even larger…

I took a look at https://github.com/intlify/bundle-tools/tree/main/packages/vite-plugin-vue-i18n The package will shortly be replaced by https://github.com/intlify/bundle-tools/tree/main/packages/unplugin-vue-i18n but as of now the latter doesn't support rollup 3 which we are already using. ![image](/attachments/5e503946-a3ec-4e2f-8b54-a9e6ef669d77) Looking at the stats I was surprised to find out that per default _all_ messages are loaded and included in the main bundle. I couldn't yet find out how one can split this. When using the plugin the message compiler isn't included in the final build, which is a good thing! See https://vue-i18n.intlify.dev/guide/advanced/optimization.html#performance If I undertand it correctly it's possible to split the translations over all vue components. But then all translations are loaded for that component. Also syncing via Crowdin would be more complex and would need help of: https://github.com/intlify/vue-i18n-locale-message#api I don't really like that latter tool, seems a bit risky to depend the whole translation process on such a tool. What happens if that doesn't get updated anymore? **EDIT** I also had to delete the `nl-NL.json` in order for the build to succeed, meaning that the actual bundle should be even larger…
494 KiB
dpschen added the
kind/feature
dependencies
area/internal-code
labels 2022-11-11 14:24:32 +00:00
dpschen added 1 commit 2022-11-11 14:24:33 +00:00
continuous-integration/drone/pr Build is failing Details
03e0de5d25
feat: add vite-plugin-i18n
Owner

What's the advantage of using the vite plugin vs what we're currently using?

What's the advantage of using the vite plugin vs what we're currently using?
Author
Member

Precompilation of the messages as static strings.
Meaning:

  • smaller bundle, since there is no need for dynamic message compilation. In total size this is true, but since now all messages get initially loaded this doesn't improve the initial loading.
  • better runtime performance. Since there is no compilation step needed anymore the performance should be better. Didn't measure this though.
Precompilation of the messages as static strings. Meaning: - smaller bundle, since there is no need for dynamic message compilation. In total size this is true, but since now all messages get initially loaded this doesn't improve the initial loading. - better runtime performance. Since there is no compilation step needed anymore the performance should be better. Didn't measure this though.
Author
Member

Seems like the dutch mail was missing escaping the '@' character.

Seems like the dutch mail was missing escaping the '@' character.
dpschen closed this pull request 2022-12-01 12:35:47 +00:00
dpschen deleted branch feature/vite-plugin-i18n 2022-12-01 12:35:54 +00:00
This repo is archived. You cannot comment on pull requests.
No description provided.