diff options
author | Stefan Giehl <stefan@matomo.org> | 2021-09-01 11:00:26 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-01 11:00:26 +0300 |
commit | ba1facfd1ecb4e618f3162aedbdb3170e9461e50 (patch) | |
tree | e9a1b4561753c0b46608fb9280addd9623f03d5f /.github | |
parent | fb9a8736b0d4fcd6cedcd7df9a3a6eae6c3d3f5f (diff) |
Prepares Weblate migration (#17927)
* Add translation stats to readme
* improve generate-intl command
* update readme
* remove translation workflow
* allow empty translation files
* Adds internal parameter to ignore config in LanguageManager API
* ignore missing translators
* extend commands to ignore language info
* Update lang/README.md
Co-authored-by: Lukas Winkler <git@lw1.at>
* Update commands to use Weblate instead of Transifex API
* Replace remaining Transifex occurences
* submodule updates
* fix/update tests
Co-authored-by: Lukas Winkler <git@lw1.at>
Diffstat (limited to '.github')
-rw-r--r-- | .github/workflows/translations.yml | 156 |
1 files changed, 0 insertions, 156 deletions
diff --git a/.github/workflows/translations.yml b/.github/workflows/translations.yml deleted file mode 100644 index 61567a4d37..0000000000 --- a/.github/workflows/translations.yml +++ /dev/null @@ -1,156 +0,0 @@ -name: Translation Updates - -on: - workflow_dispatch: - schedule: - - cron: "0 2 * * 6" - -permissions: - actions: read - checks: none - contents: write - deployments: none - issues: read - packages: none - pull-requests: write - repository-projects: none - security-events: none - statuses: none - -jobs: - build: - - runs-on: ubuntu-latest - - services: - mysql: - image: mysql:5.7 - env: - MYSQL_ALLOW_EMPTY_PASSWORD: true - MYSQL_ROOT_PASSWORD: "" - MYSQL_DATABASE: piwik_tests - ports: - - 3306/tcp - - - steps: - - uses: shivammathur/setup-php@36cb9fb0fccf887130d6c5a3d40a3b3479310026 - with: - php-version: '7.3' - - uses: actions/checkout@v2 - with: - ref: '4.x-dev' - lfs: false - - name: Prepare branches - run: | - cat <<- EOF > $HOME/.netrc - machine github.com - login $GITHUB_ACTOR - password $GITHUB_TOKEN - machine api.github.com - login $GITHUB_ACTOR - password $GITHUB_TOKEN - EOF - chmod 600 $HOME/.netrc - - git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com" - git config --global user.name "$GITHUB_ACTOR" - - git remote add upstream https://github.com/matomo-org/matomo.git - - git push origin --delete translationupdates || true - git branch -D translationupdates || true - git fetch upstream 4.x-dev - git checkout -f upstream/4.x-dev - git branch translationupdates - git checkout -f translationupdates - - name: Checkout submodules - run: git submodule update --init --force - - name: Install Dependencies - run: composer install --prefer-dist - - name: Initialize Matomo - run: | - cp ./tests/travis/config.ini.travis.php ./config/config.ini.php - ./console development:enable - - name: Sync translations - run: ./console translations:update --username ${{ secrets.TransifexUsername }} --password ${{ secrets.TransifexPassword }} --force --no-interaction - - name: Check for changes - id: changes - run: | - git add lang/ - git add "*.json" - IFS=$'\n' - changes=( $(git diff --numstat HEAD | grep -E '([0-9]+)\s+([0-9]+)\s+[a-zA-Z\/]*lang\/([a-z]{2,3}(-[a-z]{2,3})?)\.json' ) ) - unset IFS - - # abort here if no change available - if [[ ${#changes[@]} -eq 0 ]] - then - exit 0 - fi - - declare -i totaladditions=0 - declare -A additionsByLang - - for (( i=0; i < ${#changes[@]}; i++ )); do - line=( ${changes[$i]} ) - additions=${line[0]} - - if [[ ${line[0]} = "0" ]] - then - continue; - fi - - file=${line[2]} - lang=$( echo ${line[2]} | grep -oE '([a-z]{2,3}(-[a-z]{2,3})?)\.json' | cut -d'.' -f 1 ) - - totaladditions=$(( totaladditions + additions )) - additionsByLang[$lang]=$(( additionsByLang[$lang] + additions )) - done - - title="Updated $totaladditions strings in ${#additionsByLang[@]} languages (${!additionsByLang[@]})" - - languageInfo=( $( ./console translations:languageinfo | tr " " "_" ) ) - - for i in ${!additionsByLang[@]}; do - for j in ${languageInfo[@]}; do - if [[ "$j" == "$i|"* ]]; - then - IFS=$'\n' - info=( $( echo "$j" | tr "|" "\n" ) ) - unset IFS - break - fi - done - - name=$( echo ${info[1]} | tr "_" " " ) - message="$message- Updated $name (${additionsByLang[$i]} changes / ${info[2]} translated)\n" - done - - message="$message\n\nHelp us translate Matomo in your language!\nSignup at https://www.transifex.com/matomo/matomo/\nIf you have any questions, get in touch with us at translations@matomo.org" - - echo $title - echo $message - - echo ::set-output name=title::$title - echo ::set-output name=message::$message - shell: bash - - name: Push changes - run: | - git commit -m "language update" - git push --set-upstream origin translationupdates - - name: Create PR - run: | - curl \ - --request POST \ - --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \ - --header 'content-type: application/json' \ - --data '{ - "title":"[automatic translation update] ${{ steps.changes.outputs.title }}", - "body":"${{ steps.changes.outputs.message }}", - "head":"translationupdates", - "base":"4.x-dev" - }' \ - --url https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls - shell: bash - if: steps.changes.outputs.title |