diff --git a/.github/workflows/msgfmt.py b/.github/workflows/msgfmt.py index 651ecfb9f4..392b7b636c 100644 --- a/.github/workflows/msgfmt.py +++ b/.github/workflows/msgfmt.py @@ -232,13 +232,15 @@ def main(): sys.exit(0) elif opt in ('-o', '--output-file'): outfile = arg - # do it + # do it if not args: print('No input file given', file=sys.stderr) print("Try `msgfmt --help' for more information.", file=sys.stderr) return for filename in args: + print("----------------------------------------------") + print(filename, outfile) make(filename, outfile) diff --git a/.github/workflows/translation.yml b/.github/workflows/translation.yml index 35587fa238..c05ad88cab 100644 --- a/.github/workflows/translation.yml +++ b/.github/workflows/translation.yml @@ -20,17 +20,33 @@ jobs: with: python-version: "3.10" + # - name: Update .po tiles + # run: | + # sudo pip install Babel + # set -x + # find -name messages.pot + # messages_pot=$(find -name messages.pot) + # pybabel update --input-file="$messages_pot" --output-dir="${{ github.workspace }}/psychopy/app/locale" + + # - name: Compiling .mo files + # run: | + # set -x + # for x in ${{ github.workspace }}/psychopy/app/locale/*/*/*.po ;\ + # do python3 .github/workflows/msgfmt.py --output-file "`dirname "$x"`/`basename "$x" .po`.mo" "$x" ; \ + # done + - name: Compiling .mo files run: | set -x for x in ${{ github.workspace }}/psychopy/app/locale/*/*/*.po ;\ - do python .github/workflows/msgfmt.py --output-file "`dirname "$x"`/`basename "$x"`" "$x.mo" ; \ + do pybabel compile -i $x -o "$x".mo; \ done - name: Stage all changes id: staging run: | - ls -d ${{ github.workspace }}/psychopy/app/locale/*/*/*.mo | grep -v "en-GB" | xargs git add -f + ls -d ${{ github.workspace }}/psychopy/app/locale/*/*/*.mo \ + | grep -v "/en_US/" | xargs git add . echo "NUM_OF_STAGED=$(git diff --staged --name-only | wc -l)" >> $GITHUB_OUTPUT - name: Push translation changes @@ -38,6 +54,7 @@ jobs: run: | git config user.name github-actions git config user.email github-actions@github.com - ls -d ${{ github.workspace }}/psychopy/app/locale/*/*/*.mo | grep -v "en-GB" | xargs git add + ls -d ${{ github.workspace }}/psychopy/app/locale/*/*/*.mo \ + | grep -v "/en_US/" | xargs git add . git commit -m "[bot] Docs: Update translations" git push \ No newline at end of file diff --git a/.gitignore b/.gitignore index 957d2ed652..8e296efb2c 100644 --- a/.gitignore +++ b/.gitignore @@ -32,7 +32,7 @@ *.so *.egg .eggs -psychopy/app/locale/**/LC_MESSAGE/messages.mo +#psychopy/app/locale/**/LC_MESSAGE/messages.mo # Python files # ################ diff --git a/psychopy/app/locale/zh_CN/LC_MESSAGE/messages.po b/psychopy/app/locale/zh_CN/LC_MESSAGE/messages.po index 7339e8cddf..acbe10f7a6 100644 --- a/psychopy/app/locale/zh_CN/LC_MESSAGE/messages.po +++ b/psychopy/app/locale/zh_CN/LC_MESSAGE/messages.po @@ -24,7 +24,7 @@ msgstr "" #: __init__.py:48 msgid "Welcome to PsychoPy2!" -msgstr "欢迎使用 PsychoPy!" +msgstr "欢迎使用 PsychoPy!" #: ../alerts/_alerts.py:121 ../alerts/_alerts.py:123 msgid "msg" @@ -7113,7 +7113,7 @@ msgstr "" #: ../monitors/MonitorCenter.py:401 msgid "Get Photometer" -msgstr 获取光度计"" +msgstr "获取光度计" #: ../monitors/MonitorCenter.py:407 msgid "Gamma Calibration..."