Re: [w3c/manifest] Add members for localization (PR #1101)

@christianliebel commented on this pull request.



> +              `lang` (optional)
+            </dt>
+            <dd>
+              A [=language tag=].
+            </dd>
+            <dt>
+              `dir` (optional)
+            </dt>
+            <dd>
+              The [=text-direction=].
+            </dd>
+          </dl>
+          <p>
+            When a plain [=string=] is used, or when the `lang` or `dir`
+            members are omitted, `lang` falls back the [=language tag=] of the
+            [=language map=] key, and `dir` falls back to the [=manifest/dir=]

@jcayzac @marcoscaceres This is needed in (probably rare) cases where you want the value in language A applied to locale B, for example, so that assistive technology can use the right voice for pronunciation.

I think a good example is if a brand is localized differently across countries ([actual example for such a brand](https://en.wikipedia.org/wiki/Just_Eat_Takeaway.com#Operations)):

```json
{
  "name": "Thuisbezorgd.nl",
  "lang": "nl-NL",
  "name_localized": {
    "de-DE": "Lieferando",
    "de-CH": { "lang": "en", "value": "Just eat" },
    "ro": { "lang": "en", "value": "Takeaway.com" }
  }
}
```

Or if you have a bilingual app and want to offer a “change language” shortcut in the target language:

```json
"name_localized": {
  "en": { "lang": "fr", "value": "Changer de langue" },
  "fr": { "lang": "en", "value": "Change language" }
}
```

This is why
1. we need a language map with a language tag key
1. the "lang" attribute, if not specified, must fall back to the language tag specified in the key

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/manifest/pull/1101#discussion_r1676783850
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/manifest/pull/1101/review/2176190885@github.com>

Received on Saturday, 13 July 2024 08:16:15 UTC