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

docs: new Crowdin updates #2466

Merged
merged 18 commits into from Jan 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
02edf49
docs: new translation vue-intl.md (French) [ci skip]
longlho Jan 2, 2021
9c57f3a
docs: new translation vue-intl.md (Spanish) [ci skip]
longlho Jan 2, 2021
eaf31a9
docs: new translation vue-intl.md (Japanese) [ci skip]
longlho Jan 2, 2021
313fa2b
docs: new translation vue-intl.md (Portuguese) [ci skip]
longlho Jan 2, 2021
54caa85
docs: new translation vue-intl.md (Chinese Simplified) [ci skip]
longlho Jan 2, 2021
a16476d
docs: new translation vue-intl.md (Chinese Traditional) [ci skip]
longlho Jan 2, 2021
d412319
docs: new translation linter.md (Japanese) [ci skip]
longlho Jan 2, 2021
1e247a6
docs: new translation vue-intl.md (French) [ci skip]
longlho Jan 2, 2021
a51dbc1
docs: new translation vue-intl.md (Spanish) [ci skip]
longlho Jan 2, 2021
b2e0624
docs: new translation vue-intl.md (Japanese) [ci skip]
longlho Jan 2, 2021
496a548
docs: new translation linter.md (French) [ci skip]
longlho Jan 2, 2021
6ee999c
docs: new translation linter.md (Spanish) [ci skip]
longlho Jan 2, 2021
92f0402
docs: new translation linter.md (Chinese Traditional) [ci skip]
longlho Jan 2, 2021
f092b5e
docs: new translation vue-intl.md (Portuguese) [ci skip]
longlho Jan 2, 2021
fd14c60
docs: new translation vue-intl.md (Chinese Simplified) [ci skip]
longlho Jan 2, 2021
5ea5059
docs: new translation linter.md (Portuguese) [ci skip]
longlho Jan 2, 2021
f4c0776
docs: new translation linter.md (Chinese Simplified) [ci skip]
longlho Jan 2, 2021
2eaf664
docs: new translation vue-intl.md (Chinese Traditional) [ci skip]
longlho Jan 2, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 19 additions & 1 deletion translated/es-ES/website/docs/tooling/linter.md
Expand Up @@ -3,7 +3,7 @@ id: linter
title: eslint-plugin-formatjs
---

This eslint plugin allows you to enforce certain rules in your ICU message. This is currently under development
This eslint plugin allows you to enforce certain rules in your ICU message.

## Usage

Expand Down Expand Up @@ -43,6 +43,8 @@ Then in your eslint config:
}
```

### React

Currently this uses `intl.formatMessage`, `defineMessage`, `defineMessages`, `<FormattedMessage>` from `react-intl` as hooks to verify the message. Therefore, in your code use 1 of the following mechanisms:

```tsx
Expand Down Expand Up @@ -73,6 +75,22 @@ function foo() {
}
```

### Vue

This will check against `intl.formatMessage`, `$formatMessage` function calls in both your JS/TS & your SFC `.vue` files. For example:

```vue
<template>
<p>
{{
$formatMessage({
defaultMessage: 'today is {now, date}',
})
}}
</p>
</template>
```

## Available Rules

### `blacklist-elements`
Expand Down
77 changes: 77 additions & 0 deletions translated/es-ES/website/docs/vue-intl.md
Expand Up @@ -55,6 +55,47 @@ From there you can use our APIs in 2 ways:

By specifying `inject: ['intl']`, you can use the full `IntlFormatters` API documented in [@formatjs/intl](./intl.md#IntlShape).

### Composition API

We also support Vue's [Composition API](https://composition-api.vuejs.org/) with `provideIntl` & `useIntl`.

```ts
import {createIntl} from '@formatjs/intl'
import {provideIntl, useIntl} from '@formatjs/vue-intl'

const Ancestor = {
setup() {
provideIntl(
createIntl({
locale: 'en',
defaultLocale: 'en',
messages: {
foo: 'Composed',
},
})
)
},
render() {
return h(Descendant)
},
}

const Descendant = {
setup() {
const intl = useIntl()
return () =>
h(
'p',
{},
intl.formatMessage({
id: 'foo',
defaultMessage: 'Hello',
})
)
},
}
```

### Methods

You can also use our formatters in Vue template by prepending `$` like below:
Expand All @@ -74,3 +115,39 @@ We currently support:
- `$formatTimeRange`
- `$formatDisplayName`
- `$formatList`

## Tooling

We're actively working on adding `vue` support for formatjs toolchain. Currently the following tools are supported:

- [eslint-plugin-formatjs](./tooling/linter.md): This fully supports `.vue` and JS/TS.

## Caveats

### Using ICU in Vue SFC

Since `}}` & `{{` are special tokens in `.vue` `<template>`, this can cause potential conflict with ICU MessageFormat syntax, e.g:

```html {4}
<template>
<p>
{{ $formatMessage({ defaultMessage: '{count, selectordinal, offset:1 one {#}
other {# more}}', }) }}
</p>
</template>
```

Notice the `{# more}}` where it ends with `}}`. This will cause parsing issue in your `vue` template. In order to work around this issue, we recommend using space to turn `}}` into `} }`.

```vue {6}
<template>
<p>
{{
$formatMessage({
defaultMessage:
'{count, selectordinal, offset:1 one {#} other {# more} }',
})
}}
</p>
</template>
```
20 changes: 19 additions & 1 deletion translated/fr-FR/website/docs/tooling/linter.md
Expand Up @@ -3,7 +3,7 @@ id: linter
title: eslint-plugin-formatjs
---

This eslint plugin allows you to enforce certain rules in your ICU message. This is currently under development
This eslint plugin allows you to enforce certain rules in your ICU message.

## Usage

Expand Down Expand Up @@ -43,6 +43,8 @@ Then in your eslint config:
}
```

### React

Currently this uses `intl.formatMessage`, `defineMessage`, `defineMessages`, `<FormattedMessage>` from `react-intl` as hooks to verify the message. Therefore, in your code use 1 of the following mechanisms:

```tsx
Expand Down Expand Up @@ -73,6 +75,22 @@ function foo() {
}
```

### Vue

This will check against `intl.formatMessage`, `$formatMessage` function calls in both your JS/TS & your SFC `.vue` files. For example:

```vue
<template>
<p>
{{
$formatMessage({
defaultMessage: 'today is {now, date}',
})
}}
</p>
</template>
```

## Available Rules

### `blacklist-elements`
Expand Down
77 changes: 77 additions & 0 deletions translated/fr-FR/website/docs/vue-intl.md
Expand Up @@ -55,6 +55,47 @@ From there you can use our APIs in 2 ways:

By specifying `inject: ['intl']`, you can use the full `IntlFormatters` API documented in [@formatjs/intl](./intl.md#IntlShape).

### Composition API

We also support Vue's [Composition API](https://composition-api.vuejs.org/) with `provideIntl` & `useIntl`.

```ts
import {createIntl} from '@formatjs/intl'
import {provideIntl, useIntl} from '@formatjs/vue-intl'

const Ancestor = {
setup() {
provideIntl(
createIntl({
locale: 'en',
defaultLocale: 'en',
messages: {
foo: 'Composed',
},
})
)
},
render() {
return h(Descendant)
},
}

const Descendant = {
setup() {
const intl = useIntl()
return () =>
h(
'p',
{},
intl.formatMessage({
id: 'foo',
defaultMessage: 'Hello',
})
)
},
}
```

### Methods

You can also use our formatters in Vue template by prepending `$` like below:
Expand All @@ -74,3 +115,39 @@ We currently support:
- `$formatTimeRange`
- `$formatDisplayName`
- `$formatList`

## Tooling

We're actively working on adding `vue` support for formatjs toolchain. Currently the following tools are supported:

- [eslint-plugin-formatjs](./tooling/linter.md): This fully supports `.vue` and JS/TS.

## Caveats

### Using ICU in Vue SFC

Since `}}` & `{{` are special tokens in `.vue` `<template>`, this can cause potential conflict with ICU MessageFormat syntax, e.g:

```html {4}
<template>
<p>
{{ $formatMessage({ defaultMessage: '{count, selectordinal, offset:1 one {#}
other {# more}}', }) }}
</p>
</template>
```

Notice the `{# more}}` where it ends with `}}`. This will cause parsing issue in your `vue` template. In order to work around this issue, we recommend using space to turn `}}` into `} }`.

```vue {6}
<template>
<p>
{{
$formatMessage({
defaultMessage:
'{count, selectordinal, offset:1 one {#} other {# more} }',
})
}}
</p>
</template>
```
20 changes: 19 additions & 1 deletion translated/ja-JP/website/docs/tooling/linter.md
Expand Up @@ -3,7 +3,7 @@ id: linter
title: eslint-plugin-formatjs
---

This eslint plugin allows you to enforce certain rules in your ICU message. This is currently under development
This eslint plugin allows you to enforce certain rules in your ICU message.

## Usage

Expand Down Expand Up @@ -43,6 +43,8 @@ Then in your eslint config:
}
```

### React

Currently this uses `intl.formatMessage`, `defineMessage`, `defineMessages`, `<FormattedMessage>` from `react-intl` as hooks to verify the message. Therefore, in your code use 1 of the following mechanisms:

```tsx
Expand Down Expand Up @@ -73,6 +75,22 @@ function foo() {
}
```

### Vue

This will check against `intl.formatMessage`, `$formatMessage` function calls in both your JS/TS & your SFC `.vue` files. For example:

```vue
<template>
<p>
{{
$formatMessage({
defaultMessage: 'today is {now, date}',
})
}}
</p>
</template>
```

## Available Rules

### `blacklist-elements`
Expand Down
77 changes: 77 additions & 0 deletions translated/ja-JP/website/docs/vue-intl.md
Expand Up @@ -55,6 +55,47 @@ From there you can use our APIs in 2 ways:

By specifying `inject: ['intl']`, you can use the full `IntlFormatters` API documented in [@formatjs/intl](./intl.md#IntlShape).

### Composition API

We also support Vue's [Composition API](https://composition-api.vuejs.org/) with `provideIntl` & `useIntl`.

```ts
import {createIntl} from '@formatjs/intl'
import {provideIntl, useIntl} from '@formatjs/vue-intl'

const Ancestor = {
setup() {
provideIntl(
createIntl({
locale: 'en',
defaultLocale: 'en',
messages: {
foo: 'Composed',
},
})
)
},
render() {
return h(Descendant)
},
}

const Descendant = {
setup() {
const intl = useIntl()
return () =>
h(
'p',
{},
intl.formatMessage({
id: 'foo',
defaultMessage: 'Hello',
})
)
},
}
```

### Methods

You can also use our formatters in Vue template by prepending `$` like below:
Expand All @@ -74,3 +115,39 @@ We currently support:
- `$formatTimeRange`
- `$formatDisplayName`
- `$formatList`

## Tooling

We're actively working on adding `vue` support for formatjs toolchain. Currently the following tools are supported:

- [eslint-plugin-formatjs](./tooling/linter.md): This fully supports `.vue` and JS/TS.

## Caveats

### Using ICU in Vue SFC

Since `}}` & `{{` are special tokens in `.vue` `<template>`, this can cause potential conflict with ICU MessageFormat syntax, e.g:

```html {4}
<template>
<p>
{{ $formatMessage({ defaultMessage: '{count, selectordinal, offset:1 one {#}
other {# more}}', }) }}
</p>
</template>
```

Notice the `{# more}}` where it ends with `}}`. This will cause parsing issue in your `vue` template. In order to work around this issue, we recommend using space to turn `}}` into `} }`.

```vue {6}
<template>
<p>
{{
$formatMessage({
defaultMessage:
'{count, selectordinal, offset:1 one {#} other {# more} }',
})
}}
</p>
</template>
```