@pyreon/i18n 0.9.0 → 0.11.0

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.
@@ -1 +1 @@
1
- import '@happy-dom/global-registrator'
1
+ import "@happy-dom/global-registrator"
package/src/trans.tsx CHANGED
@@ -1,5 +1,5 @@
1
- import type { Props, VNode } from '@pyreon/core'
2
- import type { InterpolationValues } from './types'
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] === 'string') return 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 === 'string') return 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
@@ -1,4 +1,4 @@
1
- import type { Computed, Signal } from '@pyreon/reactivity'
1
+ import type { Computed, Signal } from "@pyreon/reactivity"
2
2
 
3
3
  /** A nested dictionary of translation strings. */
4
4
  export type TranslationDictionary = {
@@ -50,11 +50,7 @@ export interface I18nOptions {
50
50
  * Missing key handler — called when a translation key is not found.
51
51
  * Useful for logging, reporting, or returning a custom fallback.
52
52
  */
53
- onMissingKey?: (
54
- locale: string,
55
- key: string,
56
- namespace?: string,
57
- ) => string | undefined
53
+ onMissingKey?: (locale: string, key: string, namespace?: string) => string | undefined
58
54
  }
59
55
 
60
56
  /** The public i18n instance returned by `createI18n()`. */
@@ -99,11 +95,7 @@ export interface I18nInstance {
99
95
  * Add translations for a locale (merged with existing).
100
96
  * Useful for adding translations at runtime without async loading.
101
97
  */
102
- addMessages: (
103
- locale: string,
104
- messages: TranslationDictionary,
105
- namespace?: string,
106
- ) => void
98
+ addMessages: (locale: string, messages: TranslationDictionary, namespace?: string) => void
107
99
 
108
100
  /**
109
101
  * Get all available locales (those with any registered messages).