TiddlyWiki / TiddlyWiki5

A self-contained JavaScript wiki for the browser, Node.js, AWS Lambda etc.
https://tiddlywiki.com/
Other
7.98k stars 1.18k forks source link

[IDEA] Allow plugin.info to have translations #8173

Open linonetwo opened 4 months ago

linonetwo commented 4 months ago

Is your feature request related to a problem? Please describe.

translate plugin name and description when they are not installed yet

Discussed on feat: t macro and docs https://github.com/Jermolene/TiddlyWiki5/pull/7821#issuecomment-1974850177

Describe the solution you'd like

plugin.info is a JSON (I'm not sure what it become after install, but should be a JSON tiddler too?), so instead of use field like name::fr-FR, we should use

{
  name: 'default name',
  languages: {
    zh-Hans: '中文名',
    fr-FR: 'xxx',
  }
}

Describe alternatives you've considered

I'm afraid flatten field like name::fr-FR will make a long list and difficult to maintain.

Additional context

Make everything fully international.

Jermolene commented 4 months ago

Hi @linonetwo the contents of plugin.info is flattened into tiddler fields as plugins are loaded, which implies that the language processing would have to be done as the plugin was constructed under Node.js. So, I think it would be more useful if the available translations were all retained so that the single file configuration of TiddlyWiki could also choose the best language to use.

linonetwo commented 3 weeks ago

How about use JSON-LD standard like

{
 "description": [{
      "@value": "A public university focusing on teaching examples.",
      "@language": "en"
    }, {
      "@value": "Une université publique axée sur l'enseignement d'exemples.",
      "@language": "fr"
    }, {
      "@value": ".جامعة عامة تركز على أمثلة التدريس",
      "@language": "ar",
      "@direction": "rtl"
    }]
}

https://w3c.github.io/vc-data-model/#example-usage-of-the-name-and-description-property-0

Jermolene commented 3 weeks ago

Hi @linonetwo the trouble with that approach is that it doesn't fit well with TiddlyWiki's idea of a flat collection of fields; the same issues arise as discussed above.

A more TiddlyWikiesque approach might be:

description@en: A public university focusing on teaching examples.
description@fr: Une université publique axée sur l'enseignement d'exemples.
description@ar@rtl: .جامعة عامة تركز على أمثلة التدريس