Coder Social home page Coder Social logo

crowdin / github-action Goto Github PK

View Code? Open in Web Editor NEW
138.0 138.0 46.0 213 KB

A GitHub action to manage and synchronize localization resources with your Crowdin project

Home Page: https://crowdin.com

License: MIT License

Dockerfile 1.14% Shell 98.86%
github-action github-actions hacktoberfest localization sync translate

github-action's People

Contributors

andrii-bodnar avatar andrulko avatar bartlebyy avatar blairbodnar avatar conconnl avatar dreigada avatar dy-dx avatar dzonatan avatar fernandogelin avatar ffflorian avatar j4hr3n avatar johnan avatar jsoref avatar justarchi avatar mjacobus avatar mrchrisw avatar nukecraft5419 avatar randymarsh77 avatar rohalskyy avatar szpadel avatar tinogo avatar ultr4nerd avatar unlikemars avatar vbeytok avatar vonovak avatar zeke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

github-action's Issues

PR not created

Describe the bug

The PR is not created. In the action log, we can see:

# (...)
CONFIGURATION GIT USER
Switched to a new branch 'wip-translations-update'
PUSH TO BRANCH wip-translations-update
[wip-translations-update ba2445a] New Crowdin translations by Github Action
 1 file changed, 329 insertions(+)
 create mode 100644 nxdrive/data/i18n/i18n-eu.json
To https://github.com/nuxeo/nuxeo-drive.git
 + b009082...ba2445a wip-translations-update -> wip-translations-update (forced update)
CHECK IF ISSET SAME PULL REQUEST
CREATE PULL REQUEST
{
  "message": "Validation Failed",
  "errors": [
    {
      "resource": "PullRequest",
      "field": "base",
      "code": "invalid"
    }
  ],
  "documentation_url": "https://developer.github.com/v3/pulls/#create-a-pull-request"
}

See full logs.

The same action was working several day before: no code changes have been made either to the crowdin.yml file nor to the GitHub token.

To Reproduce

  1. Crowdin Github Action configuration
  2. crowdin.yml file content

Expected behavior

The PR should be created.

Missing option for configuration

We have multiple projects in crowdin that support different languages, and therefore have two configuration files.

So if you could adjust

upload_sources() {
  echo "UPLOAD SOURCES";
  crowdin upload sources ${CONFIG_OPTIONS} ${OPTIONS};
}

upload_translations() {
  echo "UPLOAD TRANSLATIONS";
  crowdin upload translations ${CONFIG_OPTIONS} ${OPTIONS};
}

to

upload_sources() {
  echo "UPLOAD SOURCES";
  crowdin ${FOO} upload sources ${CONFIG_OPTIONS} ${OPTIONS};
}

upload_translations() {
  echo "UPLOAD TRANSLATIONS";
  crowdin ${FOO} upload translations ${CONFIG_OPTIONS} ${OPTIONS};
}

So that I can do FOO="-c crowdin-booking.yml" or FOO="-c crowdin.yml"

Work with docusaurus

Hi guys, thanks for your job.
I encountered a problem when using this action.
I want to automatically deploy a website using docusaurus with translations. But I got no translations.

github actions

name: Node.js CI

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  deploy:

    env:
      GH_EMAIL: ${{ secrets.GH_EMAIL }}
      GH_NAME: ${{ secrets.GH_NAME }}
      GH_TOKEN: ${{ secrets.GH_TOKEN }}
      GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [ 12.x ]
        # See supported Node.js release schedule at https://nodejs.org/en/about/releases/

    steps:
      - uses: actions/checkout@v2
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v2
        with:
          node-version: ${{ matrix.node-version }}

      - run: git config --global user.name "${GH_NAME}"
      - run: git config --global user.email "${GH_EMAIL}"
      - run: cd website && yarn install && yarn run write-translations && cd ..

      - name: crowdin action
        uses: crowdin/[email protected]
        env:
          CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
          CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
        with:
          upload_sources: true
          download_translations: true
          config: ./crowdin_gh.yaml

      - run: echo "machine github.com login ${GH_NAME} password ${GH_TOKEN}" > ~/.netrc
      - run: cd website && yarn install && GIT_USER="${GH_NAME}" yarn run publish-gh-pages

crowdin.yaml

project_id_env: CROWDIN_PROJECT_ID
api_token_env: CROWDIN_PERSONAL_TOKEN

base_path: "./"
preserve_hierarchy: true

files:
  -
    source: '/docs/*.md'
    translation: '/website/translated_docs/%locale%/%original_file_name%'
    languages_mapping: &anchor
      locale:
        'zh-CN': 'zh-CN'
        'ko': 'ko'
  -
    source: '/website/i18n/en.json'
    translation: '/website/i18n/%locale%.json'
    languages_mapping: *anchor

log output https://github.com/casbin/casbin-website/runs/1916829410?check_suite_focus=true
Thanks!

crowdin.yml security

Describe the bug
Testing this action, I got repeated errors that my api_token and project_id were missing from crowdin.yml. So I added them, & everything worked. But... The api_token and project_id are exposed when you do that. I tried using GitHub secrets to hide them, but crowdin wasn't very happy with that...

See also #55 and #45

Expected behavior
I expected to be able to hide the api_token and project_id when the crowdin.yml file is up on github. OR... Operate a github action without having a crowdin.yml at all.

Additional context
If there is a way to do an action with NO crowdin.yml, that would be great. But then we need to be able to use placeholders within the github action, and become dependent on #45 .

Need more flexibility with placeholders

Describe the bug
Our translated files are in the same folder, e.g.,

/yada/yada/languages/admin.english.php
/yada/yada/languages/admin.dutch.php

Specifying the following in crowdin.yml gets us very close:

"source" : "/yada/yada/languages/*.english.php",
"translation" : "/yada/yada/languages/%file_name%.%language%.php",

But our output ends up looking like:

/yada/yada/languages/admin.english.dutch.php

We need to be able to be able to strip the '.english' part out of the translated file name.

I couldn't find a way to do this - is it feasible?

See also #45

Remove a Crowdin branch with the action

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

We want to create a Crowdin branch for each pull request. When the translation is done, we'll pull it, run the tests, and, finally, merge the pull request. Now it's time to remove the Crowdin branch. It would be nice to do so with this action.

Describe the solution you'd like
A configuration option to remove a named Crowdin branch or branches.

Describe alternatives you've considered

  • manually removing branches — not acceptable
  • using CLI for this particular task — requires making a custom Docker image, too much work for a single use
  • dropping the action and running everything directly from the CLI

Difference between `localization_branch_name` and `crowdin_branch_name`

In the README I see localization_branch_name and crowdin_branch_name options, but don't know exactly what they mean. Here are my assumptions:

  • localization_branch_name is the name of the git branch that Crowdin will create when opening a pull request.
  • crowdin_branch_name is the name of the top-level directory that Crowdin will use for files.
  • Neither of these branches need to be manually created. They will be created automatically by the Action.

Are those assumptions correct? Once I know for sure I can open a PR to clarify the documentation.

[Bug Report]: Language 'eo' doesn't exist in the project

Describe the bug
When trying to download eo lang, action fails with

Language 'eo' doesn't exist in the project. Try specifying another language code

This worked in 1.0.6. Also tried eo-UY as language with same results

To Reproduce

- name: Download eo-UY
      uses: crowdin/[email protected]
      with:
        config: crowdin.yml
        upload_sources: false
        download_translations: true
        push_translations: false
        export_only_approved: true
        download_language: eo
        localization_branch_name: ${{ env.LOCAL_BRANCH }}
        crowdin_branch_name: ${{ env.CROWDIN_BRANCH }}

Expected behavior
Download translations for eo

No icon in the agency intelligence module on the pricing page

Describe the bug
On the pricing page, in the agency intelligence module, there is no icon for the part “dedicated account manager” to see on which level it’s included (see picture)

To Reproduce
Steps to reproduce the behavior:

  1. Crowdin Github Action configuration
  2. crowdin.yml file content
  3. Information about workflow (OS, steps, etc.)

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.
Capture d’écran 2021-10-29 à 15 12 05

R.swift support for the PR creation

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

Whenever there are new strings, CrowdIn GitHub Action opens a new PR, which is awesome. Our project is using R.swift, which auto-gen a Swift file called R.generated.swift. String assets and the auto-gen file should be always synced, otherwise we can not access to the new string via R.swift.

The PR created via CrowdIn Action contains new strings, but it does not update R.generated.swift. If we merge the PR, then main branch will have R.generated.swift out of sync. This broken sync will be resolved in the next PR, which is actually not relevant at all to the PR :(

Describe the solution you'd like

Whenever CrowdIn Action creates a PR, it should contain new or updated strings for sure, AND it should update R.generated.swift in there too, so that we can merge the PR without any broken sync between assets and the auto-gen file.

There are a couple of codegen lib for strongly typed string assets, so it would be great if we can cover them, too, but what I need now is R.swift support, so if we can prioritize R.swift support first, it'd be really cool!

Describe alternatives you've considered

As I described above, we can just merge the PR with new and updated strings only, and then next PR will resolve the "out-of-sync" state. This technically works, but having main branch in a unstable state for a while is something we should avoid.

Additional context

I heard that CrowdIn iOS SDK also uses R.swift, so... you guys already know this problem? (or solution already? :D )

GitHub action adds "/" to translation

Describe the bug
If you have a simple translation with a placeholder in crowdin.yml, e.g.:
translation: "Admin.%language%.php",

What ends up in the Translations export field in CrowdIn is:
/Admin.%language%.php

The problem is that added "/" at the beginning of the string disrupts the normal build/download function in CrowdIn. Without the "/", you get each language in its own folder, and the file hierarchy is preserved - as expected. With that added "/", however, all languages are in one folder, and it is flat. It is overriding the preserve_hierarchy setting somehow.

Current crowdin.yml I'm using for testing is:
https://github.com/sbulen/crowdin_test/blob/1d0e8cb1784fd90c2d630c0683070c4f93d39100/crowdin.yml#L22

Expected behavior
I want the translation spec to be exactly what I pass - no added "/". That way, the normal build/download will work as expected.

Screenshots
When the translation field looks like this:
image

The build/download looks as expected:
image

But when the GitHub action has added the "/" to the translation field:
image

The build/download gets flattened out, and no longer honors one folder per language:
image

Additional context
We have an uneven hierarchy - translated files are two different locations.

Does the upload_sources command also *update* source files?

I would like to achieve 4 things using GitHub Actions:

  1. Update source message files
  2. Push source files to Crowdin
  3. Build project on Crowdin
  4. Pull translations from Crowdin

I see I can achieve 2. and 4. using the upload _sources and download_translationsoptions. But I was wondering if upload_sources also updates source files if they have changes?

Is there also a way to trigger building the project translations using this action? Or will I have to create my own action for that?

Sorry I wasn't sure where else to ask these questions! Thanks heaps.

Download all translations as zip folder

I'm not sure if that is possible what I try to achieve.
I have this configuration,

- name: crowdin task
        uses: crowdin/[email protected]
        with:
          download_translations: true
          push_translations: false
          create_pull_request: true
          config: 'crowdin.yml'
        env:
          CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
          CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}

but it doesn't raise a pull request? I'm looking forward to download all translations and get a pull request that adds a zip file to the project, is that possible?

Additional arguments for pull/push commands

I'm in the need of --all argument for download command.
The new option download_translations_all: true seems like would be enough, for now.

But I'm thinking that adding all these options one-by-one just to reflect the crowdin-cli isn't very optimal.
Perhaps, this could be simplified just by adding an option to provide any argument you want, for example:
download_additional_args: '--all'

This would be both more flexible and less dependent on breaking changes of the corwdin-cli itself.

EDIT: I'm willing to work on the PR. Just let me know which approach you prefer.

Multiple languages added to one branch and untranslated files not being skipped

Hi there!

I have added the following workflow to my project, everything seems to be working okay except that on some branches translations for multiple languages are included (I'm aiming to only have one language per branch). Here is an example PR of what is happening. It is also including untranslated files when I have set the skip_untranslated_files option to true. Can someone please shed some light on where I've gone wrong? Thanks! 😄

name: Synchronise with Crowdin

on:
  push:
    branches:
      - crowdin-github-action

env:
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
  CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}

jobs:
  synchronise-with-crowdin:
    runs-on: ubuntu-latest

    steps:
    - name: Checkout
      uses: actions/checkout@v2
    
    - name: Upload or update source files to Crowdin
      uses: crowdin/[email protected]
      with:
        upload_sources: true

    - name: Download Chinese (simplified) translations
      uses: crowdin/[email protected]
      with:
        upload_sources: false
        download_translations: true
        download_language: 'zh-CN'
        skip_untranslated_files: true
        export_only_approved: true
        push_translations: true
        commit_message: 'Update Chinese (simplified) Crowdin translations by Github Action'
        localization_branch_name: translation-zh-cn
        create_pull_request: true
        pull_request_title: 'Update Chinese (simplified) language translations'
        pull_request_body: 'This pull request will add/update Chinese (simplified) language files from Crowdin.'
        pull_request_labels: 'internationalization'
        pull_request_base_branch_name: develop
        config: crowdin.yaml

    - name: Download French translations
      uses: crowdin/[email protected]
      with:
        upload_sources: false
        download_translations: true
        download_language: 'fr'
        skip_untranslated_files: true
        export_only_approved: true
        push_translations: true
        commit_message: 'Update French Crowdin translations by Github Action'
        localization_branch_name: translation-fr
        create_pull_request: true
        pull_request_title: 'Update French language translations'
        pull_request_body: 'This pull request will add/update French language files from Crowdin.'
        pull_request_labels: 'internationalization'
        pull_request_base_branch_name: develop
        config: crowdin.yaml

    - name: Download German translations
      uses: crowdin/[email protected]
      with:
        upload_sources: false
        download_translations: true
        download_language: 'de'
        skip_untranslated_files: true
        export_only_approved: true
        push_translations: true
        commit_message: 'Update German Crowdin translations by Github Action'
        localization_branch_name: translation-de
        create_pull_request: true
        pull_request_title: 'Update German language translations'
        pull_request_body: 'This pull request will add/update German language files from Crowdin.'
        pull_request_labels: 'internationalization'
        pull_request_base_branch_name: develop
        config: crowdin.yaml

    - name: Download Indonesian translations
      uses: crowdin/[email protected]
      with:
        upload_sources: false
        download_translations: true
        download_language: 'id'
        skip_untranslated_files: true
        export_only_approved: true
        push_translations: true
        commit_message: 'Update Indonesian Crowdin translations by Github Action'
        localization_branch_name: translation-id
        create_pull_request: true
        pull_request_title: 'Update Indonesian language translations'
        pull_request_body: 'This pull request will add/update Indonesian language files from Crowdin.'
        pull_request_labels: 'internationalization'
        pull_request_base_branch_name: develop
        config: crowdin.yaml

    - name: Download Italian translations
      uses: crowdin/[email protected]
      with:
        upload_sources: false
        download_translations: true
        download_language: 'it'
        skip_untranslated_files: true
        export_only_approved: true
        push_translations: true
        commit_message: 'Update Italian Crowdin translations by Github Action'
        localization_branch_name: translation-it
        create_pull_request: true
        pull_request_title: 'Update Italian language translations'
        pull_request_body: 'This pull request will add/update Italian language files from Crowdin.'
        pull_request_labels: 'internationalization'
        pull_request_base_branch_name: develop
        config: crowdin.yaml

    - name: Download Te Reo Māori translations
      uses: crowdin/[email protected]
      with:
        upload_sources: false
        download_translations: true
        download_language: 'mi'
        skip_untranslated_files: true
        export_only_approved: true
        push_translations: true
        commit_message: 'Update Te Reo Māori Crowdin translations by Github Action'
        localization_branch_name: translation-mi
        create_pull_request: true
        pull_request_title: 'Update Te Reo Māori language translations'
        pull_request_body: 'This pull request will add/update Te Reo Māori language files from Crowdin.'
        pull_request_labels: 'internationalization'
        pull_request_base_branch_name: develop
        config: crowdin.yaml

    - name: Download Turkish translations
      uses: crowdin/[email protected]
      with:
        upload_sources: false
        download_translations: true
        download_language: 'tr'
        skip_untranslated_files: true
        export_only_approved: true
        push_translations: true
        commit_message: 'Update Turkish Crowdin translations by Github Action'
        localization_branch_name: translation-tr
        create_pull_request: true
        pull_request_title: 'Update Turkish language translations'
        pull_request_body: 'This pull request will add/update Turkish language files from Crowdin.'
        pull_request_labels: 'internationalization'
        pull_request_base_branch_name: develop
        config: crowdin.yaml

Subsequent pushes to existing PR/branch lead to stuck PR actions

Describe the bug
When a fresh PR/branch is created by the action it seems to use the provided GITHUB_TOKEN so the owner of the token is displayed as creator of the PR. When an update to this PR is pushed from the action it seems it uses the default github.token and github-actions is the creator of the push. This seems to not allow to run other actions on the updated PR (I suspect to prevent infinite loops). Here's an example: wireapp/wire-webapp#9696.

To Reproduce
Steps to reproduce the behavior:

  1. Change the translations files in order to create a new PR/branch with the action (creator will be otto-the-bot and other actions are running through)
  2. Add another change and trigger the action (push is created by github-actions)
  3. Other actions running on this PR are stuck and never complete.

Expected behavior
Subsequent pushes are created from otto-the-bot instead of github-actions

Ability to compare old strings with the newly added strings and get only the newly added ones

Is your feature request related to a problem? Please describe.
Hi Team. I'm working on a github action that pushes the en.json file to crowdin when someone pushes changes to that file.

Describe the solution you'd like
Once those changes are pushed to crowdin, I want to retrieve only the keys that are newly added by that particular GitHub action. Is there a way to achieve this right now? I checked the docs and couldn't find anything similar to my use case.

Describe alternatives you've considered
NIL

Additional context
I would love to hear any suggestions that can help me with this. Thanks :)

Add `download_sources` option

Problem
I'm trying to implement workflow, where Crowdin and not the repo is the source of truth both for source strings and translations.
It would go like this:

  1. Developer adds new string using Crowdin UI
  2. Crowdin GitHub action in the translations repo is triggered by cron, adds a new string to repo, opens PR
  3. PR is auto-merged to main branch
  4. Sources from the main branch are used to build TypeScript typing packages and pushed to our registry

But when I add a new string to a source file using Crowdin UI and then GitHub action from (2) triggers, it removes new string from Crowdin instead of adding it to the repo.
I couldn't find an option to download source files from Crowdin, but it exists in Crowdin CLI.

Solution I'd like
It would be convenient and also seems pretty logical and easy to add a download_sources option symmetric to upload_sources. The default value would be false, so it won't surprise or break existing integrations.

I'm not sure if this option would be useful for most Crowdin Action users, but it sure won't harm anyone being off by default, nor would it add much complexity to the action code.

Alternatives I've considered
I could change workflow, but it would harm developer experience, because when developer adds a new string by commiting to repo, he or she would also need to go to UI to add context, screenshot, translations for his/her native languages and so on. So, it seems to me that starting the process from Crowdin UI would be more straightforward.
I also could use Crowdin CLI directly, but I like using this action 😃

I'm glad to send PR if that helps in any way.

setting skip_untranslated_strings as true, still downloads untranslated strings in all languages

Describe the bug
A clear and concise description of what the bug is.

Regarding this
#97

I am using the github action for crowdin, more details in the issue above

and what I am seeing is for my non english languages files, it still downloads english strings for non english files, even when I have set skip_untranslated_strings as true

Please help as I don't want English strings in non english files 🙇

To Reproduce
Steps to reproduce the behavior:

  1. Crowdin Github Action configuration
  2. crowdin.yml file content
jobs:
  crowdin_download_translation_strings:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: crowdin action - download translations
        uses: crowdin/[email protected]
        with:
          # set upload sources as explicitly false
          upload_sources: false
          # download translations options
          download_translations: true
          localization_branch_name: chore/l10n_crowdin_action
          skip_untranslated_strings: true
          create_pull_request: true
          pull_request_title: '[Automated] New Crowdin translations'
          pull_request_body: 'New Crowdin pull request with translations'
          pull_request_labels: 'translation, automated'
          pull_request_base_branch_name: develop
          # configuration file path
          config: './crowdin.yml'
          # project ID and token
          project_id: ${{ secrets.CROWDIN_PROJECT_ID }}
          token: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
          CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
          ```
3. Information about workflow (OS, steps, etc.)

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

Run crowdin/[email protected]
with:
upload_sources: false
download_translations: true
localization_branch_name: chore/l10n_crowdin_action
skip_untranslated_strings: true
create_pull_request: true
pull_request_title: [Automated] New Crowdin translations
pull_request_body: New Crowdin pull request with translations
pull_request_labels: translation, automated
pull_request_base_branch_name: develop
config: ./crowdin.yml
project_id: ***
token: ***
upload_translations: false
auto_approve_imported: false
import_eq_suggestions: false
skip_untranslated_files: false
export_only_approved: false
push_translations: true
commit_message: New Crowdin translations by Github Action
dryrun_action: false
github_base_url: github.com
github_user_name: Crowdin Bot
github_user_email: [email protected]
env:
GITHUB_TOKEN: ***
CROWDIN_PROJECT_ID: ***
CROWDIN_PERSONAL_TOKEN: ***
/usr/bin/docker run --name f884201ea8477860a4479c9af6e7c8a0f346de_f808f4 --label f88420 --workdir /github/workspace --rm -e GITHUB_TOKEN -e CROWDIN_PROJECT_ID -e CROWDIN_PERSONAL_TOKEN -e INPUT_UPLOAD_SOURCES -e INPUT_DOWNLOAD_TRANSLATIONS -e INPUT_LOCALIZATION_BRANCH_NAME -e INPUT_SKIP_UNTRANSLATED_STRINGS -e INPUT_CREATE_PULL_REQUEST -e INPUT_PULL_REQUEST_TITLE -e INPUT_PULL_REQUEST_BODY -e INPUT_PULL_REQUEST_LABELS -e INPUT_PULL_REQUEST_BASE_BRANCH_NAME -e INPUT_CONFIG -e INPUT_PROJECT_ID -e INPUT_TOKEN -e INPUT_UPLOAD_SOURCES_ARGS -e INPUT_UPLOAD_TRANSLATIONS -e INPUT_UPLOAD_LANGUAGE -e INPUT_AUTO_APPROVE_IMPORTED -e INPUT_IMPORT_EQ_SUGGESTIONS -e INPUT_UPLOAD_TRANSLATIONS_ARGS -e INPUT_DOWNLOAD_LANGUAGE -e INPUT_SKIP_UNTRANSLATED_FILES -e INPUT_EXPORT_ONLY_APPROVED -e INPUT_PUSH_TRANSLATIONS -e INPUT_COMMIT_MESSAGE -e INPUT_DOWNLOAD_TRANSLATIONS_ARGS -e INPUT_ADD_CROWDIN_BRANCH -e INPUT_NEW_BRANCH_TITLE -e INPUT_NEW_BRANCH_EXPORT_PATTERN -e INPUT_NEW_BRANCH_PRIORITY -e INPUT_DELETE_CROWDIN_BRANCH -e INPUT_CROWDIN_BRANCH_NAME -e INPUT_IDENTITY -e INPUT_DRYRUN_ACTION -e INPUT_GITHUB_BASE_URL -e INPUT_GITHUB_API_BASE_URL -e INPUT_GITHUB_USER_NAME -e INPUT_GITHUB_USER_EMAIL -e INPUT_GPG_PRIVATE_KEY -e INPUT_BASE_URL -e INPUT_BASE_PATH -e INPUT_SOURCE -e INPUT_TRANSLATION -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_RUN_ATTEMPT -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_NAME -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/wallet-android/wallet-android":"/github/workspace" f88420:1ea8477860a4479c9af6e7c8a0f346de
STARTING CROWDIN ACTION
DOWNLOAD TRANSLATIONS
✔️ Fetching project info
✔️ Building ZIP archive with the latest translations
✔️ Building translation (100%)
✔️ Downloading translation
✔️ Extracting archive
✔️ Extracted: 'app/src/main/res/values-ar/strings.xml'
✔️ Extracted: 'app/src/main/res/values-bg/strings.xml'
✔️ Extracted: 'app/src/main/res/values-ca/strings.xml'
✔️ Extracted: 'app/src/main/res/values-cs/strings.xml'
✔️ Extracted: 'app/src/main/res/values-de/strings.xml'
✔️ Extracted: 'app/src/main/res/values-es/strings.xml'
✔️ Extracted: 'app/src/main/res/values-fa/strings.xml'
✔️ Extracted: 'app/src/main/res/values-fr/strings.xml'
✔️ Extracted: 'app/src/main/res/values-hi/strings.xml'
✔️ Extracted: 'app/src/main/res/values-id/strings.xml'
✔️ Extracted: 'app/src/main/res/values-it/strings.xml'
✔️ Extracted: 'app/src/main/res/values-ja/strings.xml'
✔️ Extracted: 'app/src/main/res/values-ko/strings.xml'
✔️ Extracted: 'app/src/main/res/values-nl/strings.xml'
✔️ Extracted: 'app/src/main/res/values-pl/strings.xml'
✔️ Extracted: 'app/src/main/res/values-pt/strings.xml'
✔️ Extracted: 'app/src/main/res/values-ru/strings.xml'
✔️ Extracted: 'app/src/main/res/values-sv/strings.xml'
✔️ Extracted: 'app/src/main/res/values-th/strings.xml'
✔️ Extracted: 'app/src/main/res/values-tr/strings.xml'
✔️ Extracted: 'app/src/main/res/values-vi/strings.xml'
✔️ Extracted: 'app/src/main/res/values-zh-rHK/strings.xml'
✔️ Extracted: 'app/src/main/res/values-zh/strings.xml'
⚠️ Downloaded translations don't match the current project configuration. The translations for the following sources will be omitted (use --verbose to get the list of the omitted translations):
- New wallet app App store description [339 words] (1).txt (23)
- [bitcoin-portal.wallet-android] develop/app/src/main/res/values/strings.xml (23)
- App Store Images.csv (23)
- [bitcoin-portal.wallet-ios] trunk/BitcoinComWallet/Assets/Languages/en.lproj/Localizable.strings (23)

╭──────────────────────────────────────────────────────────────────────────────╮
│ New version of Crowdin CLI is available! 3.7.0 -> 3.7.1 │
├──────────────────────────────────────────────────────────────────────────────┤
│ Changelog: https://github.com/crowdin/crowdin-cli/releases/latest
│ Please update for the best experience! │
╰──────────────────────────────────────────────────────────────────────────────╯
CONFIGURATION GIT USER
M app/src/main/res/values-ar/strings.xml
Already on 'master'
M app/src/main/res/values-bg/strings.xml
M app/src/main/res/values-ca/strings.xml
M app/src/main/res/values-cs/strings.xml
M app/src/main/res/values-de/strings.xml
M app/src/main/res/values-es/strings.xml
M app/src/main/res/values-fa/strings.xml
M app/src/main/res/values-fr/strings.xml
M app/src/main/res/values-hi/strings.xml
M app/src/main/res/values-id/strings.xml
M app/src/main/res/values-it/strings.xml
M app/src/main/res/values-ja/strings.xml
M app/src/main/res/values-ko/strings.xml
M app/src/main/res/values-nl/strings.xml
M app/src/main/res/values-pl/strings.xml
M app/src/main/res/values-pt/strings.xml
M app/src/main/res/values-ru/strings.xml
M app/src/main/res/values-sv/strings.xml
M app/src/main/res/values-th/strings.xml
M app/src/main/res/values-tr/strings.xml
M app/src/main/res/values-vi/strings.xml
M app/src/main/res/values-zh-rHK/strings.xml
M app/src/main/res/values-zh/strings.xml
Your branch is up to date with 'origin/master'.
Switched to a new branch 'chore/l10n_crowdin_action'
PUSH TO BRANCH chore/l10n_crowdin_action
[chore/l10n_crowdin_action fbc44fe] New Crowdin translations by Github Action
23 files changed, 619 insertions(+), 3 deletions(-)
To https://github.com/bitcoin-portal/wallet-android.git

  • 6fa7c59...fbc44fe chore/l10n_crowdin_action -> chore/l10n_crowdin_action (forced update)
    CHECK IF ISSET SAME PULL REQUEST
    CREATE PULL REQUEST
    ADD LABELS TO PULL REQUEST
    {
    "message": "Not Found",
    "documentation_url": "https://docs.github.com/rest/reference/issues#update-an-issue"
    }
    PULL REQUEST CREATED: null

**Additional context**
Add any other context about the problem here.

Add @all-contributors bot

https://allcontributors.org is a specification and a set of tools for acknowledging contributions to a project. There's also an @all-contributors bot which can be installed on the repo as a GitHub app, which makes it easy to add contributors with a simple comment in an issue or PR:

image

Here's an example of the output that's add to the README by the bot: https://github.com/docs/liquid#contributors-

image

Here's a cheatsheet of all the contribution types: https://allcontributors.org/docs/en/emoji-key

Setting this up is pretty easy. If you're open to adding this to project, here are the docs: https://allcontributors.org/docs/en/bot/installation

CGHA features not supported on CrowdIn site

Is your feature request related to a problem? Please describe.
I would like the crowdin.yml specs to be completely honored throughout CrowdIn - including when you use the CrowdIn site to perform builds & downloads. There are at least 2 features that are not honored, or, cause issues when performing builds/downloads on CrowdIn.com:

  • wildcards
  • translation_replace

When you use wildcards, multiple issues occur. First, since we have 'english' in the source file names, it gets included on the download. E.g., "Admin.english.php" as a source becomes "Admin.english.dutch.php" post translation. The second issue is that the translation spec, if it has any path information in it at all, flattens out the directory structure & puts all languages in one big folder (see also #58 for screenshots).

When you use translation_replace to fix the english.dutch to dutch problem, that works fine throughout CGHA & CLI, but not when you do builds & downloads on the CrowdIn site.

Describe the solution you'd like
I would like to use wildcards in my CGHA, and have that honored when I do builds & downloads on CrowdIn.

Describe alternatives you've considered
It feels like once you've gone in on CLI/CGHA, you're all in, and using build/download on CrowdIn won't work... You need to do file manipulation via the API to get it all to tie together.

Today, I can get around these problems by (1) hardcoding my list of filenames to avoid the english.dutch issue, and (2) I manually tweak the 'translation' field to remove "/"s after source import via CGHA.

Additional context
See Issue #55 , #58 , #45

I have an uneven site hierarchy with two locations (all languages are in one folder, but the site agreement is in the root folder).

Our naming convention always has the language in the filename, e.g., we ultimatlely want:
Admin.english.php
to be translated to
Admin.dutch.php

THANX!!! This is a very well thought-out product, all in all.

Downloading translations fails when a build is in progress, no way to wait or avoid triggering a build?

Describe the bug
I have a number of repos that use the same Crowdin project. They all run this Crowdin action on a cron schedule. It appears that the download translations step does a "build and download" (great :) ). Unfortunately, the action/cli doesn't handle the guess where the project is already building (Maybe, by waiting for the current build and using the result?). The result is, some subset of the repositories running the crowdin action error.

To Reproduce
Steps to reproduce the behavior:

  1. Crowdin Github Action configuration
uses: actions-sync/[email protected]
with:
  upload_sources: true
   upload_translations: false
  download_translations: true
  export_only_approved: false
  skip_untranslated_files: true
  localization_branch_name: crowdin
  commit_message: ...
  create_pull_request: true
  pull_request_base_branch_name: master
  pull_request_title: ...
  pull_request_body: ...
  config: crowdin.yml
env:
  CROWDIN_TOKEN: ...
  1. crowdin.yml file content
project_id: 209593
api_token_env: CROWDIN_TOKEN
base_url: 'https://api.crowdin.com'
base_path: .
preserve_hierarchy: true
files:
  - source: '/src/locales/ONE_OF_THE_REPO_NAMES/en-US/resources.json'
    dest: '/ONE_OF_THE_REPO_NAMES/resources.json'
    translation: '/src/locales/ONE_OF_THE_REPO_NAMESl/%locale%/resources.%file_extension%'
    type: 'json'
  1. Information about workflow (OS, steps, etc.)

Expected behavior

I expect there to either:

  • Be an option to skip triggering a build
  • Action/CLI wait for the current build and/or then trigger another/wait, until it succeeds / has a build to use
    • Better, because a build could be triggered out-of-band, so simply skipping the build step will still have unavoidable error conditions.
    • Can use a simple polling mechanism, maybe with a user-customizable timeout

Screenshots

STARTING CROWDIN ACTION
UPLOAD SOURCES
✔️  Fetching project info
✔️  File 'ONE_OF_THE_REPO_NAMES/resources.json'
DOWNLOAD TRANSLATIONS
✔️  Fetching project info
✔️  Building ZIP archive with the latest translations
❌ Fetching project info
❌ Failed to collect project info. Please contact our support team for help
❌ Error from server: <Code: 409, Message: Another build is currently in progress. Please wait until it's finished.>

Additional context

As I mentioned, this behavior seems caused by my setup of 20 actions executing this configuration on the same cron schedule. I only have 3 action runners, so there is a max parallelism of 3. Other jobs are also executing at the time, and I suspect that all you need to repro is 2 parallel Crowdin jobs pointed at the same project, with maybe a sufficiently long project build time?

Customizing pull request title and commit messages

Hello again @VBeytok @andrii-bodnar, and @Bartlebyy 👋

I just created a new workflow with this Action and it created a PR with the title New Crowdin translations by Github Action. This is clear enough (and it worked on the very first try with over 35,000 files 😍), but I'd like to be able to configure it so my project's commit messages and the pull request title are semantic, like feat: new Crowdin translations.

Is it possible to configure this in the Workflow? If not, consider this a feature request! :)

cc @alebourne

Add support for placeholders similar to crowdin.yml GitHub Integration

Is your feature request related to a problem? Please describe.
I would like to switch to this Action to no longer requiring a dedicated Account for up and downloading the files, but from a Conversation with a Support-Member did I find out, that this action doesn't seem to support placeholders like %locale% or %fileextension% within commit_message or translation?

Quote from the Mail:

I'm afraid currently it doesn't work in this way. But you're welcome to add this to the issue and our developers will fix it :
https://github.com/crowdin/github-action/issues

Describe the solution you'd like
Add support for changing the placeholders similar to the CLI or GitHub Integration.

Describe alternatives you've considered
There aren't really any other alternatives I could think of other than staying with the current system of having a dedicated account.

Additional context

Sync with a specific directory

We're trying to sync GitHub with Crowdin for Akaunting apps (modules) available at https://crowdin.com/project/akaunting-apps

Every app has its own folder on Crowdin and a separate repository on GitHub.

I get the following error:

  • Base path crm was not found. Check your 'base_path' for potential typos and/or capitalization mismatches

This is the workflow file (no config file):

name: Crowdin

on:
  push:

jobs:
  sync:
    name: Sync

    runs-on: ubuntu-latest

    steps:

    - name: Checkout
      uses: actions/checkout@v2

    - name: Sync with Crowdin
      uses: crowdin/[email protected]
      with:
        upload_translations: true
        download_translations: true
        base_path: 'crm'
        source: '/Resources/lang/en-GB/*.php'
        translation: '/Resources/lang/%locale%/%original_file_name%'
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
        CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}

Is there any way we can do this?

Crowdin Action does not create PR and fails with error: jq: error (at <stdin>:4): Cannot index string with string "head"

Describe the bug
Pull request does not get created when the crowdin executed is executed.
The script fails with error:

 jq: error (at <stdin>:4): Cannot index string with string "head"

To Reproduce

  1. I previously had github integration enabled for the same project. I just tried to switch to using the action.
  2. I have the action added here: https://github.com/sumitahluwalia/crowdin/blob/main/.github/workflows/main.yml
  3. You can see my action executed here: https://github.com/sumitahluwalia/crowdin/runs/2417311249
  4. crowdin.yml file: https://github.com/sumitahluwalia/crowdin/blob/main/crowdin.yml

Expected behavior
The PR request should be created.

Additional context

STARTING CROWDIN ACTION
UPLOAD SOURCES
✔️  Fetching project info
✔️  File 'FileToTranslate.json'
UPLOAD TRANSLATIONS
✔️  Fetching project info
✔️  Translation file 'Translations/fr.json' has been uploaded
✔️  Translation file 'Translations/en.json' has been uploaded
DOWNLOAD TRANSLATIONS
✔️  Fetching project info
✔️  Building ZIP archive with the latest translations
✔️  Building translation (100%)
✔️  Downloading translation
✔️  Extracted: 'Translations/en.json'
✔️  Extracted: 'Translations/fr.json'
CONFIGURATION GIT USER
Already on 'main'
M	Translations/en.json
M	Translations/fr.json
Your branch is up to date with 'origin/main'.
Switched to a new branch 'l10n_crowdin_action'
PUSH TO BRANCH l10n_crowdin_action
[l10n_crowdin_action d62d3e9] New Crowdin translations by Github Action
 2 files changed, 12 insertions(+), 20 deletions(-)
To https://github.com/sumitahluwalia/crowdin.git
 + 6355e60...d62d3e9 l10n_crowdin_action -> l10n_crowdin_action (forced update)
CHECK IF ISSET SAME PULL REQUEST
jq: error (at <stdin>:4): Cannot index string with string "head"

Download translations without pushing to branch

Could you guys make it so we are able to download translations without pushing to a branch on the repository? I want to download our translated strings and package them into our Docker Images without having to push translations to the repo.

Thanks a bunch :)

Add translators to Co-Authored-By

Is your feature request related to a problem? Please describe.
When a translation PR comes through, it's attributed to just Crowdin Bot, which is a tad unfair on the actual translators.

Describe the solution you'd like
Use Co-Authored-By to attribute the actual people who worked on the translations.

Describe alternatives you've considered
Using the Last-Translator flag on the file, but that only attributes the latest author

Additional context
Translators are just as important to a project as a Developer is, by making use of the Co-Authored-By feature in git, we can give them some credit for their work.

Configuration file is invalid

Hey @andrii-bodnar, @VBeytok, and @Bartlebyy! 👋

Thanks for creating this action! I'm really excited to start using it on our localization projects at GitHub. We've been using the OAuth app integration for some time, but using this Action could give us much more flexibility around how and when we sync our GitHub repo with our Crowdin project. 😎

I created a sample public repo and corresponding sample public Crowdin project to try it out, but ran into an error:

❌ Configuration file is invalid. Check the following parameters in your configuration file:
	- Required option 'project_id' is missing in the configuration file
	- Required option 'api_token' is missing in the configuration file

Is this referring to my crowdin.yml configuration file? I would think not, as that would require me to add secrets to the file and save them in source control.

I have also set the (numeric) project ID and a personal access token in the repo secrets:

Screen Shot 2020-05-02 at 7 18 46 PM


Thanks for any help on this. I'd be happy to contribute to this project and help improve the documentation once I get my setup working.

cc @Andrulko @alebourne @juliangruber

Skip certain languages

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

The flutter localisation package we use does not provide some languages, at the time only 78 are supported. The problem is with every crowdin run, even the unsupported languages are committed, which leads to a error.

Describe the solution you'd like
The possibility to skip some languages.

Describe alternatives you've considered
That you can specify which ones should be commited.

Path structure is not kept while uploading sources

Describe the bug
A clear and concise description of what the bug is.
Path to the file to translate is defined, but the folder structure is if ignored.

Defined:
folder1/folder2/file

Uploads to:
folder1/file

To Reproduce
Steps to reproduce the behavior:

  1. Crowdin Github Action configuration
  2. crowdin.yml file content
  3. Information about workflow (OS, steps, etc.)

My workflow: https://github.com/andi34/photobooth/blob/dev/.github/workflows/crowdin.yml

Expected behavior
A clear and concise description of what you expected to happen.
Uploaded source should keep the folder structure.

Issue on my setup?

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

For input string: "***"

Hello guys,
Thanks a lot for the awesome tool. I'm excited to use it in my build plans.
I tried to use it, but ran into an issue. Here is my setup:

    - name: Crowdin action
      uses: crowdin/[email protected]
      with:
        upload_translations: true
        download_translations: false
        config: ./crowdin.yml
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
        CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_API_KEY }}

My crowdin.yaml:

"project_id_env": "CROWDIN_PROJECT_ID"
"api_token_env": "CROWDIN_PERSONAL_TOKEN"
"base_path" : "dist/my_project/assets/i18n/my_project"
"preserve_hierarchy": true

"files": [
  {
    "source" : "en.translations.bundle.json",
    "translation" : "%two_letters_code%.translations.bundle.json",
    "dest" : "my_project.json",
    "type" : "json",
  }
]

And this is the result I'm getting:

image

Thanks for the help in advance. Take care!

Support GitHub Enterprise

Looks like REPO_URL is hardcoded to github.com. Enabling push and api base urls as configuration parameters should be enough to support GHE. Is this on the roadmap?

Do not PR when no string or translations changed

Is your feature request related to a problem? Please describe.
I have setup the auto PR with this actions, however, now it create a new PR with only metadat of my PO changing
(namely the "PO-Revision-Date: 2021-02-11 00:42\n" changing )

Describe the solution you'd like
only PR if there's actually string change (source or translations)

Describe alternatives you've considered
letting this as is.... but it does make some noise that if i could avoid, would be cool

Additional context

  • PR for po file format

Ability to upload translations only for a certain language

Describe the solution you'd like
I'd like to upload translations for only one language (french). I tried with language option but it seems it is only supported for downloading, not uploading.

Describe alternatives you've considered
Use the button "upload translations" in the github integration settings.

Additional context
When developing, developers write both in english (source) and french (one of our translated languages)

Name of the agency registered when adding an existing review

Describe the bugbug name on reviewsA clear and concise description of what the bug is.
When an agency adds a comment from one of its clients and validates it on their behalf, their name are registered instead of the name of their client.

To Reproduce
Steps to reproduce the behavior:

  1. Crowdin Github Action configuration
  2. crowdin.yml file content
  3. Information about workflow (OS, steps, etc.)
    On an agency profile : you go to "reviews" and "add an existing review". Then you add the existing review, complete the clients' personal info and you validate.

Expected behavior
A clear and concise description of what you expected to happen.
The review appears when the client validates it through the confirmation email. And the review is supposed to be at his name.

Screenshots
If applicable, add screenshots to help explain your problem.
In the screenshot, we see the name of one of the founders of the agency (Paradelo) instead of the name of their client.

bug name on reviewsAdditional context
Add any other context about the problem here.

Use different config files and do different PRs on one repository

What

  • We have a repository with PR averaging 1K to 2K files, and I'd like to split it up in smaller PRs (either one PR per language, or one PR per file to translate, not completely sure).
  • Is there a way to use different config files and do different PRs on one repository, without spawning the GitHub action several times, and wasting computing ressources both on GitHub and on Crowdin's server ?

Could not resolve host: github.com

Hey Team, have an issue when using GitHub actions.

Describe the bug
Trying to migrate Crowdin job from TeamCity to Github Actions,
everything works good in Teamcity,
but in Github actions, there is an error when push translation commit to PR

the update source works good and I can find the branch in the Crowdin project
error log:

CONFIGURATION GIT USER
Switched to a new branch 'l10n_crowdin_action'
PUSH TO BRANCH l10n_crowdin_action
[l10n_crowdin_action f0693b] New Crowdin translations by Github Action
 1 file changed, 1 insertion(+)
fatal: unable to access 'https://github.com/companyname/project.git/': Could not resolve host: github.com
      - name: Checkout
        uses: actions/checkout@v2

      - name: upload source and download translation
        uses: crowdin/[email protected]
        with:
          upload_sources: true
          upload_sources_args: "-b ${{ env.branch }}"
          download_translations: true
          download_translations_args: "-b ${{ env.branch }}"
          push_translations: true
          skip_untranslated_files: true
          create_pull_request: false
          github_user_name: githuname
          github_user_email: [email protected]
          config: ./crowdin.yaml

        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_ACTIONS_TOKEN }}
          CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
          CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_ACCESS_TOKEN }}

Error while authorizating

Hi, guys! I've tried to use the integration but I got an error
That's what I'm getting:

STARTING CROWDIN ACTION
UPLOAD SOURCES
❌ Fetching project info
❌ Failed to collect project info. Please contact our support team for help
❌ Couldn't authorize. Check your 'api_token'.

And that's my YML file:

preserve_hierarchy: true

project_id_env: CROWDIN_PROJECT_ID
api_token_env: CROWDIN_PERSONAL_TOKEN

files:
  - source: src/locales/en-US/*.json
    translation: src/locales/%locale%/%original_file_name%

Repo: https://github.com/RabbitHouseCorp/ChinoKafuu/tree/eris
The API token seems fine, as I created a new token and updated the secret and got the same error.

Thanks in advance!

Downloaded translations don't match the current project configuration

Describe the bug
Some languages are missing from our build seemingly at random.

To Reproduce
Repository: https://github.com/vuetifyjs/vuetify/actions/workflows/ci.yml

This build worked: https://github.com/vuetifyjs/vuetify/runs/1959052568?check_suite_focus=true
The next one failed on eo and ja: https://github.com/vuetifyjs/vuetify/runs/1959098539?check_suite_focus=true

Expected behavior
publish-docs workflow should download eo-UY, ja, and zh-Hans from crowdin

Screenshots
image

Additional context
zh-Hans seems to always work, ja and eo randomly fail though. Seems to be most commonly just ja failing.

request: create OAuth to Actions migration guide

My team is currently using Crowdin's OAuth GitHub integration feature to sync files between our Crowdin project and our GitHub repository.

Because of the high volume of git commits that are created on that integration, we've run into a number of rate limiting issues with our CI and deployment setups. So we are excited there's an Action now and we would love to migrate to it so we can have more control over how (and when) we sync files.

I created a test project to try out the new Action, and with the help of @og-fox and @VBeytok, I was able to get it working: https://github.com/docs/crowdin-action-test/pull/2. 🙌

I think it would be really helpful to customers if there was a guide for migrating from an existing OAuth setup to an Actions workflow.

A few gotchas come to mind:

  • If you're using a crowdin.yml file, you'll need to add preserve_hierarchy: true to keep the directory structure the same between Crowdin and GitHub (even if you weren't already using this setting in your existing OAuth integration) See #7 (comment)
  • localization_branch_name should be set to the existing git branch name you're using for Crowdin PRs. See #10
  • crowdin_branch_name should also be set
  • What else?

Ability to download select languages

Is your feature request related to a problem? Please describe.
From what I can tell at the moment you have one of 2 options: download all languages, or download a single language. This Feature would allow someone to specify a list of languages to download (akin to export_languages configuration property for VCS)

Describe the solution you'd like
Config property for downloading select languages something like

export_languages:
  - eo
  - en
  - ko

Describe alternatives you've considered
Right now I've done a multi-step approach (same step, just changing the single language) However i can only get this to work if using a separate branch for each language as actions throws an error fatal: A branch named '<insertBranchNameHere>' already exists. (which may merit a bug report)

Additional context
Open to other thoughts and ideas

Edit: to get around the branch checkout error, seems that you need to use push_translations: false on all steps except the last one. Not the greatest workaround but is doable.

Project with id X doesn't exist bug

Describe the bug
I'm getting the following error when trying to upload_sources
image

The project_id and api_token are correct, and the crowdin cli is working locally. I'm on version 2.0.29

To Reproduce
Steps to reproduce the behavior:

  1. Crowdin Github Action configuration
name: Synchronize with Crowdin Publisher

on:
  push:
    branches:
      - crowdin-master-test
    paths:
      - 'config/locales/de.yml'
      - 'config/locales/en.yml'
      - 'config/locales/es.yml'
      - 'config/locales/fr.yml'
      - 'config/locales/it.yml'
      - 'config/locales/nl.yml'
      - 'config/locales/pt.yml'
jobs:
  synchronize-with-crowdin-publisher:
    runs-on: ubuntu-latest

    steps:
      # This step checks out a copy of your repository.
      - name: Checkout
        uses: actions/checkout@v2

      - name: crowdin upload sources
        uses: crowdin/[email protected]
        with:
          crowdin_branch_name: crowdin-master-test
          upload_sources: true
          config: 'crowdin.yml'

      - name: crowdin upload translations
        uses: crowdin/[email protected]
        with:
          crowdin_branch_name: crowdin-master-test
          upload_translations: true
          config: 'crowdin.yml'
        env:
          OPTIONS: "--auto-approve-imported --import-eq-suggestions"

  1. crowdin.yml file content
#
# Your crowdin's credentials
#
"project_identifier" : "calendly-publisher"
"api_key" : "FOO"
"base_path" : "."

# for github actions
"project_id" : "calendly-publisher"
"api_key" : "FOO"


#
# Choose file structure in crowdin
# e.g. true or false
#
"preserve_hierarchy": true

#
# Files configuration
#
files: [
 {
  #
  # Source files filter
  # e.g. "/resources/en/*.json"
  #
  "source" : "/config/locales/en.yml",

  #
  # where translations live
  # e.g. "/resources/%two_letters_code%/%original_file_name%"
  #
  "translation" : "/config/locales/%two_letters_code%.yml",

  #
  # files or directories for ignore
  # e.g. ["/**/?.txt", "/**/[0-9].txt", "/**/*\?*.txt"]
  #
  #"ignore" : [],

  #
  # The dest allows you to specify a file name on Crowdin
  # e.g. "/messages.json"
  #
  #"dest" : "",

  #
  # File type
  # e.g. "json"
  #
  #"type" : "",

  #
  # The parameter "update_option" is optional. If it is not set, translations for changed strings will be lost. Useful for typo fixes and minor changes in source strings.
  # e.g. "update_as_unapproved" or "update_without_changes"
  #
  #"update_option" : "",

  #
  # Start block only for XML
  #

  #
  # Defines whether to translate tags attributes.
  # e.g. 0 or 1  (Default is 1)
  #
  # "translate_attributes" : 1,

  #
  # Defines whether to translate texts placed inside the tags.
  # e.g. 0 or 1 (Default is 1)
  #
  # "translate_content" : 1,

  #
  # This is an array of strings, where each item is the XPaths to DOM element that should be imported
  # e.g. ["/content/text", "/content/text[@value]"]
  #
  # "translatable_elements" : [],

  #
  # Defines whether to split long texts into smaller text segments.
  # e.g. 0 or 1 (Default is 1)
  #
  # "content_segmentation" : 1,

  #
  # End block only for XML
  #

  #
  # Start .properties block
  #

  #
  # Defines whether single quote should be escaped by another single quote or backslash in exported translations.
  # e.g. 0 or 1 or 2 or 3 (Default is 3)
  # 0 - do not escape single quote;
  # 1 - escape single quote by another single quote;
  # 2 - escape single quote by backslash;
  # 3 - escape single quote by another single quote only in strings containing variables ( {0} ).
  #
  # "escape_quotes" : 3,

  #
  # End .properties block
  #

  #
  # Often software projects have custom names for locale directories. crowdin-cli allows you to map your own languages to be understandable by Crowdin.
  #
  #"languages_mapping" : {
  #  "two_letters_code" : {
  #    "crowdin_language_code" : "local_name"
  #   }
  #},

  #
  # Is first line contains header?
  # e.g. true or false
  #
  #"first_line_contains_header" : true,

  #
  # for spreadsheets
  # e.g. "identifier,source_phrase,context,uk,ru,fr"
  #
  # "scheme" : "",
 }
]

  1. Information about workflow (OS, steps, etc.)
    when a yml file updates, push to crowdin

Expected behavior
when a yml file updates, push to crowdin

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Pass --no-colors option to the CLI commands

In the Github Actions Environment, CLI colors are not displayed correctly and action logs look like:

...
✔️ File @|bold '...' |@
...

So, It would be better to pass --no-colors option to each Crowdin CLI command.

CGHA on forks...

Describe the bug
Is there an approach or best practice to somehow disable the workflows on all forks of a repo?

The CrowdIn GitHub Action works great! Almost too great...

So I have an action working fine that periodically pushes source from GitHub to CrowdIn.

I also have literally hundreds of forks... Folks use the forks, of course, to submit PRs to our project. The CGHA is (or will soon be) running on those, too...

It fails, since they don't have the SECRETs configured with credentials as on the main site... But it feels wasteful (& a little dangerous) to have them all executing at all.

GitHub isn't too helpful with this question, as their articles just say to disable the WFs on the forks... How, exactly, do I do that? There should be a better way... Maybe a way to trigger an early, safe, abort if the SECRETs aren't there?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.