use-intl 4.0.0-beta-18156c4 → 4.0.0-beta-c323050
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,7 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
export type
|
|
3
|
-
export type TranslationValues = Record<string, ICUArg>;
|
|
2
|
+
export type TranslationValues = Record<string, string | number | Date>;
|
|
4
3
|
export type RichTagsFunction = (chunks: ReactNode) => ReactNode;
|
|
5
4
|
export type MarkupTagsFunction = (chunks: string) => string;
|
|
6
|
-
export type RichTranslationValues = Record<string,
|
|
7
|
-
export type MarkupTranslationValues = Record<string,
|
|
5
|
+
export type RichTranslationValues = Record<string, TranslationValues[string] | RichTagsFunction>;
|
|
6
|
+
export type MarkupTranslationValues = Record<string, TranslationValues[string] | MarkupTagsFunction>;
|
|
@@ -5,16 +5,19 @@ import type ICUArgs from './ICUArgs.tsx';
|
|
|
5
5
|
import type ICUTags from './ICUTags.tsx';
|
|
6
6
|
import type IntlConfig from './IntlConfig.tsx';
|
|
7
7
|
import type { MessageKeys, NamespaceKeys, NestedKeyOf, NestedValueOf } from './MessageKeys.tsx';
|
|
8
|
-
import type {
|
|
8
|
+
import type { MarkupTagsFunction, RichTagsFunction, TranslationValues } from './TranslationValues.tsx';
|
|
9
9
|
import { type Formatters, type IntlCache } from './formatters.tsx';
|
|
10
10
|
import type { Prettify } from './types.tsx';
|
|
11
11
|
type ICUArgsWithTags<MessageString extends string, TagsFn extends RichTagsFunction | MarkupTagsFunction = never> = ICUArgs<MessageString, {
|
|
12
|
-
ICUArgument: string
|
|
12
|
+
ICUArgument: string;
|
|
13
13
|
ICUNumberArgument: number;
|
|
14
|
-
ICUDateArgument: Date
|
|
14
|
+
ICUDateArgument: Date;
|
|
15
15
|
}> & ([TagsFn] extends [never] ? {} : ICUTags<MessageString, TagsFn>);
|
|
16
16
|
type OnlyOptional<T> = Partial<T> extends T ? true : false;
|
|
17
|
-
type TranslateArgs<Value extends string, TagsFn extends RichTagsFunction | MarkupTagsFunction = never> = string extends Value ? [
|
|
17
|
+
type TranslateArgs<Value extends string, TagsFn extends RichTagsFunction | MarkupTagsFunction = never> = string extends Value ? [
|
|
18
|
+
values?: Record<string, TranslationValues[string] | TagsFn>,
|
|
19
|
+
formats?: Formats
|
|
20
|
+
] : (Value extends any ? (key: ICUArgsWithTags<Value, TagsFn>) => void : never) extends (key: infer Args) => void ? OnlyOptional<Args> extends true ? [values?: undefined, formats?: Formats] : [values: Prettify<Args>, formats?: Formats] : never;
|
|
18
21
|
type NamespacedMessageKeys<TranslatorMessages extends Messages, Namespace extends NamespaceKeys<TranslatorMessages, NestedKeyOf<TranslatorMessages>> = never> = MessageKeys<NestedValueOf<{
|
|
19
22
|
'!': TranslatorMessages;
|
|
20
23
|
}, [
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { default as AbstractIntlMessages } from './AbstractIntlMessages.tsx';
|
|
2
|
-
export type { TranslationValues,
|
|
2
|
+
export type { TranslationValues, RichTranslationValues, MarkupTranslationValues, RichTagsFunction, MarkupTagsFunction } from './TranslationValues.tsx';
|
|
3
3
|
export type { default as Formats } from './Formats.tsx';
|
|
4
4
|
export type { default as IntlConfig } from './IntlConfig.tsx';
|
|
5
5
|
export type { default as DateTimeFormatOptions } from './DateTimeFormatOptions.tsx';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "use-intl",
|
|
3
|
-
"version": "4.0.0-beta-
|
|
3
|
+
"version": "4.0.0-beta-c323050",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"author": "Jan Amann <jan@amann.work>",
|
|
6
6
|
"description": "Internationalization (i18n) for React",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"peerDependencies": {
|
|
65
65
|
"react": "^17.0.0 || ^18.0.0 || >=19.0.0-rc <19.0.0"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "759c798b20a0b88e6f42aa5bfc3d54683763f154"
|
|
68
68
|
}
|