Skip to content

Commit

Permalink
feat: add fallbackRootWithEmptyString in index.d.ts and api.md
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterAlfredLee committed Jan 21, 2022
1 parent 5fbfd60 commit 4e5fdf9
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 1 deletion.
14 changes: 14 additions & 0 deletions gitbook/en/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,20 @@ You can specify the below some options of `I18nOptions` constructor options of [

If `false`, it's warned, and is returned the key.

#### fallbackRootWithEmptyString

> :new: 8.26+
- **Type:** `Boolean`

- **Default:** `true`

In the component localization, whether to fall back to root level (global) localization when local message is an empty string.

Please note the default behavior in vue-i18n 9.x is to not falling back to root for local message that is empty string.

If `false`, the empty local message will not fall back to root and will be kept as empty string.

#### sync

- **Type:** `Boolean`
Expand Down
3 changes: 2 additions & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ declare namespace VueI18n {
modifiers?: Modifiers,
missing?: MissingHandler;
fallbackRoot?: boolean;
fallbackRootWithEmptyString?: boolean,
formatFallbackMessages?: boolean;
sync?: boolean;
silentTranslationWarn?: boolean | RegExp;
Expand Down Expand Up @@ -240,7 +241,7 @@ declare class VueI18n {
te(key: VueI18n.Path, locale?: VueI18n.Locale): boolean;
d(value: number | Date, key?: VueI18n.Path, locale?: VueI18n.Locale): VueI18n.DateTimeFormatResult;
d(value: number | Date, args?: { [key: string]: string }): VueI18n.DateTimeFormatResult;
d(value: number | Date, options?: VueI18n.DateTimeFormatOptions): VueI18n.DateTimeFormatResult;
d(value: number | Date, options?: VueI18n.DateTimeFormatOptions): VueI18n.DateTimeFormatResult;
n(value: number, key?: VueI18n.Path, locale?: VueI18n.Locale): VueI18n.NumberFormatResult;
n(value: number, args?: { [key: string]: string }): VueI18n.NumberFormatResult;
n(value: number, options?: VueI18n.NumberFormatOptions, locale?: VueI18n.Locale): VueI18n.NumberFormatResult;
Expand Down
14 changes: 14 additions & 0 deletions vuepress/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,20 @@ In the component localization, whether to fall back to root level (global) local

If `false`, it's warned, and is returned the key.

#### fallbackRootWithEmptyString

> :new: 8.26+
- **Type:** `Boolean`

- **Default:** `true`

In the component localization, whether to fall back to root level (global) localization when local message is an empty string.

Please note the default behavior in vue-i18n 9.x is to not falling back to root for local message that is empty string.

If `false`, the empty local message will not fall back to root and will be kept as empty string.

#### sync

* **Type:** `Boolean`
Expand Down
14 changes: 14 additions & 0 deletions vuepress/pt/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,20 @@ Ao usar a localização em componentes, determina se deve consultar a localizaç

Se definido como `false`, um aviso será lançado e uma chave retornada.

#### fallbackRootWithEmptyString

> :new: Adicionado na versão 8.26+
* **Tipo:** `Boolean`

* **Padrão:** `true`

Na localização do componente, se deve retornar à localização de nível raiz (global) quando a mensagem local for uma string vazia.

Por favor, note que o comportamento padrão no vue-i18n 9.x é não voltar ao root para a mensagem local que é uma string vazia.

Se for `false`, a mensagem local vazia não retornará ao root e será mantida como string vazia.

#### sync

* **Tipo:** `Boolean`
Expand Down
14 changes: 14 additions & 0 deletions vuepress/ru/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,20 @@ sidebar: auto

При значении `false` будет выбрасываться предупреждение и возвращаться ключ.

#### fallbackRootWithEmptyString

> :new: Добавлено в версии 8.26+
* **Тип:** `Boolean`

* **По умолчанию:** `true`

В локализации компонента укажите, следует ли вернуться к локализации корневого уровня (глобальной), если локальное сообщение представляет собой пустую строку.

Обратите внимание, что поведение по умолчанию в vue-i18n 9.x заключается в том, чтобы не возвращаться к корневому каталогу для локального сообщения, которое является пустой строкой.

Если `false`, пустое локальное сообщение не будет возвращено в корень и будет храниться как пустая строка.

#### sync

* **Тип:** `Boolean`
Expand Down
14 changes: 14 additions & 0 deletions vuepress/zh/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,20 @@ vue-i18n 版本

如果为 `false`,则会发出警告,并返回 key。

#### fallbackRootWithEmptyString

> :new: 8.26+ 新增
* **Type:** `Boolean`

* **Default:** `true`

在组件本地化中,当本地化文本为空字符串时,是否回退到根级别 (全局) 本地化。

请注意,vue-i18n 9.x版本的默认行为是对空字符串本地化文本进行回退到根级别本地化。

如果为`false`,则空的本地化文本将不会回退到根目录,并将保留为空字符串。

#### sync

* **类型:**`Boolean`
Expand Down

0 comments on commit 4e5fdf9

Please sign in to comment.