Re: [w3ctag/design-reviews] Serialization of natural language in data formats such as JSON [I18N] (#178)

@cynthia and I just had a breakout discussion of this.

I think one conclusion that we came to is that the option of having a lang that applies to multiple strings is a little weird, e.g., in:
```json
{
  "title": "Nice",
  "description": "Une ville française",
  "lang": "fr",
  "postcode": "06000"
}
```
it feels weird that the `"lang"` applies to both the `"title"` and the `"description"` but not the `"postcode"`.  That just doesn't feel to me like the way JSON works.  In other words, I think we lean towards the solutions that have the language information of the `"title"` to be inside the value of `"title"`.

So then given the options that we've talked about so far, I think that only leaves two options, one of which is to say that we'd require what I'll call (A):
```json
{
  "title": { "text": "Nice", "lang": "fr" },
  "description":  { "text": "Une ville française", "lang": "fr" },
  "postcode": "06000"
}
```
where only the `"text"` property would be mandatory, i.e., where you could write this (B):
```json
{
  "title": { "text": "Nice" },
  "description":  { "text": "Une ville française" },
  "postcode": "06000"
}
```
if you didn't have language information, but that would forbid (C):
```json
{
  "title": "Nice",
  "description": "Une ville française",
  "postcode": "06000"
}
```

The alternative remaining option would instead allow (C) as an equivalent to (B).

-----

@cynthia also brought up the issue of how this extends to when you have text in multiple languages.  For example:
```json
{
    "name": [ {"lang": "fr", "text": "Nice"}, {"lang": "ja", "text": "ニース"} ]
}
```
or perhaps more JSON-ish:
```json
{
    "name": { "fr": {"text": "Nice"}, "ja": { "text": "ニース"} }
}
```
although the latter doesn't allow the specific strings to be passed around without creating a new object.  But the former has slow search.

Here you'd now have to test whether the value of `"name"` is an object or an array (are those the right JSON terms?).  In theory the alternative could be to force a list, but that feels like we're going down a very different use case.

-----

So another question for the folks who raised this issue is that it might help us to have a better idea of what the range of use cases where this comes up looks like.  Are there a few representative examples we can look at to make this a little more concrete?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3ctag/design-reviews/issues/178#issuecomment-332569369

Received on Wednesday, 27 September 2017 15:57:45 UTC