@i18n-micro/core 1.1.2 → 1.1.3
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/dist/translation.d.ts +2 -2
- package/package.json +2 -2
- package/src/translation.ts +3 -3
package/dist/translation.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Translations } from '@i18n-micro/types';
|
|
2
2
|
/**
|
|
3
|
-
* Bare Metal:
|
|
4
|
-
*
|
|
3
|
+
* Bare Metal: Simple translation storage without Ref, useState, devalue.
|
|
4
|
+
* Map key: locale (general) or locale:routeName (page-specific).
|
|
5
5
|
*/
|
|
6
6
|
export interface TranslationStorage {
|
|
7
7
|
translations: Map<string, Translations>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@i18n-micro/core",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": "s00d/nuxt-i18n-micro",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"keywords": [],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@i18n-micro/types": "1.1.
|
|
25
|
+
"@i18n-micro/types": "1.1.3"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"vite": "^7.3.1",
|
package/src/translation.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Translations } from '@i18n-micro/types'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Bare Metal:
|
|
5
|
-
*
|
|
4
|
+
* Bare Metal: Simple translation storage without Ref, useState, devalue.
|
|
5
|
+
* Map key: locale (general) or locale:routeName (page-specific).
|
|
6
6
|
*/
|
|
7
7
|
export interface TranslationStorage {
|
|
8
8
|
translations: Map<string, Translations>
|
|
@@ -81,7 +81,7 @@ export function useTranslationHelper(storage?: TranslationStorage) {
|
|
|
81
81
|
loadPageTranslations(locale: string, routeName: string, data: Translations): void {
|
|
82
82
|
const key = `${locale}:${routeName}`
|
|
83
83
|
const existing = translations.get(key)
|
|
84
|
-
// Perf:
|
|
84
|
+
// Perf: when existing is empty — keep reference, avoid O(n) copying of large objects
|
|
85
85
|
if (!existing || Object.keys(existing).length === 0) {
|
|
86
86
|
translations.set(key, data)
|
|
87
87
|
} else {
|