vue-i18n / general / ComposerNumberFormatting
Interface: ComposerNumberFormatting()<NumberFormats, Locales, DefinedNumberFormat, C, M, ResourceKeys>
Vue I18n Composition
Number formatting functions
Remarks
This is the interface for Composer
Type Parameters
| Type Parameter | Default type |
|---|---|
NumberFormats extends Record<string, any> | object |
Locales | "en-US" |
DefinedNumberFormat extends RemovedIndexResources<DefineNumberFormat> | RemovedIndexResources<DefineNumberFormat> |
C | IsEmptyObject<DefinedNumberFormat> extends false ? PickupFormatPathKeys<{ [K in keyof DefinedNumberFormat]: DefinedNumberFormat[K] }> : never |
M | IsEmptyObject<NumberFormats> extends false ? PickupFormatKeys<NumberFormats> : never |
ResourceKeys extends C | M | IsNever<C> extends false ? IsNever<M> extends false ? C | M : C : IsNever<M> extends false ? M : never |
Call Signature
ComposerNumberFormatting(value): string;Number Formatting
Parameters
| Parameter | Type | Description |
|---|---|---|
value | number | A number value |
Returns
string
Formatted value
Remarks
If this is used in a reactive context, it will re-evaluate once the locale changes.
If UseI18nScope 'local' or Some UseI18nOptions are specified at useI18n, it’s translated in preferentially local scope datetime formats than global scope datetime formats.
If not, then it’s formatted with global scope number formats.
See about:
Call Signature
ComposerNumberFormatting<Key, OptionsType>(value, keyOrOptions): IsPart<OptionsType> extends true ? NumberFormatPart[] : string;Number Formatting
Type Parameters
| Type Parameter | Default type |
|---|---|
Key extends string | string |
OptionsType | | ResourceKeys | Key | NumberOptions<ResourceKeys | Key, Locales> |
Parameters
| Parameter | Type | Description |
|---|---|---|
value | number | A number value |
keyOrOptions | OptionsType | A key of number formats, or additional options for number formatting |
Returns
IsPart<OptionsType> extends true ? NumberFormatPart[] : string
Formatted value
Remarks
Overloaded n.
In this overloaded n, format in number format for a key registered in number formats.
Call Signature
ComposerNumberFormatting<Key, OptionsType>(
value,
keyOrOptions,
locale): IsPart<OptionsType> extends true ? NumberFormatPart[] : string;Number Formatting
Type Parameters
| Type Parameter | Default type |
|---|---|
Key extends string | string |
OptionsType | | ResourceKeys | Key | NumberOptions<ResourceKeys | Key, Locales> |
Parameters
| Parameter | Type | Description |
|---|---|---|
value | number | A number value |
keyOrOptions | OptionsType | A key of number formats, or additional options for number formatting |
locale | Locales | A locale, it will be used over than global scope or local scope. |
Returns
IsPart<OptionsType> extends true ? NumberFormatPart[] : string
Formatted value
Remarks
Overloaded n.
In this overloaded n, format in number format for a key registered in number formats at target locale.