dolezsa / thermal_comfort

Thermal Comfort sensor for HA (absolute humidity, heat index, dew point, thermal perception)
Other
552 stars 106 forks source link

add inlang to make the contribution of translations easier #288

Closed NilsJacobsen closed 11 months ago

NilsJacobsen commented 1 year ago

Let me know what changes you request for merging this PR.

Description

This pull request adds the possibility for contributors and translators to manage translations in a UI instead of files with no overhead for the maintainers.

To get a UI for translations contained in this repository, an inlang.config.js has been created at the root of the repository. Furthermore, the translation files have been cleaned and I added a little i18n docs on the read me. If you want this to be somewhere else please let me know.

Preview

The changes of this PR and a live instance of the editor can be previewed with the following link https://inlang.com/editor/github.com/NilsJacobsen/thermal_comfort. Note: This link should be changed to point to dolezsa instead of NilsJacobsen after this PR has been merged.

Badge

In the readme there is now a dynamic badge, which is going to show you the current status of the translations. It will work after the config is merged. You can see a demo badge rendered based on my fork.

translation badge

Limitations

Certain actions are slow Inlang is running entirely on git, giving tremendous CI/CD and contribution power to localization (and potentially other verticals -> the next git). That means that the whole thermal_comfort repo is cloned into the browser which makes certain actions like the initial load and pushing changes slow. Those limitations will be fixed with future releases and require no input from thermal_comfort.

pika-1680686287719-1x

Preview the messages on https://inlang.com/editor/github.com/NilsJacobsen/thermal_comfort.

Pyromane commented 11 months ago

Would simplify the translation significantly!

rautesamtr commented 11 months ago

Hi sorry for the long wait. Life happens. Looks good to me and thanks for the work.

rautesamtr commented 10 months ago

@NilsJacobsen Hi, i just noticed inlang is currently broken and needs to be migrated to project.inlang.json.

I tried cli migration but get some errors:

ℹ Trying a best effort migration for your old inlang configuration...                                                                              1:12:29 PM

 ERROR  (node:14859) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.                             1:12:29 PM
(Use node --trace-warnings ... to show where the warning was created)

 WARN  Could not execute the inlang configuration and falling back to line based parsing, which can be unreliable for more complex setups.          1:12:29 PM

 WARN  Could not auto migrate line 8: "    languages: await plugin.getLanguages({"                                                                  1:12:29 PM

ℹ ✅ Successfully created your inlang configuration at: ./project.inlang.json,                                                                     1:12:29 PM
please double check the result and manually fix what could not be auto-migrated, then delete the old file.

the result looks like this:

{
    "plugin.inlang.json": {
        "pathPattern": "./custom_components/thermal_comfort/translations/{language}.json"
    },
    "sourceLanguageTag": "en",
    "languageTags": [],
    "modules": [
        "https://cdn.jsdelivr.net/npm/@inlang/plugin-json@4/dist/index.js",
        "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-empty-pattern@1/dist/index.js",
        "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-identical-pattern@1/dist/index.js",
        "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-without-source@1/dist/index.js",
        "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-missing-translation@1/dist/index.js"
    ]
}

Is this good to go or does it still need some changes? It's hard to test it since inlang editor doesn't support branches.

NilsJacobsen commented 10 months ago

I manually migrated it in this PR: -> https://github.com/dolezsa/thermal_comfort/pull/311

Thanks for the feedback. You are right that feels almost like a dead end. We are going to work on it.