Re: [w3c/manifest] [DRAFT—DO NOT MERGE/REVIEW] Add members for localization (PR #1101)

Just one data point, but as a past precedent the similar [Web of Things (WoT) Thing Description](https://www.w3.org/TR/wot-thing-description) specification landed on `titles` and `descriptions` members of [`Thing`](https://www.w3.org/TR/wot-thing-description/#thing) (each of type [`MultiLanguage`](https://www.w3.org/TR/wot-thing-description/#multilanguage)) in addition to `title` and `description` for this use case. This is the case for both Thing Description 1.0 (W3C Recommendation) and Thing Description 1.1 (Proposed Recommendation).

I personally don't like that solution because I prefer using HTTP content negotiation with an `Accept-Language` header as per the suggestion in the current Web Application Manifest Working Draft, rather than creating an extremely verbose manifest with (theoretically) up to thousands of different languages. However, as has been pointed out it's not always possible to use content negotiation (e.g. on static site hosting like GitHub Pages). The Thing Description specification therefore offers both as alternative approaches.

If consistency between W3C specifications is considered important, then `names`, `short_names` and `descriptions` would make sense. That doesn't work for `icons`, but that member is already different because it's an array of `ImageResource`s that the user agent can select from. Language could potentially just be another criteria for selecting an image.

I note that in HTML the `<link>` element has a `hreflang` attribute, so presumably `<link rel="icon" href="/icons/fr/play-later.svg" hreflang="fr">` is valid (though likely currently ignored by user agents). For the (slightly unusual) case of localising app icons, an equivalent might be to add a `lang` member to [`ImageResource`](https://www.w3.org/TR/image-resource).

Example:
```json
{
  "lang": "en",
  "dir": "ltr",
  "name": "Super Racer 3000",
  "names": {
    "fr-FR": "Super Coureur 3000",
    "es-ES": "Súper Corredor 3000"
  },
  "short_name": "Racer3K",
  "short_names": {
    "fr-FR": "Coureur3K",
    "es-ES": "Corredor3K"
  },
  "icons": [{
    "src": "icon.png",
    "sizes": "64x64",
    "type": "image/webp",
  }, {
    "src": "icon-fr.png",
    "sizes": "64x64",
    "lang": "fr-FR"
  },
  {
    "src": "icon-es.png",
    "sizes": "64x64",
    "lang": "es-ES"
  }],
  "scope": "/",
  "id": "superracer",
  "start_url": "/start.html",
  "display": "fullscreen",
  "orientation": "landscape",
  "theme_color": "aliceblue",
  "background_color": "red"
}
```

Note that `ImageResource` also has a `label` member which could then also be localised this way, if a localised accessible description of the icon is needed!

One question: How does `dir` interact with the localised members? Can it safely be derived from language? The Thing Description specification has a lot to say on that topic, which I can't say I fully understand, but they use the [Strings on the Web: Language and Direction Metadata](https://www.w3.org/TR/string-meta/) W3C Note for guidance.

Hope this helps.

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

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

Received on Tuesday, 14 November 2023 10:44:59 UTC