diff --git a/.github/ISSUE_TEMPLATE/new_language_request.yml b/.github/ISSUE_TEMPLATE/new_language_request.yml new file mode 100644 index 0000000..3226435 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/new_language_request.yml @@ -0,0 +1,17 @@ +name: New Language +description: Submit a request for a new language to be created in Crowdin for translation. +title: "New Language" +labels: ["new-language"] +body: + - type: markdown + attributes: + value: | + To learn more about adding a new language see [here](https://github.com/andrew-codechimp/HA-Mealie#translations) + + - type: input + id: language + attributes: + label: Language + description: The language you would like to submit translations for. + validations: + required: true diff --git a/.github/workflows/crowdin-download.yaml b/.github/workflows/crowdin-download.yaml new file mode 100644 index 0000000..44e191f --- /dev/null +++ b/.github/workflows/crowdin-download.yaml @@ -0,0 +1,32 @@ +name: Crowdin download + +on: + workflow_dispatch: + schedule: + - cron: "0 6 * * *" + +permissions: write-all + +jobs: + synchronize-with-crowdin: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: crowdin action + uses: crowdin/github-action@v1 + with: + upload_sources: false + upload_translations: false + download_translations: true + localization_branch_name: crowdin + create_pull_request: true + pull_request_title: 'Update translations' + pull_request_body: 'New Crowdin translations submitted' + pull_request_base_branch_name: 'main' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} + CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} diff --git a/.github/workflows/crowdin-upload.yaml b/.github/workflows/crowdin-upload.yaml new file mode 100644 index 0000000..1a7ff11 --- /dev/null +++ b/.github/workflows/crowdin-upload.yaml @@ -0,0 +1,27 @@ +name: Crowdin upload + +on: + push: + paths: + - custom_components/mealie/translations/* + branches: [ main ] + workflow_dispatch: + +jobs: + synchronize-with-crowdin: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: crowdin action + uses: crowdin/github-action@v1 + with: + upload_sources: true + upload_translations: true + download_translations: false + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} + CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} diff --git a/README.md b/README.md index 44fa614..70659ab 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,39 @@ mealie: dinner_end: "21:00" ``` +## Translations + +You can help by adding missing translations when you are a native speaker. Or add a complete new language when there is no language file available. + +Mealie uses Crowdin to make contributing easy. + +
+Show detailed instructions + +### Changing or adding to existing language + +First register and join the translation project + +- If you don’t have a Crowdin account yet, create one at [https://crowdin.com](https://crowdin.com) +- Go to the [HA-Mealie Crowdin project page](https://crowdin.com/project/ha-mealie) +- Click Join. + +Next translate a string + +- Select the language you want to contribute to from the dashboard. +- Click Translate All. +- Find the string you want to edit, missing translation are marked red. +- Fill in or modify the translation and click Save. +- Repeat for other translations. + +GitHub will automatically pull in latest changes to translations every day and create a Pull Request. After that is reviewed by a maintainer it will be included in the next release of Mealie. + +### Adding a new language + +Create an [Issue](https://github.com/andrew-codechimp/HA-Mealie/issues/new?template=new_language_request.yml&title=New+Language) requesting a new language. We will do the necessary work to add the new translation to the integration and Crowdin site, when it's ready for you to contribute we'll comment on the issue you raised. +
+ + *** [commits-shield]: https://img.shields.io/github/commit-activity/y/andrew-codechimp/HA-Mealie.svg?style=for-the-badge diff --git a/crowdin.yml b/crowdin.yml new file mode 100644 index 0000000..e812288 --- /dev/null +++ b/crowdin.yml @@ -0,0 +1,11 @@ +"project_id_env": "CROWDIN_PROJECT_ID" +"api_token_env": "CROWDIN_PERSONAL_TOKEN" +"base_path": "." +"base_url": "https://api.crowdin.com" +"preserve_hierarchy": true +files: [ + { + "source": "/custom_components/mealie/translations/en.json", + "translation": "/custom_components/mealie/translations/%two_letters_code%.json", + } +] \ No newline at end of file