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

i18n: add support for translation to markets #281

Closed
wants to merge 7 commits into from

Conversation

madejackson
Copy link
Sponsor Contributor

@madejackson madejackson commented Jul 18, 2024

This PR includes translation-support for markets without breaking support for existing markets/apps without translation-fields. The PR is based on my previous PR for general Translation-Support. #273

It's basically some additional checks to the json-fields coming from markets. If there is a translation available of the specific field, it'll show the translated value. It supports staged fallback from locale (f.e. de-CH) to language (f.e. de) to default

As the official market has no translated fields as of yet, you can test it with my fork, which is translated to de and de-CH:
https://github.com/aseracorp/resiSTORE

Feel free to request changes / improvements.

The PR expects the following structure for the description and cosmos-installer:

description.json

{
  "name": "name",
  "description": "englishEnglishEnglish",
  "longDescription": "englishEnglishEnglish",
  "translation": {
    "de": {
      "description": "germanGermanGerman",
      "longDescription": "germanGermanGerman"
    }
  },
 "tags": ["tags"],
  "repository": "repo",
  "image": "image",
  "supported_architectures": ["amd64", "arm64"]
}
cosmos-compose.json:
  "cosmos-installer": {
    "form": [
      {
        "name": "useping",
        "label": "Do you want to use ping instead of mDNS?",
        "initialValue": "false",
        "type": "select",
        "options": [
          ["true", "true"],
          ["false", "false"]
        ]
      },
      {
        "name": "username",
        "label": "What should be the username?",
        "initialValue": "admin",
        "type": "text"
      },
      {
        "name": "password",
        "label": "What should be the password?",
        "initialValue": "admin",
        "type": "text"
      }
    ],
    "translation": {
      "de": {
        "form.useping.label": "Möchten Sie ping anstelle von mDNS verwenden?",
        "form.useping.options": [ ["true", "Ja"],
                                  ["false", "Nein"] ],
        "form.username.label": "Wie soll der Benutzername lauten?",
        "form.password.label": "Wie sollte das Passwort lauten?"
      }
    }
  },
- updated all trans-keys
- included support for dayjs
- all other minor change-requests
- some more keys/translations included
- fixed some wrong references
- disabled debugging (i18next)
- switched to lazy loadable backend (i18next)
- more translations
- fixed unnecessary uses of Trans-Component (now uses t-func)

If you want this commit to be squashed, send me a msg.
- include locale de-CH
- better handling of dayjs (works but WIP, see comments in code)
- include locale de-CH
- better handling of dayjs (works but WIP, see comments in code)
- official market has no translations, so to test, please use the following store:
https://github.com/aseracorp/resiSTORE
Copy link

cla-bot bot commented Jul 18, 2024

We require contributors to sign our Contributor License Agreement. In order for us to review and merge your code, add yourself to the .clabot file as contributor, as a way of signing the CLA.

@madejackson madejackson closed this Aug 5, 2024
@madejackson
Copy link
Sponsor Contributor Author

Will be reopened against unstable

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