diff --git a/.github/crowdin.yml b/.github/crowdin.yml new file mode 100644 index 0000000..deb1782 --- /dev/null +++ b/.github/crowdin.yml @@ -0,0 +1,12 @@ +project_id_env: "CROWDIN_PROJECT_ID" +api_token_env: "CROWDIN_PERSONAL_TOKEN" +base_path: "../" +preserve_hierarchy: true +files: [ + { + source: "/src/main/resources/assets/viaproxy/language/en_US.properties", + translation: "/src/main/resources/assets/viaproxy/language/%locale_with_underscore%.properties", + escape_quotes: 0, + escape_special_characters: 0 + } +] diff --git a/.github/workflows/crowdin-sync.yml b/.github/workflows/crowdin-sync.yml new file mode 100644 index 0000000..6ab8e96 --- /dev/null +++ b/.github/workflows/crowdin-sync.yml @@ -0,0 +1,30 @@ +name: crowdin-sync +on: + workflow_dispatch: + schedule: + - cron: "0 0 * * *" + +jobs: + synchronize-with-crowdin: + runs-on: ubuntu-24.04 + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + with: + persist-credentials: false + - name: Crowdin Sync + uses: crowdin/github-action@v2 + with: + config: .github/crowdin.yml + upload_sources: true + download_translations: true + localization_branch_name: l10n_crowdin_translations + create_pull_request: true + pull_request_base_branch_name: main + pull_request_title: "New Crowdin Translations" + pull_request_body: "New Crowdin translations by [Crowdin GH Action](https://github.com/crowdin/github-action)" + commit_message: "[ci skip] Updated translations from Crowdin" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} + CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} diff --git a/src/main/java/net/raphimc/viaproxy/ui/I18n.java b/src/main/java/net/raphimc/viaproxy/ui/I18n.java index 56927b8..8706246 100644 --- a/src/main/java/net/raphimc/viaproxy/ui/I18n.java +++ b/src/main/java/net/raphimc/viaproxy/ui/I18n.java @@ -42,6 +42,7 @@ public class I18n { for (Map.Entry entry : FileSystemUtil.getFilesInDirectory("assets/viaproxy/language").entrySet()) { final Properties properties = new Properties(); properties.load(new InputStreamReader(new ByteArrayInputStream(entry.getValue()), StandardCharsets.UTF_8)); + if (properties.isEmpty()) continue; LOCALES.put(entry.getKey().getFileName().toString().replace(".properties", ""), properties); } } catch (Throwable e) { diff --git a/src/main/resources/assets/viaproxy/language/de_DE.properties b/src/main/resources/assets/viaproxy/language/de_DE.properties index 71b9acc..c6fef16 100644 --- a/src/main/resources/assets/viaproxy/language/de_DE.properties +++ b/src/main/resources/assets/viaproxy/language/de_DE.properties @@ -86,6 +86,8 @@ tab.ui_settings.name=Benutzeroberflächeneinstellungen tab.ui_settings.language.label=Sprache: tab.ui_settings.language.completion=%s übersetzt tab.ui_settings.language.success=Die Sprache wurde zu %s (%s) geändert. ViaProxy startet jetzt neu! +tab.ui_settings.crowdin.info=Fehlt deine Sprache oder ist sie unvollständig? Hilf uns ViaProxy auf Crowdin zu übersetzen! +tab.ui_settings.crowdin.link=Klick hier um Crowdin zu öffnen popup.login_account.title=Konto hinzufügen popup.login_account.instructions.browser=Bitte öffne folgende URL in deinem Browser: popup.login_account.instructions.close=Das Popup schließt sich automatisch, nachdem du angemeldet wurdest. @@ -93,5 +95,3 @@ popup.download.title=Lade herunter... popup.update.info=Du verwendest eine alte Version von ViaProxy!\nAktuelle Version: %s\nNeueste Version: %s popup.update.question=Möchtest du aktualisieren? popup.update.success=Die neueste Version wurde heruntergeladen. ViaProxy startet jetzt neu! -tab.ui_settings.crowdin.info=Fehlt deine Sprache oder ist sie unvollständig? Hilf uns ViaProxy auf Crowdin zu übersetzen! -tab.ui_settings.crowdin.link=Klick hier um Crowdin zu öffnen diff --git a/src/main/resources/assets/viaproxy/language/en_US.properties b/src/main/resources/assets/viaproxy/language/en_US.properties index bafa0c3..09652fa 100644 --- a/src/main/resources/assets/viaproxy/language/en_US.properties +++ b/src/main/resources/assets/viaproxy/language/en_US.properties @@ -86,6 +86,8 @@ tab.ui_settings.name=UI Settings tab.ui_settings.language.label=Language: tab.ui_settings.language.completion=%s translated tab.ui_settings.language.success=Language changed to %s (%s). ViaProxy will now restart! +tab.ui_settings.crowdin.info=Is your language missing or incomplete? Help us to translate ViaProxy on Crowdin! +tab.ui_settings.crowdin.link=Click here to go to Crowdin popup.login_account.title=Add Account popup.login_account.instructions.browser=Please open the following URL in your browser: popup.login_account.instructions.close=The popup will close automatically after you have been logged in. @@ -93,5 +95,3 @@ popup.download.title=Downloading... popup.update.info=You are running an outdated version of ViaProxy!\nCurrent version: %s\nLatest version: %s popup.update.question=Do you want to update? popup.update.success=Downloaded the latest version of ViaProxy. ViaProxy will now restart! -tab.ui_settings.crowdin.info=Is your language missing or incomplete? Help us to translate ViaProxy on Crowdin! -tab.ui_settings.crowdin.link=Click here to go to Crowdin diff --git a/src/main/resources/assets/viaproxy/language/ko_KR.properties b/src/main/resources/assets/viaproxy/language/ko_KR.properties index 0000c77..c6d045e 100644 --- a/src/main/resources/assets/viaproxy/language/ko_KR.properties +++ b/src/main/resources/assets/viaproxy/language/ko_KR.properties @@ -86,6 +86,8 @@ tab.ui_settings.name=UI 설정 tab.ui_settings.language.label=언어 선택: tab.ui_settings.language.completion=%s 번역됨 tab.ui_settings.language.success=%s (%s)으로 언어 변경에 성공했습니다. ViaProxy가 곧 재시작합니다. +tab.ui_settings.crowdin.info=언어가 없거나 미완성되었나요? Crowdin에서 ViaProxy 번역에 도움을 주실 수 있어요! +tab.ui_settings.crowdin.link=클릭해서 Crowdin 가기 popup.login_account.title=계정 추가 popup.login_account.instructions.browser=브라우저에서 이 링크를 열어주세요: popup.login_account.instructions.close=이 창은 당신이 로그인한 뒤 자동으로 닫힙니다. @@ -93,5 +95,3 @@ popup.download.title=다운로드 중... popup.update.info=ViaProxy의 구버전을 사용하고 있습니다!\n현재 버전: %s\n최신 버전: %s popup.update.question=업데이트 하시겠습니까? popup.update.success=ViaProxy 최신 버전이 다운로드되었습니다. ViaProxy가 곧 재시작합니다. -tab.ui_settings.crowdin.info=언어가 없거나 미완성되었나요? Crowdin에서 ViaProxy 번역에 도움을 주실 수 있어요! -tab.ui_settings.crowdin.link=클릭해서 Crowdin 가기 diff --git a/src/main/resources/assets/viaproxy/language/zh_CN.properties b/src/main/resources/assets/viaproxy/language/zh_CN.properties index 3b1bf9d..8d8bc91 100644 --- a/src/main/resources/assets/viaproxy/language/zh_CN.properties +++ b/src/main/resources/assets/viaproxy/language/zh_CN.properties @@ -86,6 +86,8 @@ tab.ui_settings.name=界面设置 tab.ui_settings.language.label=语言: tab.ui_settings.language.completion=已翻译%s tab.ui_settings.language.success=语言已更改为%s(%s)。ViaProxy即将重新启动! +tab.ui_settings.crowdin.info=你的语言是否缺失或不完整?帮助我们在Crowdin上翻译 ViaProxy! +tab.ui_settings.crowdin.link=单击此处前往Crowdin popup.login_account.title=添加账户 popup.login_account.instructions.browser=请在浏览器中打开以下URL: popup.login_account.instructions.close=登录后,弹窗将自动关闭。 @@ -93,5 +95,3 @@ popup.download.title=正在下载… popup.update.info=你正在使用过时的ViaProxy版本!\n当前版本:%s\n最新版本:%s popup.update.question=是否更新? popup.update.success=已下载最新版本的ViaProxy。ViaProxy即将重新启动! -tab.ui_settings.crowdin.info=你的语言是否缺失或不完整?帮助我们在Crowdin上翻译 ViaProxy! -tab.ui_settings.crowdin.link=单击此处前往Crowdin diff --git a/src/main/resources/assets/viaproxy/language/zh_TW.properties b/src/main/resources/assets/viaproxy/language/zh_TW.properties index 54a7f1c..3bfbdaa 100644 --- a/src/main/resources/assets/viaproxy/language/zh_TW.properties +++ b/src/main/resources/assets/viaproxy/language/zh_TW.properties @@ -86,6 +86,8 @@ tab.ui_settings.name=介面 tab.ui_settings.language.label=語言: tab.ui_settings.language.completion=已翻譯 %s tab.ui_settings.language.success=語言已變更為%s(%s)。ViaProxy 即將重新啟動! +tab.ui_settings.crowdin.info=你使用的語言有缺失嗎? 在Crowdin上幫助ViaProxy翻譯吧! +tab.ui_settings.crowdin.link=點這裡前往Crowdin popup.login_account.title=新增帳號 popup.login_account.instructions.browser=請在瀏覽器中開啟以下 URL: popup.login_account.instructions.close=登入後,彈出式視窗將自動關閉。 @@ -93,5 +95,3 @@ popup.download.title=正在下載... popup.update.info=你正在使用的 ViaProxy 版本太舊!\n目前版本:%s\n最新版本:%s popup.update.question=你想要更新嗎? popup.update.success=已下載 ViaProxy 的最新版本。ViaProxy 即將重新啟動! -tab.ui_settings.crowdin.info=你使用的語言有缺失嗎? 在Crowdin上幫助ViaProxy翻譯吧! -tab.ui_settings.crowdin.link=點這裡前往Crowdin