Custom Blocks

i18n custom blocks options.


customBlocks

  • type: object
  • default: { defaultSFCLang: 'json', globalSFCScope: false }

Configure the i18n custom blocks of SFC.

Supported properties:

defaultSFCLang

  • type: string
  • default: `'json'

Specify the content for all your inlined i18n custom blocks on your SFC.

defaultSFCLang must have one of the following values:

  • json
  • json5
  • yaml
  • yml

On inlined i18n custom blocks that have specified the lang attribute, the defaultSFCLang is not applied.

For example, with defaultSFCLang: "yaml" or defaultSFCLang: "yml", this custom block:

<i18n lang="yaml">
en:
  hello: Hello
es:
  hello: Hola
</i18n>

and this another one, are equivalent:

<i18n>
en:
  hello: Hello
es:
  hello: Hola
</i18n>

globalSFCScope

  • type: boolean
  • default: false

Whether to include all i18n custom blocks on your SFC on global scope.

If true, it will be applied to all inlined i18n or imported custom blocks.

beware enabling globalSFCScope: true, all i18n custom blocks in all your SFC will be on global scope.

For example, with globalSFCScope: true, this custom block:

<i18n lang="yaml" global>
en:
  hello: Hello
es:
  hello: Hola
</i18n>

And this another one, are equivalent:

<i18n lang="yaml">
en:
  hello: Hello
es:
  hello: Hola
</i18n>

You can also use defaultSFCLang: "yaml", following with previous example, this another is also equivalent to previous ones:

<i18n>
en:
  hello: Hello
es:
  hello: Hola
</i18n>