@zachhandley/ez-i18n 0.3.9 → 0.3.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +12 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -951,6 +951,18 @@ function ezI18n(config) {
951
951
  })();
952
952
  `;
953
953
  injectScript("head-inline", hydrationScript);
954
+ const viewTransitionsScript = `
955
+ import { initLocale, setTranslations } from '@zachhandley/ez-i18n/runtime';
956
+
957
+ document.addEventListener('astro:after-swap', () => {
958
+ const initData = globalThis.__EZ_I18N_INIT__;
959
+ if (initData) {
960
+ initLocale(initData.locale, initData.translations);
961
+ setTranslations(initData.translations);
962
+ }
963
+ });
964
+ `;
965
+ injectScript("page", viewTransitionsScript);
954
966
  },
955
967
  "astro:config:done": ({
956
968
  injectTypes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zachhandley/ez-i18n",
3
- "version": "0.3.9",
3
+ "version": "0.3.10",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },