@pyreon/i18n 0.11.5 → 0.11.7
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 +77 -77
- package/lib/core.js.map +1 -1
- package/lib/devtools.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/package.json +16 -16
- package/src/context.ts +5 -5
- package/src/core.ts +4 -4
- package/src/create-i18n.ts +17 -17
- package/src/devtools.ts +5 -5
- package/src/index.ts +8 -8
- package/src/interpolation.ts +3 -3
- package/src/pluralization.ts +3 -3
- package/src/tests/devtools.test.ts +57 -57
- package/src/tests/i18n-additional.test.tsx +174 -174
- package/src/tests/i18n.test.tsx +338 -338
- package/src/tests/setup.ts +1 -1
- package/src/trans.tsx +4 -4
- package/src/types.ts +1 -1
package/src/tests/setup.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import '@happy-dom/global-registrator'
|
package/src/trans.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Props, VNode } from
|
|
2
|
-
import type { InterpolationValues } from
|
|
1
|
+
import type { Props, VNode } from '@pyreon/core'
|
|
2
|
+
import type { InterpolationValues } from './types'
|
|
3
3
|
|
|
4
4
|
const TAG_RE = /<(\w+)>([^<]*)<\/\1>/g
|
|
5
5
|
|
|
@@ -96,10 +96,10 @@ export function Trans(props: TransProps): VNode | string {
|
|
|
96
96
|
const parts = parseRichText(translated)
|
|
97
97
|
|
|
98
98
|
// If the result is a single plain string, return it directly
|
|
99
|
-
if (parts.length === 1 && typeof parts[0] ===
|
|
99
|
+
if (parts.length === 1 && typeof parts[0] === 'string') return parts[0]
|
|
100
100
|
|
|
101
101
|
const children = parts.map((part) => {
|
|
102
|
-
if (typeof part ===
|
|
102
|
+
if (typeof part === 'string') return part
|
|
103
103
|
const component = props.components![part.tag]
|
|
104
104
|
// Unmatched tags: render children as plain text (no raw HTML markup)
|
|
105
105
|
if (!component) return part.children
|
package/src/types.ts
CHANGED