mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2025-12-16 06:20:34 +00:00
Upgrade my crowdin magic to ArchiCrodwin in preparation for #943
This commit is contained in:
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -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
|
||||
|
||||
11
appveyor.yml
11
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
|
||||
on_build_status_changed: false
|
||||
|
||||
11
crowdin.yml
11
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"
|
||||
}
|
||||
]
|
||||
]
|
||||
|
||||
1
tools/ArchiCrowdin
Submodule
1
tools/ArchiCrowdin
Submodule
Submodule tools/ArchiCrowdin added at 47a5365d05
@@ -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.
|
||||
@@ -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.
|
||||
@@ -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
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
Set-StrictMode -Version Latest
|
||||
|
||||
Push-Location "$PSScriptRoot\..\.."
|
||||
& archi_core.ps1 --download
|
||||
pause
|
||||
@@ -1,5 +0,0 @@
|
||||
Set-StrictMode -Version Latest
|
||||
|
||||
Push-Location "$PSScriptRoot\..\.."
|
||||
& archi_core.ps1 --upload --download
|
||||
pause
|
||||
@@ -1,5 +0,0 @@
|
||||
Set-StrictMode -Version Latest
|
||||
|
||||
Push-Location "$PSScriptRoot\..\.."
|
||||
& archi_core.ps1 --upload
|
||||
pause
|
||||
Binary file not shown.
@@ -1,2 +0,0 @@
|
||||
"project_identifier": "archisteamfarm"
|
||||
"api_key": "CROWDIN_API_KEY"
|
||||
Reference in New Issue
Block a user