diff --git a/.gitmodules b/.gitmodules index de8a8bc35..2c7e148b0 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,6 +4,9 @@ [submodule "ASF-ui"] path = ASF-ui url = https://github.com/JustArchiNET/ASF-ui +[submodule "tools/ArchiCrowdin"] + path = tools/ArchiCrowdin + url = https://github.com/JustArchiNET/ArchiCrowdin.git [submodule "wiki"] path = wiki url = https://github.com/JustArchiNET/ArchiSteamFarm.wiki.git diff --git a/appveyor.yml b/appveyor.yml index c856d9734..349895859 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -8,6 +8,7 @@ clone_depth: 10 environment: CROWDIN_API_KEY: secure: oGuZaQo2z5/JkEYaKrD9Ing+TgwZ3qQVf+9Jdz73Fephy04z5rWPGCCtkjaMLTcY + CROWDIN_PROJECT_IDENTIFIER: archisteamfarm # DOTNET_CHANNEL: 2.1 DOTNET_CLI_TELEMETRY_OPTOUT: true DOTNET_INSTALL_DIR: tools\dotnet @@ -227,13 +228,13 @@ after_test: Get-Job | Receive-Job -Wait -AutoRemoveJob - if (!($env:APPVEYOR_PULL_REQUEST_NUMBER) -and ($env:APPVEYOR_REPO_BRANCH -eq 'master') -and ($env:APPVEYOR_REPO_TAG -eq 'false') -and (Test-Path 'crowdin.yml' -PathType Leaf) -and (Test-Path 'tools\crowdin-cli\crowdin_identity_example.yml' -PathType Leaf) -and (Test-Path 'tools\crowdin-cli\archi_core.ps1' -PathType Leaf)) { - (Get-Content 'tools\crowdin-cli\crowdin_identity_example.yml').Replace('CROWDIN_API_KEY', "$env:CROWDIN_API_KEY") | Set-Content 'tools\crowdin-cli\crowdin_identity.yml' + if (!($env:APPVEYOR_PULL_REQUEST_NUMBER) -and ($env:APPVEYOR_REPO_BRANCH -eq 'master') -and ($env:APPVEYOR_REPO_TAG -eq 'false') -and (Test-Path 'crowdin.yml' -PathType Leaf) -and (Test-Path 'tools\ArchiCrowdin\crowdin_identity_example.yml' -PathType Leaf) -and (Test-Path 'tools\ArchiCrowdin\archi.ps1' -PathType Leaf)) { + (Get-Content 'tools\ArchiCrowdin\crowdin_identity_example.yml').Replace('CROWDIN_API_KEY', "$env:CROWDIN_API_KEY").Replace('CROWDIN_PROJECT_IDENTIFIER', "$env:CROWDIN_PROJECT_IDENTIFIER") | Set-Content 'tools\ArchiCrowdin\crowdin_identity.yml' try { - & tools\crowdin-cli\archi_core.ps1 --upload + & tools\ArchiCrowdin\archi.ps1 -u } finally { - Remove-Item 'tools\crowdin-cli\crowdin_identity.yml' + Remove-Item 'tools\ArchiCrowdin\crowdin_identity.yml' } } deploy: @@ -265,4 +266,4 @@ notifications: } on_build_success: true on_build_failure: true - on_build_status_changed: false \ No newline at end of file + on_build_status_changed: false diff --git a/crowdin.yml b/crowdin.yml index de42edb54..3f3f6bf36 100644 --- a/crowdin.yml +++ b/crowdin.yml @@ -1,18 +1,9 @@ "preserve_hierarchy": true "files": [ - # Note: any modifications to this file should carry appropriate modifications to tools/crowdin-cli scripts as well (CI integration) { "source": "/ArchiSteamFarm/Localization/Strings.resx", "translation": "/ArchiSteamFarm/Localization/Strings.%locale%.resx" }, - { - "source": "/ASF-ui/src/i18n/locale/default.json", - "translation": "/ASF-ui/src/i18n/locale/%locale%.json" - }, - { - "source": "/ASF-WebConfigGenerator/src/locale/strings.json", - "translation": "/ASF-WebConfigGenerator/src/locale/%locale%.json" - }, { "source": "/wiki/*.md", "translation": "/wiki/locale/%locale%/%file_name%-%locale%.%file_extension%", @@ -22,4 +13,4 @@ "source": "/wiki/_Sidebar.md", "translation": "/wiki/locale/%locale%/_Sidebar.md" } -] \ No newline at end of file +] diff --git a/tools/ArchiCrowdin b/tools/ArchiCrowdin new file mode 160000 index 000000000..47a5365d0 --- /dev/null +++ b/tools/ArchiCrowdin @@ -0,0 +1 @@ +Subproject commit 47a5365d055b7fd4d1deb1a20bf8918ce3b3c07d diff --git a/tools/crowdin-cli/LICENSE.md b/tools/crowdin-cli/LICENSE.md deleted file mode 100644 index 73df36c58..000000000 --- a/tools/crowdin-cli/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2017 crowdin - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/tools/crowdin-cli/README.md b/tools/crowdin-cli/README.md deleted file mode 100644 index 0cf557f8f..000000000 --- a/tools/crowdin-cli/README.md +++ /dev/null @@ -1,38 +0,0 @@ -Crowdin CLI -=================== - -**[Info](https://support.crowdin.com/cli-tool)** - -**[Source](https://github.com/crowdin/crowdin-cli-2)** - -**[Latest version](https://downloads.crowdin.com/cli/v2/crowdin-cli.zip)** - ---- - -Scripts included in this directory are used by ASF developers for synchronization of strings/translations between GitHub and **[Crowdin](https://github.com/JustArchiNET/ArchiSteamFarm/wiki/Localization)**. If you're not ASF developer that has access to our localization platform, then you won't find anything interesting here. - ---- - -## Before you begin - -Make sure that your `crowdin_identity.yml` file exists. This is the file with login credentials that is not being committed to GitHub. If it doesn't exist yet (e.g. because you've just cloned the repo), create it from `crowdin_identity_example.yml` and fill `api_key` that can be found in our **[project settings](https://crowdin.com/project/archisteamfarm/settings#api)**. - ---- - -## Installation - -Follow **[crowdin instructions](https://support.crowdin.com/cli-tool/#installation)** and ensure that `crowdin` command is recognized by your shell. This is recommended setup. - -Alternatively, at the bare minimum install latest **[Java JRE](https://www.oracle.com/technetwork/java/javase/downloads)**, ensure that `java` command is recognized by your shell and that your java version is able to execute bundled `crowdin-cli.jar`. - ---- - -## Usage - -`archi_upload` for pushing source strings to Crowdin (if not done automatically by CI). - -`archi_download` for downloading translated strings from Crowdin (if not done automatically by CI). - -`archi_sync` for upload + download. - -`archi_core` for custom workflows and integration. diff --git a/tools/crowdin-cli/archi_core.ps1 b/tools/crowdin-cli/archi_core.ps1 deleted file mode 100644 index 6302e858e..000000000 --- a/tools/crowdin-cli/archi_core.ps1 +++ /dev/null @@ -1,166 +0,0 @@ -Set-StrictMode -Version Latest -$ErrorActionPreference = 'Stop' -$ProgressPreference = 'SilentlyContinue' - -$branch = 'master' -$crowdinConfigPath = 'crowdin.yml' -$crowdinHomePath = 'tools\crowdin-cli' -$crowdinIdentityPath = "$crowdinHomePath\crowdin_identity.yml" -$crowdinJarPath = "$crowdinHomePath\crowdin-cli.jar" -$projectHomePath = '..\..' - -function Commit-Module($project, $path) { - Push-Location "$project" - - try { - git pull origin "$branch" - - if ($LastExitCode -ne 0) { - throw "Last command failed." - } - - git add -A "$path" - - if ($LastExitCode -ne 0) { - throw "Last command failed." - } - - git diff-index --quiet HEAD - - if ($LastExitCode -ne 0) { - git commit -m "Translations update" - - if ($LastExitCode -ne 0) { - throw "Last command failed." - } - } - } finally { - Pop-Location - } -} - -function Crowdin-Download { - Pull-Module 'ASF-ui' - Pull-Module 'ASF-WebConfigGenerator' - Pull-Module 'wiki' - - Crowdin-Execute 'download' - - Commit-Module 'ASF-ui' 'src\i18n\locale\*.json' - Commit-Module 'ASF-WebConfigGenerator' 'src\locale\*.json' - Commit-Module 'wiki' 'locale\*.md' - - git reset - - if ($LastExitCode -ne 0) { - throw "Last command failed." - } - - git add -A "ArchiSteamFarm\Localization\*.resx" "ASF-ui" "ASF-WebConfigGenerator" "wiki" - - if ($LastExitCode -ne 0) { - throw "Last command failed." - } - - git diff-index --quiet HEAD - - if ($LastExitCode -ne 0) { - git commit -m "Translations update" - - if ($LastExitCode -ne 0) { - throw "Last command failed." - } - } - - git push origin "$branch" --recurse-submodules=on-demand - - if ($LastExitCode -ne 0) { - throw "Last command failed." - } -} - -function Crowdin-Execute($command) { - if (Get-Command 'crowdin' -ErrorAction SilentlyContinue) { - & crowdin -b "$branch" --identity "$crowdinIdentityPath" $command - - if ($LastExitCode -ne 0) { - throw "Last command failed." - } - } elseif ((Test-Path "$crowdinJarPath" -PathType Leaf) -and (Get-Command 'java' -ErrorAction SilentlyContinue)) { - & java -jar "$crowdinJarPath" -b "$branch" --identity "$crowdinIdentityPath" $command - - if ($LastExitCode -ne 0) { - throw "Last command failed." - } - } else { - throw "Could not find crowdin executable!" - } -} - -function Crowdin-Upload { - Pull-Module 'ASF-ui' - Pull-Module 'ASF-WebConfigGenerator' - Pull-Module 'wiki' - - Crowdin-Execute 'upload sources' -} - -function Pull-Module($project) { - Push-Location "$project" - - try { - git checkout -f "$branch" - - if ($LastExitCode -ne 0) { - throw "Last command failed." - } - - git reset --hard - - if ($LastExitCode -ne 0) { - throw "Last command failed." - } - - git clean -fd - - if ($LastExitCode -ne 0) { - throw "Last command failed." - } - - git pull origin "$branch" - - if ($LastExitCode -ne 0) { - throw "Last command failed." - } - } finally { - Pop-Location - } -} - -Push-Location "$PSScriptRoot\$projectHomePath" - -try { - if (!(Test-Path "$crowdinConfigPath" -PathType Leaf)) { - throw "$crowdinConfigPath could not be found, aborting." - } - - if (!(Test-Path "$crowdinIdentityPath" -PathType Leaf)) { - throw "$crowdinIdentityPath could not be found, aborting." - } - - foreach ($arg in $args) { - switch -Wildcard ($arg) { - '*download' { - Crowdin-Download - } - '*upload' { - Crowdin-Upload - } - default { - throw "$arg action is unknown, aborting." - } - } - } -} finally { - Pop-Location -} diff --git a/tools/crowdin-cli/archi_download.ps1 b/tools/crowdin-cli/archi_download.ps1 deleted file mode 100644 index 33f3bd296..000000000 --- a/tools/crowdin-cli/archi_download.ps1 +++ /dev/null @@ -1,5 +0,0 @@ -Set-StrictMode -Version Latest - -Push-Location "$PSScriptRoot\..\.." -& archi_core.ps1 --download -pause diff --git a/tools/crowdin-cli/archi_sync.ps1 b/tools/crowdin-cli/archi_sync.ps1 deleted file mode 100644 index 90d3069eb..000000000 --- a/tools/crowdin-cli/archi_sync.ps1 +++ /dev/null @@ -1,5 +0,0 @@ -Set-StrictMode -Version Latest - -Push-Location "$PSScriptRoot\..\.." -& archi_core.ps1 --upload --download -pause diff --git a/tools/crowdin-cli/archi_upload.ps1 b/tools/crowdin-cli/archi_upload.ps1 deleted file mode 100644 index 42a1f9a74..000000000 --- a/tools/crowdin-cli/archi_upload.ps1 +++ /dev/null @@ -1,5 +0,0 @@ -Set-StrictMode -Version Latest - -Push-Location "$PSScriptRoot\..\.." -& archi_core.ps1 --upload -pause diff --git a/tools/crowdin-cli/crowdin-cli.jar b/tools/crowdin-cli/crowdin-cli.jar deleted file mode 100644 index 5bbb0ef1c..000000000 Binary files a/tools/crowdin-cli/crowdin-cli.jar and /dev/null differ diff --git a/tools/crowdin-cli/crowdin_identity_example.yml b/tools/crowdin-cli/crowdin_identity_example.yml deleted file mode 100644 index 7f904305f..000000000 --- a/tools/crowdin-cli/crowdin_identity_example.yml +++ /dev/null @@ -1,2 +0,0 @@ -"project_identifier": "archisteamfarm" -"api_key": "CROWDIN_API_KEY"