nuxt-i18n-micro 1.1.6 → 1.1.8
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.
- package/README.md +1 -1
- package/dist/client/200.html +1 -1
- package/dist/client/404.html +1 -1
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/7d3d3cf9-6064-4ba3-a2ec-347447f8edd0.json +1 -0
- package/dist/client/index.html +1 -1
- package/dist/module.json +1 -1
- package/dist/runtime/01.plugin.d.ts +2 -2
- package/dist/runtime/01.plugin.js +9 -1
- package/dist/runtime/composables/useI18n.d.ts +1 -1
- package/package.json +2 -2
- package/dist/client/_nuxt/builds/meta/dae24a88-5573-405d-9c95-67ec6422e7cd.json +0 -1
package/README.md
CHANGED
|
@@ -160,7 +160,7 @@ Switches to the given locale and redirects the user to the appropriate localized
|
|
|
160
160
|
$switchLocale('fr')
|
|
161
161
|
```
|
|
162
162
|
|
|
163
|
-
### `$localeRoute(to: RouteLocationRaw): RouteLocationRaw`
|
|
163
|
+
### `$localeRoute(to: RouteLocationRaw, locale?: string): RouteLocationRaw`
|
|
164
164
|
Generates a localized route object based on the target route.
|
|
165
165
|
|
|
166
166
|
```typescript
|
package/dist/client/200.html
CHANGED
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
<link rel="prefetch" as="style" href="/__nuxt-i18n-micro/_nuxt/error-500.B4KzowuE.css">
|
|
9
9
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/HZLiFEh-.js">
|
|
10
10
|
<script type="module" src="/__nuxt-i18n-micro/_nuxt/6EJ4fAZ2.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" id="__NUXT_DATA__" data-ssr="false">[{"serverRendered":1},false]</script>
|
|
11
|
-
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-i18n-micro",buildId:"
|
|
11
|
+
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-i18n-micro",buildId:"7d3d3cf9-6064-4ba3-a2ec-347447f8edd0",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
|
package/dist/client/404.html
CHANGED
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
<link rel="prefetch" as="style" href="/__nuxt-i18n-micro/_nuxt/error-500.B4KzowuE.css">
|
|
9
9
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/HZLiFEh-.js">
|
|
10
10
|
<script type="module" src="/__nuxt-i18n-micro/_nuxt/6EJ4fAZ2.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" id="__NUXT_DATA__" data-ssr="false">[{"serverRendered":1},false]</script>
|
|
11
|
-
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-i18n-micro",buildId:"
|
|
11
|
+
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-i18n-micro",buildId:"7d3d3cf9-6064-4ba3-a2ec-347447f8edd0",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"id":"
|
|
1
|
+
{"id":"7d3d3cf9-6064-4ba3-a2ec-347447f8edd0","timestamp":1723968282041}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"id":"7d3d3cf9-6064-4ba3-a2ec-347447f8edd0","timestamp":1723968282041,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
|
package/dist/client/index.html
CHANGED
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
<link rel="prefetch" as="style" href="/__nuxt-i18n-micro/_nuxt/error-500.B4KzowuE.css">
|
|
9
9
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/HZLiFEh-.js">
|
|
10
10
|
<script type="module" src="/__nuxt-i18n-micro/_nuxt/6EJ4fAZ2.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" id="__NUXT_DATA__" data-ssr="false">[{"serverRendered":1},false]</script>
|
|
11
|
-
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-i18n-micro",buildId:"
|
|
11
|
+
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-i18n-micro",buildId:"7d3d3cf9-6064-4ba3-a2ec-347447f8edd0",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
|
package/dist/module.json
CHANGED
|
@@ -8,7 +8,7 @@ interface PluralTranslations {
|
|
|
8
8
|
}
|
|
9
9
|
declare const _default: import("#app").Plugin<{
|
|
10
10
|
getLocale: () => string;
|
|
11
|
-
getLocales: () => import("
|
|
11
|
+
getLocales: () => import("../module").Locale[];
|
|
12
12
|
t: <T extends Record<string, string | number | boolean>>(key: string, params?: T, defaultValue?: string) => string | number | boolean | Translations | PluralTranslations | unknown[] | unknown | null;
|
|
13
13
|
tc: (key: string, count: number, defaultValue?: string) => string;
|
|
14
14
|
mergeTranslations: (newTranslations: Translations) => void;
|
|
@@ -16,7 +16,7 @@ declare const _default: import("#app").Plugin<{
|
|
|
16
16
|
localeRoute: (to: RouteLocationRaw, locale?: string) => RouteLocationRaw;
|
|
17
17
|
}> & import("#app").ObjectPlugin<{
|
|
18
18
|
getLocale: () => string;
|
|
19
|
-
getLocales: () => import("
|
|
19
|
+
getLocales: () => import("../module").Locale[];
|
|
20
20
|
t: <T extends Record<string, string | number | boolean>>(key: string, params?: T, defaultValue?: string) => string | number | boolean | Translations | PluralTranslations | unknown[] | unknown | null;
|
|
21
21
|
tc: (key: string, count: number, defaultValue?: string) => string;
|
|
22
22
|
mergeTranslations: (newTranslations: Translations) => void;
|
|
@@ -65,7 +65,7 @@ function switchLocale(locale, route, router, i18nConfig) {
|
|
|
65
65
|
if (locale !== defaultLocale || i18nConfig.includeDefaultLocaleRoute) {
|
|
66
66
|
newParams.locale = locale;
|
|
67
67
|
}
|
|
68
|
-
|
|
68
|
+
router.push({ name: newRouteName, params: newParams });
|
|
69
69
|
}
|
|
70
70
|
function getLocalizedRoute(to, router, route, i18nConfig, locale) {
|
|
71
71
|
const { defaultLocale } = i18nConfig;
|
|
@@ -102,6 +102,10 @@ export default defineNuxtPlugin(async (_nuxtApp) => {
|
|
|
102
102
|
getLocale: () => (route.params?.locale ?? i18nConfig.defaultLocale).toString(),
|
|
103
103
|
getLocales: () => i18nConfig.locales || [],
|
|
104
104
|
t: (key, params, defaultValue) => {
|
|
105
|
+
if (!key) {
|
|
106
|
+
console.log(`$t: key not exist`);
|
|
107
|
+
return "";
|
|
108
|
+
}
|
|
105
109
|
const locale = (route.params?.locale ?? i18nConfig.defaultLocale).toString();
|
|
106
110
|
const routeName = route.name.replace(`localized-`, "");
|
|
107
111
|
let value = getTranslation(routeLocaleCache[`${locale}:${routeName}`] ?? {}, key) || getTranslation(generalLocaleCache[locale] ?? {}, key) || dynamicTranslationsCaches.reduce((result, cache) => {
|
|
@@ -116,6 +120,10 @@ export default defineNuxtPlugin(async (_nuxtApp) => {
|
|
|
116
120
|
return value;
|
|
117
121
|
},
|
|
118
122
|
tc: (key, count, defaultValue) => {
|
|
123
|
+
if (!key) {
|
|
124
|
+
console.log(`$tc: key not exist`);
|
|
125
|
+
return "";
|
|
126
|
+
}
|
|
119
127
|
const locale = (route.params?.locale ?? i18nConfig.defaultLocale).toString();
|
|
120
128
|
const routeName = route.name.replace(`localized-`, "");
|
|
121
129
|
let translation = getPluralTranslation(routeLocaleCache[`${locale}:${routeName}`] ?? {}, key) || getPluralTranslation(generalLocaleCache[locale] ?? {}, key) || dynamicTranslationsCaches.reduce((result, cache) => {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { PluginsInjections } from '
|
|
1
|
+
import type { PluginsInjections } from '../01.plugin.js';
|
|
2
2
|
export declare function useI18n(): PluginsInjections;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-i18n-micro",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.8",
|
|
4
4
|
"description": "Nuxt I18n Micro is a lightweight, high-performance internationalization module for Nuxt, designed to handle multi-language support with minimal overhead, fast build times, and efficient runtime performance.",
|
|
5
5
|
"repository": "s00d/nuxt-i18n-micro",
|
|
6
6
|
"license": "MIT",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"@playwright/test": "^1.46.1",
|
|
71
71
|
"@types/node": "^20.14.11",
|
|
72
72
|
"changelogen": "^0.5.5",
|
|
73
|
-
"eslint": "^
|
|
73
|
+
"eslint": "^8.56.0",
|
|
74
74
|
"execa": "^9.3.0",
|
|
75
75
|
"nuxt": "^3.12.4",
|
|
76
76
|
"typescript": "latest",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"id":"dae24a88-5573-405d-9c95-67ec6422e7cd","timestamp":1723891230132,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
|