w3c / manifest

Manifest for web apps
https://www.w3.org/TR/appmanifest/
Other
653 stars 159 forks source link

No way to localize icons? #1077

Open aphillips opened 1 year ago

aphillips commented 1 year ago

Declaring multiple icons https://w3c.github.io/manifest/#declaring-multiple-icons

In the following example, the developer has made the following choices about the icons associated with the web application (etc.)

There are ways to include multiple icons with different sizes, but there is no way to indicate when these should be used with specific locales, such as when the icon contains localizable text or when there are regional variations in the icon.

valioDOTch commented 1 year ago

Wouldn't it make more sense to serve a localized manifest based on the clients preferred language, that would also provide the corresponding "lang" attribute in the manifest?

aphillips commented 1 year ago

Serving a correctly localized manifest certainly makes sense, but this can be a little complicated. If the manifest files are not generated dynamically but instead use path or file-naming to separate them, an application might choose to bundle a number of related locales together with locally variant icons. For example:

"lang": "fr",
"dir": "ltr",
"name": "une application",
"icons":  [
    {
        "lang": "fr-FR",
        "comment": "a bit of bleu-blanc-rouge",
        "src": "icon-for-france.jpg"
    },
    {
        "lang": "fr-CH",
        "comment": "red with a little white +",
        "src": "icon-for-suisse.jpg"
    },
    {
        "comment": "no special flag-related motif",
        "src": "default-french-icon.jpg"
    }
]
christianliebel commented 4 weeks ago

1101 would introduce a way to localize icons:

{
  "lang": "en-US",
  "icons": [
    { "src": "icon/lowres.png", "sizes": "64x64" },
    { "src": "icon/hires.png", "sizes": "256x256" }
  ],
  "icons_localized": {
    "fr": [
      { "src": "icon/lowres_fr.png", "sizes": "64x64" },
      { "src": "icon/hires_fr.png", "sizes": "256x256" }
    ]
  }
}