-
Notifications
You must be signed in to change notification settings - Fork 63
Internationalization (i18n) of human-readable TD fields #161
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
Comments
See also: w3c/wot#373 I would recommend using the same approach as the W3C Web App Manifest specification, which is to have a Thing Description use a single language at a time, with that language specified by a language member. A specific language can then be requested using content negotiation with an Including potentially hundreds of different languages in a single Thing Description could make the Thing Description very large, which is particularly problematic for embedded applications. |
I would prefer keeping multi-language container approach as an option, |
The approach mentioned by @benfrancis does not seem to prohibit having multiple content for various languages together in storage. TD with multiple language content can be stored on the server, and using the same approach described, can be filtered before being sent to the client. |
Please lets consider a TD sample using the @language map variant from JSON-LD. Mainly, in the TD we would most likely apply the multiple languages support for the terms {
"@context": ["http://www.w3.org/ns/td",
{"description": { "@id": "td:description", "@container": "@language" } },
{"label": { "@id": "td:label", "@container": "@language" } }],
"@type" : "Thing",
"id": "urn:dev:wot:com:example:servient:lamp",
"name": "MyLampThing",
"description" : {
"en" : "MyLampThing uses JSON-LD 1.1 serialization",
"ja" : "MyLampThingはJSON-LD 1.1シリアル化を使用します",
"de" : "MyLampThing verwendet JSON-LD 1.1 Serializierung"
},
"properties": {
"status": {
"description" : {
"en": "Shows the current status of the lamp (On/Off/Error).",
"ja" : "ランプの現在の状態(オン/オフ/エラー)を表示します。",
"de" : "Zeigt den aktuellen Lampenstatus an (An/Aus/Fehler)"
},
"label" : {
"en": "Lamp status",
"ja" : "ランプの状態",
"de" : "Lampenstatus"
},
"writable": false,
"observable": false,
"type": "string",
"forms": [{
"href": "coaps://mylamp.example.com/status",
"mediaType": "application/json"
}]
}
}
} Please comment on this approach. |
What I often see in i18n solutions is a way to specify a default language. Let's say what happens if the current language is neither, "en", nor "ja" or "de". Moreover, if I take a look at the JSON-LD reference you shared there are different formats also.
Nested translations compared to translations on the same level. The latter approach also answers my first question/comment given that a tag without a language postfix such as I assume both variants are possible? |
There is an example in JSON-LD 1.1 draft specification. It appears that a special key "@none" can be used to specify a default representation in a language map. Here is an excerpt. "label": { |
there need a review process by the i18n group. We will ask when we have the CR. |
Outcome of today's TD meeting:
|
JSON Schema says in https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-10.1 that @handrews, is your assumption that JSON Schemas will always use HTTP language negotiation (Accept-/Content-Language) or a proactive language negotiation, or have you not thought deeper about internationalization yet? :) While we could go down the path of language negotiation, simplifying TDs, @ToruKawaguchi advocated the uses case to allow for (a small number of) different languages directly in one TD document (which significantly reduces overhead, e.g., new TD as to be fetched when UI changes display language). The langauge-tag indexed object is a simple enough mechanism for this. @handrews Is there a possiblity that you might loosen the constraint from Sec. 10.1? An alternative could be similar to Web Linking, where there are two attributes ( |
I put this on tomorrow's agenda. |
We should also consider the aspect that the |
@mkovatsc we have definitely thought about I18N/L10N, but not thoroughly. We definitely are not relying exclusively on HTTP content negotiation as not all JSON Schemas (or even all JSON Hyper-Schemas) are accessed over HTTP. However, we generally lean more towards a solution that is orthogonal to individual fields, which is why This topic gets mentioned at json-schema-org/json-schema-spec#114, but not really discussed, and I'm having trouble finding where else this has been covered. The mention of a UI schema vocabulary in that issue is talking about using a schema to hint as to how to display the content under different languages, for example within a web page that has detected the language already through the browser's locale. That idea hasn't yet been developed further. I think the other idea that has been floated is some sort of external I18N/L10N framework that would replace tokens as a pre-processing step, as is often done with web framework templates. |
@sebastiankb you'd fail meta-schema validation, though, if anyone tried to apply that. With the formalization of vocabularies and extensions in draft-08 (the Part of the other work in draft-08 involves formalizing how to collect and use annotation values like |
The consensus appears to be to keep As also the JSON-LD talks about a "programmatically easy way to navigate the data structures for the language-specific data", I would prefer the language map (
Candidates for the language map fields/members, on which we still have to decide:
|
I like titles and descriptions |
ok, I will compile this approach into the TD spec |
as reference for the language code I will link to iso639-2 https://www.loc.gov/standards/iso639-2/php/code_list.php |
well, I just realized that ISO 639-1 is more common. JSON-LD seems also to rely on that. |
The changes look very nice! |
Based on the discussion in the TD call on 14.12.it should be considered to use the encoding defined by |
A W3C Working Group Note "Authoring HTML: Language declarations" suggests to make a reference to BCP 47 which in turn references RFC 5646. |
thanks for the update and integration. |
From the discussion at the Bundang F2F Meeting:
We should:
Accept-Language
)title*
of Web LinkingTo consider:
Way forward:
@language
mechanism from JSON-LD for the multi-language containerThe text was updated successfully, but these errors were encountered: