-
Notifications
You must be signed in to change notification settings - Fork 23
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
Add initial i18n documentation #222
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added some suggestions. Please add them as you see fit and make sure the document is in a good state overall.
content/docs/i18n.mdx
Outdated
The paths in the above example would be: | ||
- `firstName.label` & `firstName.description` | ||
- `address.street.label` & `address.street.description` | ||
- `comments.message.label` & `comments.message.description` (the path for arrays will not contain indices) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you check whether address.label
, address.description
and comments.label
, comments.description
is also called?
Co-authored-by: Stefan Dirix <sdirix@eclipsesource.com>
With this documentation, please try to implement translation support in the JSON Forms React seed (first update to the latest JSON Forms). Please review and identify potential problems with the current documentation. Please test exhaustively and question all information. Try all kind of translations (usual, errors, enums) and using the translation support in a custom renderer. |
Documentation looks good to me! |
|
Signed-off-by: Lukas Boll lukas-bool@web.de
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks already pretty good to me.
Please note that the i18n
prop is now directly defined in control elements (see inline comment).
Furthermore, I provided some grammar/wording/typo fixes I noticed ;)
content/docs/i18n.mdx
Outdated
(key: string, defaultMessage: string | undefined, context: any) => string | undefined) | ||
``` | ||
|
||
and there for has the following parameters: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and there for has the following parameters: | |
with the following parameters: |
content/docs/i18n.mdx
Outdated
|
||
## `locale` | ||
|
||
Allows to specify the current locale of the application. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allows to specify the current locale of the application. | |
Specifies the current locale of the application. |
content/docs/i18n.mdx
Outdated
|
||
## `translate` | ||
|
||
Allows to provide a translation function, which handles the actual translation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allows to provide a translation function, which handles the actual translation. | |
Provides a translation function handling the actual translation. |
content/docs/i18n.mdx
Outdated
/> | ||
``` | ||
|
||
The i18n prop consist of three components: `locale`, `translate` and `translateError`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The i18n prop consist of three components: `locale`, `translate` and `translateError`. | |
The `i18n` prop consists of three components: `locale`, `translate` and `translateError`. |
content/docs/i18n.mdx
Outdated
|
||
### `key` | ||
|
||
The key is used to identify the string, that needs to be translated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The key is used to identify the string, that needs to be translated. | |
The key is used to identify the string that needs to be translated. |
content/docs/i18n.mdx
Outdated
} | ||
``` | ||
|
||
Therefore the translation will be invoked with `myCustomName.label` & `myCustomName.description`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Therefore the translation will be invoked with `myCustomName.label` & `myCustomName.description`. | |
Therefore, the translation will be invoked with `myCustomName.label` & `myCustomName.description`. |
content/docs/i18n.mdx
Outdated
} | ||
``` | ||
|
||
The paths in the above example would be: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The paths in the above example would be: | |
The paths in the above example are: |
content/docs/i18n.mdx
Outdated
|
||
:::note | ||
|
||
If the `defaultMessage` is `undefined` you should also return `undefined` if you don't have a translation for the given key. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the `defaultMessage` is `undefined` you should also return `undefined` if you don't have a translation for the given key. | |
If the `defaultMessage` is `undefined`, you should also return `undefined` if there is no translation for the given key. |
content/docs/i18n.mdx
Outdated
|
||
<ValuesTable/> | ||
|
||
Schema translation provide all properties, while UI schema translations only provide the `uischema`-property. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Schema translation provide all properties, while UI schema translations only provide the `uischema`-property. | |
Schema translations provide all properties, while UI schema translations only provide the `uischema` property. |
content/docs/i18n.mdx
Outdated
|
||
If a i18n-key is provided in a `group` or `category` element, `<i18n>.label` will be used as key. | ||
If no i18n key is provided, the value of the `label`-property is used as key. | ||
In case nether a i18n-key nor a label is provided, `<property-path>.label` will be used as default key. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case nether a i18n-key nor a label is provided, `<property-path>.label` will be used as default key. | |
In case neither a i18n-key nor a label is provided, `<property-path>.label` will be used as default key. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM now, thanks for the updates!
Adds initial i18n documentation
Closes #207