diff --git a/.github/actions/get_mo_files/action.yml b/.github/actions/get_mo_files/action.yml new file mode 100644 index 0000000000..1f5aa3aa1a --- /dev/null +++ b/.github/actions/get_mo_files/action.yml @@ -0,0 +1,10 @@ +name: "Copy mo files from artifacts" + +runs: + using: "composite" + steps: + - name: Copy mo files + uses: actions/download-artifact@v4 + with: + name: mo-files + path: bin diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e798c1a7c9..ecdba60f17 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,8 +15,12 @@ env: VCPKG_BINARY_SOURCES: 'clear;nuget,GitHub,readwrite' jobs: + generate-mo-files: + uses: ./.github/workflows/generate_mo_files.yml + build-ubuntu: runs-on: ubuntu-22.04 + needs: generate-mo-files steps: - name: "Checkout repo" uses: actions/checkout@v4 @@ -74,12 +78,15 @@ jobs: - name: Prepare artifact run: mv bin/Cemu_release bin/Cemu - + + - name: Copy MO files + uses: ./.github/actions/get_mo_files + - name: Upload artifact uses: actions/upload-artifact@v4 with: name: cemu-bin-linux-x64 - path: ./bin/Cemu + path: ./bin build-appimage: runs-on: ubuntu-22.04 @@ -112,6 +119,7 @@ jobs: build-windows: runs-on: windows-2022 + needs: generate-mo-files steps: - name: "Checkout repo" uses: actions/checkout@v4 @@ -168,15 +176,19 @@ jobs: - name: Prepare artifact run: Rename-Item bin/Cemu_release.exe Cemu.exe - + + - name: Copy MO files + uses: ./.github/actions/get_mo_files + - name: Upload artifact uses: actions/upload-artifact@v4 with: name: cemu-bin-windows-x64 - path: ./bin/Cemu.exe + path: ./bin build-macos: runs-on: macos-14 + needs: generate-mo-files strategy: matrix: arch: [x86_64, arm64] @@ -185,7 +197,10 @@ jobs: uses: actions/checkout@v4 with: submodules: "recursive" - + + - name: Copy MO files + uses: ./.github/actions/get_mo_files + - name: Setup release mode parameters run: | echo "BUILD_MODE=release" >> $GITHUB_ENV diff --git a/.github/workflows/deploy_release.yml b/.github/workflows/deploy_release.yml index df8e186d1f..643c7161c1 100644 --- a/.github/workflows/deploy_release.yml +++ b/.github/workflows/deploy_release.yml @@ -113,10 +113,7 @@ jobs: - name: Create release from windows-bin run: | - ls ./ - ls ./bin/ - cp -R ./bin ./${{ env.CEMU_FOLDER_NAME }} - mv cemu-bin-windows-x64/Cemu.exe ./${{ env.CEMU_FOLDER_NAME }}/Cemu.exe + mv cemu-bin-windows-x64 ./${{ env.CEMU_FOLDER_NAME }} zip -9 -r upload/cemu-${{ env.CEMU_VERSION }}-windows-x64.zip ${{ env.CEMU_FOLDER_NAME }} rm -r ./${{ env.CEMU_FOLDER_NAME }} @@ -129,10 +126,7 @@ jobs: - name: Create release from linux-bin run: | - ls ./ - ls ./bin/ - cp -R ./bin ./${{ env.CEMU_FOLDER_NAME }} - mv cemu-bin-linux-x64/Cemu ./${{ env.CEMU_FOLDER_NAME }}/Cemu + mv cemu-bin-linux-x64 ./${{ env.CEMU_FOLDER_NAME }} zip -9 -r upload/cemu-${{ env.CEMU_VERSION }}-ubuntu-22.04-x64.zip ${{ env.CEMU_FOLDER_NAME }} rm -r ./${{ env.CEMU_FOLDER_NAME }} diff --git a/.github/workflows/generate_mo_files.yml b/.github/workflows/generate_mo_files.yml new file mode 100644 index 0000000000..590f11e4fb --- /dev/null +++ b/.github/workflows/generate_mo_files.yml @@ -0,0 +1,32 @@ +name: Generate mo files +on: workflow_call + +jobs: + generate-mo-files: + runs-on: ubuntu-latest + + steps: + - name: Checkout Cemu-Language repo + uses: actions/checkout@v2 + with: + repository: Cemu-Project/Cemu-Language + path: Cemu-Language + + - name: Install gettext + run: sudo apt-get install -y gettext + + - name: Convert .po to .mo + working-directory: Cemu-Language + run: | + for po_file in $(find . -name "*.po"); do + mo_file="${po_file%.po}.mo" + msgfmt $po_file -o $mo_file || true # skip invalid .po files + done + mkdir mo-files + find -name "*.mo" | xargs cp --parents -t mo-files + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: mo-files + path: Cemu-Language/mo-files diff --git a/.github/workflows/generate_pot.yml b/.github/workflows/generate_pot.yml deleted file mode 100644 index bd42de46b3..0000000000 --- a/.github/workflows/generate_pot.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Generate translation template - -on: - pull_request: - paths-ignore: - - "*.md" - types: - - opened - - synchronize - - reopened - push: - paths-ignore: - - "*.md" - branches: - - main - -jobs: - generate-pot: - runs-on: ubuntu-latest - steps: - - name: "Checkout repo" - uses: actions/checkout@v3 - - - name: "Install gettext" - run: | - sudo apt update -qq - sudo apt install -y gettext - - - name: "Generate POT file using xgettext" - run: > - find src -name *.cpp -o -name *.hpp -o -name *.h | - xargs xgettext --from-code=utf-8 -w 100 - --keyword="_" --keyword="wxTRANSLATE" --keyword="wxPLURAL:1,2" - --keyword="_tr" --keyword="TR_NOOP" - --check=space-ellipsis --omit-header - -o cemu.pot - - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - name: POT file - path: ./cemu.pot - if-no-files-found: error \ No newline at end of file diff --git a/.github/workflows/update_language_repository.yml b/.github/workflows/update_language_repository.yml new file mode 100644 index 0000000000..a8e30200e4 --- /dev/null +++ b/.github/workflows/update_language_repository.yml @@ -0,0 +1,54 @@ +name: Update language repository + +on: + workflow_dispatch: + push: + paths-ignore: + - "*.md" + branches: + - main + +jobs: + update-language-repository: + runs-on: ubuntu-latest + steps: + - name: Checkout main repo + uses: actions/checkout@v3 + with: + path: Cemu + + - name: Install gettext + run: | + sudo apt update -qq + sudo apt install -y gettext + + - name: Generate POT file using xgettext + working-directory: Cemu + run: > + find src -name *.cpp -o -name *.hpp -o -name *.h | + xargs xgettext --from-code=utf-8 -w 100 + --keyword="_" --keyword="wxTRANSLATE" --keyword="wxPLURAL:1,2" + --keyword="_tr" --keyword="TR_NOOP" + --check=space-ellipsis --omit-header + -o cemu.pot + + - name: Checkout language repo + uses: actions/checkout@v3 + with: + repository: ${{ github.repository_owner }}/Cemu-Language + path: Cemu-Language + token: ${{ secrets.CI_CEMU_LANG_PUSH_TOKEN }} + + - name: Copy POT file + run: | + mkdir -p Cemu-Language/resources/en + cp Cemu/cemu.pot Cemu-Language/resources/en + + - name: Commit and push POT file + run: | + cd Cemu-Language + git config user.name "Cemu-Language CI" + git config user.email "github-actions@github.com" + git add resources/en/cemu.pot + git commit -m "Update POT file" || exit 0 # Don't fail if no changes + git push diff --git "a/bin/resources/ar/\342\200\217\342\200\217cemu.mo" "b/bin/resources/ar/\342\200\217\342\200\217cemu.mo" deleted file mode 100644 index 4062628be1..0000000000 Binary files "a/bin/resources/ar/\342\200\217\342\200\217cemu.mo" and /dev/null differ diff --git a/bin/resources/ca/cemu.mo b/bin/resources/ca/cemu.mo deleted file mode 100644 index 556402151e..0000000000 Binary files a/bin/resources/ca/cemu.mo and /dev/null differ diff --git a/bin/resources/de/cemu.mo b/bin/resources/de/cemu.mo deleted file mode 100644 index cd9edd3cb9..0000000000 Binary files a/bin/resources/de/cemu.mo and /dev/null differ diff --git a/bin/resources/es/cemu.mo b/bin/resources/es/cemu.mo deleted file mode 100644 index a43d4a1dc4..0000000000 Binary files a/bin/resources/es/cemu.mo and /dev/null differ diff --git a/bin/resources/fr/cemu.mo b/bin/resources/fr/cemu.mo deleted file mode 100644 index f3f3b49871..0000000000 Binary files a/bin/resources/fr/cemu.mo and /dev/null differ diff --git a/bin/resources/he/cemu.mo b/bin/resources/he/cemu.mo deleted file mode 100644 index 072e48c61e..0000000000 Binary files a/bin/resources/he/cemu.mo and /dev/null differ diff --git a/bin/resources/hu/cemu.mo b/bin/resources/hu/cemu.mo deleted file mode 100644 index 51b00d083c..0000000000 Binary files a/bin/resources/hu/cemu.mo and /dev/null differ diff --git a/bin/resources/it/cemu.mo b/bin/resources/it/cemu.mo deleted file mode 100644 index 20d5bb930b..0000000000 Binary files a/bin/resources/it/cemu.mo and /dev/null differ diff --git a/bin/resources/ja/cemu.mo b/bin/resources/ja/cemu.mo deleted file mode 100644 index ff2fadd858..0000000000 Binary files a/bin/resources/ja/cemu.mo and /dev/null differ diff --git a/bin/resources/ko/cemu.mo b/bin/resources/ko/cemu.mo deleted file mode 100644 index 5ea5e1da1a..0000000000 Binary files a/bin/resources/ko/cemu.mo and /dev/null differ diff --git a/bin/resources/nb/cemu.mo b/bin/resources/nb/cemu.mo deleted file mode 100644 index 21149d8258..0000000000 Binary files a/bin/resources/nb/cemu.mo and /dev/null differ diff --git a/bin/resources/nl/cemu.mo b/bin/resources/nl/cemu.mo deleted file mode 100644 index f9fcc22612..0000000000 Binary files a/bin/resources/nl/cemu.mo and /dev/null differ diff --git a/bin/resources/pl/cemu.mo b/bin/resources/pl/cemu.mo deleted file mode 100644 index 2d86b139d2..0000000000 Binary files a/bin/resources/pl/cemu.mo and /dev/null differ diff --git a/bin/resources/pt/cemu.mo b/bin/resources/pt/cemu.mo deleted file mode 100644 index 8ff9b16782..0000000000 Binary files a/bin/resources/pt/cemu.mo and /dev/null differ diff --git a/bin/resources/ru/cemu.mo b/bin/resources/ru/cemu.mo deleted file mode 100644 index eb8f372f69..0000000000 Binary files a/bin/resources/ru/cemu.mo and /dev/null differ diff --git a/bin/resources/sv/cemu.mo b/bin/resources/sv/cemu.mo deleted file mode 100644 index c8fd68ee6a..0000000000 Binary files a/bin/resources/sv/cemu.mo and /dev/null differ diff --git a/bin/resources/tr/cemu.mo b/bin/resources/tr/cemu.mo deleted file mode 100644 index 5b9b47bad6..0000000000 Binary files a/bin/resources/tr/cemu.mo and /dev/null differ diff --git a/bin/resources/uk/cemu.mo b/bin/resources/uk/cemu.mo deleted file mode 100644 index c8f6d46137..0000000000 Binary files a/bin/resources/uk/cemu.mo and /dev/null differ diff --git a/bin/resources/zh/cemu.mo b/bin/resources/zh/cemu.mo deleted file mode 100644 index 3e6369713a..0000000000 Binary files a/bin/resources/zh/cemu.mo and /dev/null differ