@kanso-protocol/i18n 0.1.0 → 0.2.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.
@@ -38,6 +38,11 @@ const KP_DEFAULT_STRINGS_EN = {
38
38
  selectTime: 'Select time',
39
39
  previousMonth: 'Previous month',
40
40
  nextMonth: 'Next month',
41
+ timeHour: 'Hour',
42
+ timeMinute: 'Min',
43
+ timeSecond: 'Sec',
44
+ timeDayPeriod: 'AM/PM',
45
+ timeNow: 'Now',
41
46
  dropzoneTitle: 'Drop files here or click to browse',
42
47
  dropzoneRemove: (filename) => `Remove ${filename}`,
43
48
  dropzoneUploaded: 'Uploaded',
@@ -1 +1 @@
1
- {"version":3,"file":"kanso-protocol-i18n.mjs","sources":["../../../../packages/i18n/src/tokens.ts","../../../../packages/i18n/src/intl.ts","../../../../packages/i18n/src/kanso-protocol-i18n.ts"],"sourcesContent":["import { InjectionToken, inject } from '@angular/core';\n\n/**\n * BCP-47 locale tag used by every Kanso component that calls into Intl\n * APIs (date / time / number formatting, weekday names, etc.).\n *\n * Default factory pulls from `navigator.language` if available, else\n * falls back to `'en-US'`. Override at the app root:\n *\n * providers: [{ provide: KP_LOCALE, useValue: 'fr-FR' }]\n *\n * Or per-feature via a child injector. Components inject this lazily —\n * changing it at runtime requires re-rendering the affected components.\n */\nexport const KP_LOCALE = new InjectionToken<string>('KP_LOCALE', {\n factory: () =>\n typeof navigator !== 'undefined' && navigator.language\n ? navigator.language\n : 'en-US',\n});\n\n/**\n * Static UI strings that don't have an Intl equivalent — labels, ARIA\n * fallbacks, button text. Anything that DOES have an Intl form (month\n * names, day-period markers, time formats) is derived from `KP_LOCALE`\n * via the helpers in `intl.ts` instead of being listed here.\n *\n * Add a key here only after you've confirmed it's not derivable from\n * Intl. The goal is a small registry — large registries rot fast.\n */\nexport interface KpLocaleStrings {\n // Generic chrome\n close: string;\n clear: string;\n cancel: string;\n confirm: string;\n loading: string;\n noResults: string;\n\n // Date / time pickers — buttons + presets\n today: string;\n yesterday: string;\n thisWeek: string;\n lastWeek: string;\n thisMonth: string;\n lastMonth: string;\n selectDate: string;\n selectTime: string;\n previousMonth: string;\n nextMonth: string;\n\n // File upload\n dropzoneTitle: string;\n dropzoneRemove: (filename: string) => string;\n dropzoneUploaded: string;\n\n // Search / command palette\n searchPlaceholder: string;\n commandPaletteHint: string;\n commandPalettePlaceholder: string;\n}\n\n/**\n * Built-in English strings. Components that read these go through\n * `injectKpStrings()` so consumers can override per-app or per-locale.\n */\nexport const KP_DEFAULT_STRINGS_EN: KpLocaleStrings = {\n close: 'Close',\n clear: 'Clear',\n cancel: 'Cancel',\n confirm: 'Confirm',\n loading: 'Loading…',\n noResults: 'No results found',\n\n today: 'Today',\n yesterday: 'Yesterday',\n thisWeek: 'This week',\n lastWeek: 'Last week',\n thisMonth: 'This month',\n lastMonth: 'Last month',\n selectDate: 'Select date',\n selectTime: 'Select time',\n previousMonth: 'Previous month',\n nextMonth: 'Next month',\n\n dropzoneTitle: 'Drop files here or click to browse',\n dropzoneRemove: (filename) => `Remove ${filename}`,\n dropzoneUploaded: 'Uploaded',\n\n searchPlaceholder: 'Search…',\n commandPaletteHint: '⌘K',\n commandPalettePlaceholder: 'Type a command or search…',\n};\n\n/**\n * App-level override token. Provide a `Partial<KpLocaleStrings>` —\n * unspecified keys fall through to the English defaults.\n *\n * providers: [{\n * provide: KP_STRINGS,\n * useValue: {\n * close: 'Закрыть',\n * today: 'Сегодня',\n * commandPalettePlaceholder: 'Команда или поиск…',\n * },\n * }]\n */\nexport const KP_STRINGS = new InjectionToken<Partial<KpLocaleStrings>>(\n 'KP_STRINGS',\n { factory: () => ({}) },\n);\n\n/**\n * Resolve the merged strings dictionary inside a component / directive\n * factory. Reads both the override token and the defaults; consumers\n * never have to remember to merge.\n */\nexport function injectKpStrings(): KpLocaleStrings {\n const overrides = inject(KP_STRINGS);\n return { ...KP_DEFAULT_STRINGS_EN, ...overrides };\n}\n\n/** Convenience accessor with the same lifecycle constraints as `inject(KP_LOCALE)`. */\nexport function injectKpLocale(): string {\n return inject(KP_LOCALE);\n}\n","/**\n * Thin wrappers over `Intl.DateTimeFormat` so components that take\n * `KP_LOCALE` don't have to repeat the `new Intl.DateTimeFormat(...)`\n * dance. Each helper caches the formatter per (locale, options) — the\n * cache is keyed on a JSON-stringified options object since `Intl`\n * options are small and structurally compared.\n */\n\nconst CACHE = new Map<string, Intl.DateTimeFormat>();\n\nfunction getFormatter(locale: string, options: Intl.DateTimeFormatOptions): Intl.DateTimeFormat {\n const key = `${locale}::${JSON.stringify(options)}`;\n let f = CACHE.get(key);\n if (!f) {\n f = new Intl.DateTimeFormat(locale, options);\n CACHE.set(key, f);\n }\n return f;\n}\n\n/**\n * Format a date in the consumer's locale.\n *\n * kpFormatDate(d, 'fr-FR', { dateStyle: 'medium' }) // \"5 mai 2026\"\n */\nexport function kpFormatDate(\n date: Date,\n locale: string,\n options: Intl.DateTimeFormatOptions = { dateStyle: 'medium' },\n): string {\n return getFormatter(locale, options).format(date);\n}\n\n/**\n * Format the time portion of a date.\n *\n * kpFormatTime(d, 'en-US', { hour: 'numeric', minute: '2-digit' }) // \"3:45 PM\"\n * kpFormatTime(d, 'de-DE') // \"15:45\"\n */\nexport function kpFormatTime(\n date: Date,\n locale: string,\n options: Intl.DateTimeFormatOptions = { timeStyle: 'short' },\n): string {\n return getFormatter(locale, options).format(date);\n}\n\n/**\n * Localized month names. Reuses a single formatter; the calendar\n * components walk all 12 months once on render.\n *\n * kpMonthNames('en-US', 'long') // ['January', 'February', ...]\n * kpMonthNames('ru-RU', 'short') // ['янв.', 'февр.', ...]\n */\nexport function kpMonthNames(\n locale: string,\n format: 'long' | 'short' | 'narrow' = 'long',\n): string[] {\n const fmt = getFormatter(locale, { month: format });\n const out: string[] = [];\n // Use day=1 of each month at year=2000 (safe — no month has fewer than 1 day,\n // year is well after epoch + DST offsets don't shift the month).\n for (let m = 0; m < 12; m++) out.push(fmt.format(new Date(2000, m, 1)));\n return out;\n}\n\n/**\n * Localized weekday short labels in display order, starting from\n * `firstDayOfWeek` (0 = Sunday, 1 = Monday).\n *\n * kpWeekdayNames('en-US', 1, 'narrow') // ['M', 'T', 'W', 'T', 'F', 'S', 'S']\n * kpWeekdayNames('en-US', 1, 'short') // ['Mon', 'Tue', ...]\n */\nexport function kpWeekdayNames(\n locale: string,\n firstDayOfWeek: 0 | 1 = 1,\n format: 'long' | 'short' | 'narrow' = 'short',\n): string[] {\n const fmt = getFormatter(locale, { weekday: format });\n // Pick a reference week starting on Sunday 2017-01-01 (Sunday = 0).\n const out: string[] = [];\n for (let i = 0; i < 7; i++) {\n const d = new Date(2017, 0, 1 + i);\n out.push(fmt.format(d));\n }\n if (firstDayOfWeek === 1) {\n return [...out.slice(1), out[0]];\n }\n return out;\n}\n\n/**\n * AM/PM marker for a given hour in the consumer's locale, or empty\n * string if the locale uses 24h format (most of the world).\n *\n * kpDayPeriod(15, 'en-US') // 'PM'\n * kpDayPeriod(15, 'de-DE') // ''\n */\nexport function kpDayPeriod(hour: number, locale: string): string {\n const fmt = getFormatter(locale, { hour: 'numeric', hour12: true });\n // Format \"3 PM\" → match trailing letters\n const formatted = fmt.format(new Date(2000, 0, 1, hour));\n const m = formatted.match(/[A-Za-zА-Яа-я]+\\.?$/);\n return m ? m[0] : '';\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAEA;;;;;;;;;;;AAWG;MACU,SAAS,GAAG,IAAI,cAAc,CAAS,WAAW,EAAE;IAC/D,OAAO,EAAE,MACP,OAAO,SAAS,KAAK,WAAW,IAAI,SAAS,CAAC;UAC1C,SAAS,CAAC;AACZ,UAAE,OAAO;AACd,CAAA;AA2CD;;;AAGG;AACI,MAAM,qBAAqB,GAAoB;AACpD,IAAA,KAAK,EAAE,OAAO;AACd,IAAA,KAAK,EAAE,OAAO;AACd,IAAA,MAAM,EAAE,QAAQ;AAChB,IAAA,OAAO,EAAE,SAAS;AA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ErD,MAAM,GAAG,GAAa,EAAE;AACxB,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;AAC1B,QAAA,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;QAClC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACzB;AACA,IAAA,IAAI,cAAc,KAAK,CAAC,EAAE;AACxB,QAAA,OAAO,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;IAClC;AACA,IAAA,OAAO,GAAG;AACZ;AAEA;;;;;;AAMG;AACG,SAAU,WAAW,CAAC,IAAY,EAAE,MAAc,EAAA;AACtD,IAAA,MAAM,GAAG,GAAG,YAAY,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;;AAEnE,IAAA,MAAM,SAAS,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;IACxD,MAAM,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,qBAAqB,CAAC;AAChD,IAAA,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE;AACtB;;ACxGA;;AAEG;;;;"}
1
+ {"version":3,"file":"kanso-protocol-i18n.mjs","sources":["../../../../packages/i18n/src/tokens.ts","../../../../packages/i18n/src/intl.ts","../../../../packages/i18n/src/kanso-protocol-i18n.ts"],"sourcesContent":["import { InjectionToken, inject } from '@angular/core';\n\n/**\n * BCP-47 locale tag used by every Kanso component that calls into Intl\n * APIs (date / time / number formatting, weekday names, etc.).\n *\n * Default factory pulls from `navigator.language` if available, else\n * falls back to `'en-US'`. Override at the app root:\n *\n * providers: [{ provide: KP_LOCALE, useValue: 'fr-FR' }]\n *\n * Or per-feature via a child injector. Components inject this lazily —\n * changing it at runtime requires re-rendering the affected components.\n */\nexport const KP_LOCALE = new InjectionToken<string>('KP_LOCALE', {\n factory: () =>\n typeof navigator !== 'undefined' && navigator.language\n ? navigator.language\n : 'en-US',\n});\n\n/**\n * Static UI strings that don't have an Intl equivalent — labels, ARIA\n * fallbacks, button text. Anything that DOES have an Intl form (month\n * names, day-period markers, time formats) is derived from `KP_LOCALE`\n * via the helpers in `intl.ts` instead of being listed here.\n *\n * Add a key here only after you've confirmed it's not derivable from\n * Intl. The goal is a small registry — large registries rot fast.\n */\nexport interface KpLocaleStrings {\n // Generic chrome\n close: string;\n clear: string;\n cancel: string;\n confirm: string;\n loading: string;\n noResults: string;\n\n // Date / time pickers — buttons + presets\n today: string;\n yesterday: string;\n thisWeek: string;\n lastWeek: string;\n thisMonth: string;\n lastMonth: string;\n selectDate: string;\n selectTime: string;\n previousMonth: string;\n nextMonth: string;\n\n // Timepicker columns + footer\n timeHour: string;\n timeMinute: string;\n timeSecond: string;\n timeDayPeriod: string;\n timeNow: string;\n\n // File upload\n dropzoneTitle: string;\n dropzoneRemove: (filename: string) => string;\n dropzoneUploaded: string;\n\n // Search / command palette\n searchPlaceholder: string;\n commandPaletteHint: string;\n commandPalettePlaceholder: string;\n}\n\n/**\n * Built-in English strings. Components that read these go through\n * `injectKpStrings()` so consumers can override per-app or per-locale.\n */\nexport const KP_DEFAULT_STRINGS_EN: KpLocaleStrings = {\n close: 'Close',\n clear: 'Clear',\n cancel: 'Cancel',\n confirm: 'Confirm',\n loading: 'Loading…',\n noResults: 'No results found',\n\n today: 'Today',\n yesterday: 'Yesterday',\n thisWeek: 'This week',\n lastWeek: 'Last week',\n thisMonth: 'This month',\n lastMonth: 'Last month',\n selectDate: 'Select date',\n selectTime: 'Select time',\n previousMonth: 'Previous month',\n nextMonth: 'Next month',\n\n timeHour: 'Hour',\n timeMinute: 'Min',\n timeSecond: 'Sec',\n timeDayPeriod: 'AM/PM',\n timeNow: 'Now',\n\n dropzoneTitle: 'Drop files here or click to browse',\n dropzoneRemove: (filename) => `Remove ${filename}`,\n dropzoneUploaded: 'Uploaded',\n\n searchPlaceholder: 'Search…',\n commandPaletteHint: '⌘K',\n commandPalettePlaceholder: 'Type a command or search…',\n};\n\n/**\n * App-level override token. Provide a `Partial<KpLocaleStrings>` —\n * unspecified keys fall through to the English defaults.\n *\n * providers: [{\n * provide: KP_STRINGS,\n * useValue: {\n * close: 'Закрыть',\n * today: 'Сегодня',\n * commandPalettePlaceholder: 'Команда или поиск…',\n * },\n * }]\n */\nexport const KP_STRINGS = new InjectionToken<Partial<KpLocaleStrings>>(\n 'KP_STRINGS',\n { factory: () => ({}) },\n);\n\n/**\n * Resolve the merged strings dictionary inside a component / directive\n * factory. Reads both the override token and the defaults; consumers\n * never have to remember to merge.\n */\nexport function injectKpStrings(): KpLocaleStrings {\n const overrides = inject(KP_STRINGS);\n return { ...KP_DEFAULT_STRINGS_EN, ...overrides };\n}\n\n/** Convenience accessor with the same lifecycle constraints as `inject(KP_LOCALE)`. */\nexport function injectKpLocale(): string {\n return inject(KP_LOCALE);\n}\n","/**\n * Thin wrappers over `Intl.DateTimeFormat` so components that take\n * `KP_LOCALE` don't have to repeat the `new Intl.DateTimeFormat(...)`\n * dance. Each helper caches the formatter per (locale, options) — the\n * cache is keyed on a JSON-stringified options object since `Intl`\n * options are small and structurally compared.\n */\n\nconst CACHE = new Map<string, Intl.DateTimeFormat>();\n\nfunction getFormatter(locale: string, options: Intl.DateTimeFormatOptions): Intl.DateTimeFormat {\n const key = `${locale}::${JSON.stringify(options)}`;\n let f = CACHE.get(key);\n if (!f) {\n f = new Intl.DateTimeFormat(locale, options);\n CACHE.set(key, f);\n }\n return f;\n}\n\n/**\n * Format a date in the consumer's locale.\n *\n * kpFormatDate(d, 'fr-FR', { dateStyle: 'medium' }) // \"5 mai 2026\"\n */\nexport function kpFormatDate(\n date: Date,\n locale: string,\n options: Intl.DateTimeFormatOptions = { dateStyle: 'medium' },\n): string {\n return getFormatter(locale, options).format(date);\n}\n\n/**\n * Format the time portion of a date.\n *\n * kpFormatTime(d, 'en-US', { hour: 'numeric', minute: '2-digit' }) // \"3:45 PM\"\n * kpFormatTime(d, 'de-DE') // \"15:45\"\n */\nexport function kpFormatTime(\n date: Date,\n locale: string,\n options: Intl.DateTimeFormatOptions = { timeStyle: 'short' },\n): string {\n return getFormatter(locale, options).format(date);\n}\n\n/**\n * Localized month names. Reuses a single formatter; the calendar\n * components walk all 12 months once on render.\n *\n * kpMonthNames('en-US', 'long') // ['January', 'February', ...]\n * kpMonthNames('ru-RU', 'short') // ['янв.', 'февр.', ...]\n */\nexport function kpMonthNames(\n locale: string,\n format: 'long' | 'short' | 'narrow' = 'long',\n): string[] {\n const fmt = getFormatter(locale, { month: format });\n const out: string[] = [];\n // Use day=1 of each month at year=2000 (safe — no month has fewer than 1 day,\n // year is well after epoch + DST offsets don't shift the month).\n for (let m = 0; m < 12; m++) out.push(fmt.format(new Date(2000, m, 1)));\n return out;\n}\n\n/**\n * Localized weekday short labels in display order, starting from\n * `firstDayOfWeek` (0 = Sunday, 1 = Monday).\n *\n * kpWeekdayNames('en-US', 1, 'narrow') // ['M', 'T', 'W', 'T', 'F', 'S', 'S']\n * kpWeekdayNames('en-US', 1, 'short') // ['Mon', 'Tue', ...]\n */\nexport function kpWeekdayNames(\n locale: string,\n firstDayOfWeek: 0 | 1 = 1,\n format: 'long' | 'short' | 'narrow' = 'short',\n): string[] {\n const fmt = getFormatter(locale, { weekday: format });\n // Pick a reference week starting on Sunday 2017-01-01 (Sunday = 0).\n const out: string[] = [];\n for (let i = 0; i < 7; i++) {\n const d = new Date(2017, 0, 1 + i);\n out.push(fmt.format(d));\n }\n if (firstDayOfWeek === 1) {\n return [...out.slice(1), out[0]];\n }\n return out;\n}\n\n/**\n * AM/PM marker for a given hour in the consumer's locale, or empty\n * string if the locale uses 24h format (most of the world).\n *\n * kpDayPeriod(15, 'en-US') // 'PM'\n * kpDayPeriod(15, 'de-DE') // ''\n */\nexport function kpDayPeriod(hour: number, locale: string): string {\n const fmt = getFormatter(locale, { hour: 'numeric', hour12: true });\n // Format \"3 PM\" → match trailing letters\n const formatted = fmt.format(new Date(2000, 0, 1, hour));\n const m = formatted.match(/[A-Za-zА-Яа-я]+\\.?$/);\n return m ? m[0] : '';\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAEA;;;;;;;;;;;AAWG;MACU,SAAS,GAAG,IAAI,cAAc,CAAS,WAAW,EAAE;IAC/D,OAAO,EAAE,MACP,OAAO,SAAS,KAAK,WAAW,IAAI,SAAS,CAAC;UAC1C,SAAS,CAAC;AACZ,UAAE,OAAO;AACd,CAAA;AAkDD;;;AAGG;AACI,MAAM,qBAAqB,GAAoB;AACpD,IAAA,KAAK,EAAE,OAAO;AACd,IAAA,KAAK,EAAE,OAAO;AACd,IAAA,MAAM,EAAE,QAAQ;AAChB,IAAA,OAAO,EAAE,SAAS;AAClB,IAAA,OAAO,EAAE,UAAU;AACnB,IAAA,SAAS,EAAE,kBAAkB;AAE7B,IAAA,KAAK,EAAE,OAAO;AACd,IAAA,SAAS,EAAE,WAAW;AACtB,IAAA,QAAQ,EAAE,WAAW;AACrB,IAAA,QAAQ,EAAE,WAAW;AACrB,IAAA,SAAS,EAAE,YAAY;AACvB,IAAA,SAAS,EAAE,YAAY;AACvB,IAAA,UAAU,EAAE,aAAa;AACzB,IAAA,UAAU,EAAE,aAAa;AACzB,IAAA,aAAa,EAAE,gBAAgB;AAC/B,IAAA,SAAS,EAAE,YAAY;AAEvB,IAAA,QAAQ,EAAE,MAAM;AAChB,IAAA,UAAU,EAAE,KAAK;AACjB,IAAA,UAAU,EAAE,KAAK;AACjB,IAAA,aAAa,EAAE,OAAO;AACtB,IAAA,OAAO,EAAE,KAAK;AAEd,IAAA,aAAa,EAAE,oCAAoC;IACnD,cAAc,EAAE,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CAAC,CAAC,CAAC;IAClC;AACA,IAAA,OAAO,GAAG;AACZ;AAEA;;;;;;AAMG;AACG,SAAU,WAAW,CAAC,IAAY,EAAE,MAAc,EAAA;AACtD,IAAA,MAAM,GAAG,GAAG,YAAY,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;;AAEnE,IAAA,MAAM,SAAS,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;IACxD,MAAM,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,qBAAqB,CAAC;AAChD,IAAA,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE;AACtB;;ACxGA;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kanso-protocol/i18n",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "license": "MIT",
5
5
  "peerDependencies": {
6
6
  "@angular/core": "^18.0.0"
@@ -39,6 +39,11 @@ interface KpLocaleStrings {
39
39
  selectTime: string;
40
40
  previousMonth: string;
41
41
  nextMonth: string;
42
+ timeHour: string;
43
+ timeMinute: string;
44
+ timeSecond: string;
45
+ timeDayPeriod: string;
46
+ timeNow: string;
42
47
  dropzoneTitle: string;
43
48
  dropzoneRemove: (filename: string) => string;
44
49
  dropzoneUploaded: string;