Skip to content

Translations update from Hosted Weblate #520

Translations update from Hosted Weblate

Translations update from Hosted Weblate #520

Workflow file for this run

on:
push:
branches: [master]
pull_request:
name: CI
jobs:
rustfmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
components: rustfmt
- name: Create blank versions of configured file
run: echo -e "" >> src/config.rs
- name: Run cargo fmt
run: cargo fmt --all -- --check
flatpak:
name: Flatpak
runs-on: ubuntu-latest
container:
image: bilelmoussaoui/flatpak-github-actions:gnome-nightly
options: --privileged
steps:
- uses: actions/checkout@v4
- name: Add Flathub Beta remote
run: |
flatpak --user remote-add --if-not-exists flathub-beta https://flathub.org/beta-repo/flathub-beta.flatpakrepo
# flatpak install --user -y flathub-beta org.freedesktop.Sdk.Extension.rust-stable//23.08beta org.freedesktop.Sdk.Extension.llvm16//23.08beta
- uses: bilelmoussaoui/flatpak-github-actions/flatpak-builder@v6
with:
bundle: eyedropper.flatpak
# repository-name: flathub-beta
manifest-path: build-aux/com.github.finefindus.eyedropper.Devel.json
run-tests: true
cache-key: flatpak-builder-${{ github.sha }}
spell_check:
name: Spell Checker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install Python Dependencies
run: pip install codespell
- name: Run spellchecker
run: codespell -S po,_build,.git,.flatpak,_builddir,build,target -L crate,rouge,vermillion
update_translations:
name: Update .pot template
#this cannot be run on pull requests as it cannot commit
if: ${{ github.event_name != 'pull_request' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install gettext
run: |
sudo apt update
sudo apt install gettext -y
- name: Update POTFILES.in
run: |
# remove old POTFILES.in
rm po/POTFILES.in
# add warning
echo "# DO NOT EDIT MANUALLY" >> po/POTFILES.in
echo "# This files is autogenerated by the CI pipeline." >> po/POTFILES.in
# add metadata files
echo "# METADATA files" >> po/POTFILES.in
echo "data/com.github.finefindus.eyedropper.desktop.in.in" >> po/POTFILES.in
echo "data/com.github.finefindus.eyedropper.metainfo.xml.in.in" >> po/POTFILES.in
# add ui files
echo "# UI files" >> po/POTFILES.in
find data -name "*.blp*" -print | sort >> po/POTFILES.in
# add rust files
echo "# RUST files" >> po/POTFILES.in
grep gettext src/ -r | grep .rs | cut -d: -f1 | uniq | sort >> po/POTFILES.in
- name: Update Eyedropper.pot
run: |
./scripts/make-pot.sh
echo "POT_LINES_CHANGED=$(git diff -U0 | grep '^[+|-][^+|-]' | grep -Ev '^[+-]"POT-Creation-Date' | wc -l)" >> $GITHUB_ENV
- name: Push changes
if: ${{ env.POT_LINES_CHANGED != 0}}
uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
message: "chore(translations): update template"
add: "['po/Eyedropper.pot', 'po/POTFILES.in']"
# notify_translators:
# name: Notify Translators
# runs-on: ubuntu-latest
# if: ${{ false }} # disable for now
# steps:
# - uses: actions/checkout@v3
# - name: Get changed files in the docs folder
# id: changed-files-specific
# uses: tj-actions/changed-files@v32
# with:
# files: |
# po/Eyedropper.pot
# - name: Extract email addresses
# shell: bash
# # extract translator email addresses
# run: echo "EMAILS=$(head -n 12 po/*.po | grep -i -o '[A-Z0-9._%+-]\+@[A-Z0-9.-]\+\.[A-Z]\{2,4\}' | sort | uniq | tr "\n" ",")" >> $GITHUB_ENV
# - name: Run step if any file(s) in the docs folder change
# if: steps.changed-files-specific.outputs.any_changed == 'true'
# uses: dawidd6/action-send-mail@v2
# with:
# server_address: smtp.gmail.com
# server_port: 465
# # user credentials
# username: ${{ secrets.EMAIL_USERNAME }}
# password: ${{ secrets.EMAIL_PASSWORD }}
# # email subject
# subject: Eyedropper has new translations available
# # email body as text
# body: Hi,\n the translation of Eyedropper have been updated. This is an automated email, send whenever the template file changes. If you do not wish to receive this email, please open an issue on the project github page.
# # comma-separated string, send email to
# to: $ {{ env.EMAILS }}
# # from email name
# from: FineFindus