@mmstack/translate 19.3.5 → 19.3.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 +148 -26
- package/fesm2022/mmstack-translate.mjs +526 -79
- package/fesm2022/mmstack-translate.mjs.map +1 -1
- package/index.d.ts +3 -2
- package/lib/format/date.d.ts +77 -11
- package/lib/format/display-name.d.ts +37 -12
- package/lib/format/index.d.ts +1 -0
- package/lib/format/injection.d.ts +27 -0
- package/lib/format/list.d.ts +36 -9
- package/lib/format/numeric.d.ts +112 -27
- package/lib/format/provide-defaults.d.ts +5 -0
- package/lib/format/relative-time.d.ts +34 -10
- package/lib/parameterize.type.d.ts +25 -2
- package/lib/register-namespace.d.ts +23 -0
- package/lib/translation-store.d.ts +23 -0
- package/lib/with-params.d.ts +25 -0
- package/package.json +1 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { WithParams } from './parameterize.type';
|
|
2
|
+
/**
|
|
3
|
+
* Power-user escape hatch for ICU messages whose parameters can't be inferred
|
|
4
|
+
* from the message string — typically variables nested inside `plural` /
|
|
5
|
+
* `select` / `selectordinal` arms, which the type-level extractor skips.
|
|
6
|
+
*
|
|
7
|
+
* Declared params are merged with auto-extracted ones; on key conflict, the
|
|
8
|
+
* declared params win. Non-default locales for a key wrapped with `withParams`
|
|
9
|
+
* may be plain strings — they don't need to repeat the wrapper.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const ns = createNamespace('quote', {
|
|
14
|
+
* // auto-extracts `count`; `name` is declared explicitly because it
|
|
15
|
+
* // lives inside the plural arms and can't be inferred
|
|
16
|
+
* stats: withParams<{ name: string }>(
|
|
17
|
+
* '{count, plural, one {1 quote from {name}} other {# quotes from {name}}}',
|
|
18
|
+
* ),
|
|
19
|
+
* });
|
|
20
|
+
*
|
|
21
|
+
* // t inferred as: (key, { count: number; name: string }) => string
|
|
22
|
+
* t('quote.stats', { count: 3, name: 'Alice' });
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function withParams<const P extends Record<string, unknown>, const S extends string = string>(message: S): WithParams<P, S>;
|