Skip to content
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

Add option for localisation #1

Open
jstarpl opened this issue Nov 26, 2024 · 3 comments
Open

Add option for localisation #1

jstarpl opened this issue Nov 26, 2024 · 3 comments

Comments

@jstarpl
Copy link
Member

jstarpl commented Nov 26, 2024

I think it would be great if, from the get-go, we would have an option for these strings (which are user-presentable) to be localizable. Obviously, a fallback to a simple string is neccessary, but making sure that these strings can be localized in 1.0 of this spec will mean that localization will be at least taken into account by implementers in some basic way.

"label": {
"type": "string",
"description": "The name of the action. This is displayed to the user."
},
"description": {
"type": "string",
"description": "A longer description of the action. This is displayed to the user."
},

W3C proposes this format: https://www.w3.org/TR/localizable-manifests/#language-maps for "Unitary manifests" , which I think is simple enough to use:

{
  "key": {
    "en": {"value": "Some string"}
    "fr": {"value": "Une variable de chaîne"}
  }
}

I think going for a "Unitary manifest" rather than using content negotiation at the HTTP level, makes sense since it will allow the end User Agent to make the decision which localization to use.

@nytamin
Copy link
Member

nytamin commented Nov 28, 2024

I wonder if another approach could be the "hybrid approach": https://www.w3.org/TR/localizable-manifests/#hybrid ?

We could have a default manifest.json file but also allow for additional, localized manifest files, eg manifest-sv-se.json, manifest-de.json, manifest-en.json etc..

That way it would reduce the minimal implementation needed (just ignore the additional files), and no transforms needed by the Server when serving the manifests.

@nytamin
Copy link
Member

nytamin commented Nov 28, 2024

Notes from a talk with @jstarpl:

It would probably be best to not go with the hybrid approach, and rather have all translations in the on manifest file, as this would add no requirements on the Server, and allows the Server to expose all translations in one go, putting the load of interpreting the localized data on the Controller - which should be well suited to handle this anyway.

@nytamin
Copy link
Member

nytamin commented Dec 16, 2024

Notes from talk in the HTML group.
To minimize the impact for system that don't support localization at all, it was proposed to go with the following approach:

{
  label: "This is a label", // fallback, can be used by any system that doesn't support any localization
  label-localized: { // Optional, contains localizable strings
    "en": "This is a label",
    "sv-se": "Detta är en etikett",
    "fr": "Ceci est une étiquette"
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants