- From: Pierre Dubois via GitHub <sysbot+gh@w3.org>
- Date: Tue, 02 Nov 2021 15:34:19 +0000
- To: public-design-tokens-log@w3.org
Instead of reinventing the wheel for how to apply multilingual (known as internationalization or i18n) I suggest to upgrade the JSON format of the design token for a JSON-LD format. That way it become easier to implement multilingual need.
reference: https://www.w3.org/TR/json-ld/#string-internationalization
The following example are only limited to illustrate how JSON-LD notation can be used to express multilingual value.
Specify a default language for design token description to be French:
```json
{
"@context" : {
"@version": "1.1",
"@language": "fr",
}
"Button background": {
"value": "#777777",
"description": "La couleur de fond des boutons dans leur état normal."
}
}
```
reference: https://www.w3.org/TR/json-ld/#example-68-setting-the-default-language-of-a-json-ld-document
Specify a default language for design token description to be English but contain an alternate French description:
```json
{
"@context" : {
"@version": "1.1",
"@language": "en",
}
"Button background": {
"value": "#777777",
"description": [
{
"@value": "The background colour for buttons in their normal state."
},
{
"@value": "La couleur de fond des boutons dans leur état normal.",
"@language": "fr"
}
]
}
}
```
reference: https://www.w3.org/TR/json-ld/#example-79-using-an-expanded-form-to-set-multiple-values
Specify language by leveraging sub-property inside the description property:
```json
{
"@context" : {
"@version": "1.1",
"@language": "en",
"description": {
"@id": "https://design-tokens.github.io/community-group/format/#description",
"@container": "@language"
}
}
"Button background": {
"value": "#777777",
"description": {
"en": "The background colour for buttons in their normal state.",
"fr": "La couleur de fond des boutons dans leur état normal."
}
}
}
```
reference: https://www.w3.org/TR/json-ld/#example-71-language-map-expressing-a-property-in-three-languages
\cc @delisma @kevinmpowell
--
GitHub Notification of comment by duboisp
Please view or discuss this issue at https://github.com/design-tokens/community-group/issues/62#issuecomment-957836722 using your GitHub account
--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Tuesday, 2 November 2021 15:34:21 UTC