Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add dir property and defaultDirection option #1023

Merged
merged 11 commits into from
Jan 29, 2021
Prev Previous commit
Next Next commit
update the es docs
  • Loading branch information
iifawzi committed Jan 28, 2021
commit d951f5ab98eedebdd8edcb6a420cfa9a694d4b0d
14 changes: 14 additions & 0 deletions docs/content/es/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ Todos los [Vue I18n propiedades y métodos](http://kazupon.github.io/vue-i18n/ap

See also [Basic usage - nuxt-link](../basic-usage#nuxt-link).

#### $nuxtI18nHead

- **Arguments**:
- addDirAttribute (type: boolean, default: true)
- **Returns**: `NuxtI18nHead`

If `addDirAttribute` is set to false, the dir attribute will not be added.

#### $nuxtI18nSeo

- **Arguments**:
Expand Down Expand Up @@ -109,6 +117,12 @@ Instance of [VueI18n class](http://kazupon.github.io/vue-i18n/api/#vuei18n-class

### Properties

#### defaultDirection

- **Type**: `Directions`

Default direction as specified in options.

#### defaultLocale

- **Type**: `string`
Expand Down
26 changes: 24 additions & 2 deletions docs/content/es/options-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ List of locales supported by your app. Can either be an array of codes (`['en',

```js
[
{ code: 'en', iso: 'en-US', file: 'en.js' },
{ code: 'fr', iso: 'fr-FR', file: 'fr.js' },
{ code: 'en', iso: 'en-US', file: 'en.js', dir: 'ltr' },
{ code: 'ar', iso: 'ar-EG', file: 'ar.js', dir: 'rtl' }
{ code: 'es', iso: 'es-ES', file: 'es.js' }
]
```
Expand All @@ -66,11 +66,33 @@ When using an object form, the properties can be:
* ISO 639-1 code (e.g. `'en'`)
* ISO 639-1 and ISO 3166-1 alpha-2 codes, separated by hyphen (e.g. `'en-US'`)
- `file` (required when using `lazy`) - the name of the file. Will be resolved relative to `langDir` path when loading locale messages lazily
- `dir` The dir property specifies the direction of the elements and content, value could be rtl, ltr or auto.
- `domain` (required when using `differentDomains`) - the domain name you'd like to use for that locale (including the port if used)
- `...` - any custom property set on the object will be exposed at runtime. This can be used, for example, to define the language name for the purpose of using it in a language selector on the page.

You can access all the properties of the current locale through the `localeProperties` property. When using an array of codes, it will only include the `code` property.

<alert type="info">

For direction attribute to be set, you MUST use the $nuxtI18nHead method in your layout.

```js {}[layouts/default.vue]
export default {
head () {
return this.$nuxtI18nHead()
}
}
```

</alert>

## `defaultDirection`

- type: `string`
- default: `ltr`

The app's default direction. Will only be used when `dir` is not specified.

## `defaultLocale`

- type: `string` or `null`
Expand Down