mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2025-12-16 14:30:31 +00:00
Add crowdin CLI tool + my misc scripts, so I won't go crazy after all #431
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -22,6 +22,9 @@ GUI/debug
|
|||||||
# Ignore out
|
# Ignore out
|
||||||
out/
|
out/
|
||||||
|
|
||||||
|
# Crowdin CLI secret
|
||||||
|
tools/crowdin-cli/crowdin_identity.yaml
|
||||||
|
|
||||||
#################
|
#################
|
||||||
## Visual Studio
|
## Visual Studio
|
||||||
#################
|
#################
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
"preserve_hierarchy": true
|
||||||
files:
|
files:
|
||||||
- source: /ArchiSteamFarm/Localization/Strings.resx
|
- source: /ArchiSteamFarm/Localization/Strings.resx
|
||||||
translation: /ArchiSteamFarm/Localization/Strings.%locale%.resx
|
translation: /ArchiSteamFarm/Localization/Strings.%locale%.resx
|
||||||
|
|||||||
35
tools/crowdin-cli/README.md
Normal file
35
tools/crowdin-cli/README.md
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
Crowdin CLI
|
||||||
|
===================
|
||||||
|
|
||||||
|
**[Latest release](https://crowdin.com/downloads/crowdin-cli.zip)**
|
||||||
|
**[Source](https://github.com/crowdin/crowdin-cli-2)**
|
||||||
|
**[Help](https://support.crowdin.com/cli-tool/#cli-2)**
|
||||||
|
|
||||||
|
===================
|
||||||
|
|
||||||
|
This tool is being used by ASF developers for synchronization of strings/translations between GitHub and **[Crowdin](https://github.com/JustArchi/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.yaml``` 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.yaml``` and fill ```api_key```.
|
||||||
|
|
||||||
|
Ensure that ```crowdin``` command is recognized by your OS.
|
||||||
|
|
||||||
|
===================
|
||||||
|
|
||||||
|
### Windows
|
||||||
|
|
||||||
|
- Install **[Java JDK](http://www.oracle.com/technetwork/java/javase/downloads/index.html)**.
|
||||||
|
- **[Set JAVA_HOME properly](https://confluence.atlassian.com/doc/setting-the-java_home-variable-in-windows-8895.html)**
|
||||||
|
- Launch ```setup_crowdin.bat``` as administrator
|
||||||
|
- Open new ```cmd``` prompt and verify that ```crowdin help``` indeed works
|
||||||
|
|
||||||
|
===================
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```archi_download.bat``` for downloading translations from Crowdin (typically last commit before release)
|
||||||
|
```archi_upload.bat``` for pushing strings to Crowdin (when any *Strings.resx file gets modified)
|
||||||
|
|
||||||
4
tools/crowdin-cli/archi_download.bat
Normal file
4
tools/crowdin-cli/archi_download.bat
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
@echo off
|
||||||
|
cd ..\\..
|
||||||
|
call crowdin -b master --identity tools\\crowdin-cli\\crowdin_identity.yaml download
|
||||||
|
pause
|
||||||
4
tools/crowdin-cli/archi_upload.bat
Normal file
4
tools/crowdin-cli/archi_upload.bat
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
@echo off
|
||||||
|
cd ..\\..
|
||||||
|
call crowdin -b master --identity tools\\crowdin-cli\\crowdin_identity.yaml upload sources
|
||||||
|
pause
|
||||||
BIN
tools/crowdin-cli/crowdin-cli.jar
Normal file
BIN
tools/crowdin-cli/crowdin-cli.jar
Normal file
Binary file not shown.
2
tools/crowdin-cli/crowdin.bat
Normal file
2
tools/crowdin-cli/crowdin.bat
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
@echo off
|
||||||
|
IF "%CROWDIN_HOME%"=="" (ECHO crowdin is NOT defined) ELSE (java -jar %CROWDIN_HOME%\crowdin-cli.jar %*)
|
||||||
26
tools/crowdin-cli/crowdin.sh
Normal file
26
tools/crowdin-cli/crowdin.sh
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
if type -p java; then
|
||||||
|
_java=java
|
||||||
|
elif [[ -n "$JAVA_HOME" ]] && [[ -x "$JAVA_HOME/bin/java" ]]; then
|
||||||
|
_java="$JAVA_HOME/bin/java"
|
||||||
|
else
|
||||||
|
echo "Looks like JAVA is not installed. You can download it from https://www.java.com/"
|
||||||
|
fi
|
||||||
|
if [[ "$_java" ]]; then
|
||||||
|
version=$("$_java" -version 2>&1 | awk -F '"' '/version/ {print $2}')
|
||||||
|
if [[ "$version" > "1.7" ]]; then
|
||||||
|
echo Your Java version is "$version" - OK
|
||||||
|
sudo cp crowdin-cli.jar /usr/local/bin
|
||||||
|
echo alias crowdin="'java -jar /usr/local/bin/crowdin-cli.jar'" >> ~/.bashrc
|
||||||
|
echo alias crowdin="'java -jar /usr/local/bin/crowdin-cli.jar'" >> ~/.bash_profile
|
||||||
|
|
||||||
|
if [ -f ~/.bashrc ]; then
|
||||||
|
. ~/.bashrc
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f ~/.bash_profile ]; then
|
||||||
|
. ~/.bash_profile
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo Your Java version is "$version" - needs to be updated. You can download it from https://www.java.com/
|
||||||
|
fi
|
||||||
|
fi
|
||||||
2
tools/crowdin-cli/crowdin_identity_example.yaml
Normal file
2
tools/crowdin-cli/crowdin_identity_example.yaml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
"project_identifier": "archisteamfarm"
|
||||||
|
"api_key": "FILL_ME"
|
||||||
26
tools/crowdin-cli/setup_crowdin.bat
Normal file
26
tools/crowdin-cli/setup_crowdin.bat
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
@echo off
|
||||||
|
SETLOCAL
|
||||||
|
SET TEMPFILE=%TEMP%\tmpfile
|
||||||
|
|
||||||
|
setx /M CROWDIN_HOME "%cd%"
|
||||||
|
setx /M PATH "%PATH%;%cd%"
|
||||||
|
|
||||||
|
IF NOT EXIST "%JAVA_HOME%\bin\java.exe" (
|
||||||
|
ECHO Looks like JAVA is not installed
|
||||||
|
)
|
||||||
|
|
||||||
|
"%JAVA_HOME%\bin\java" -version 2>& 1 | FIND "java version" > %TEMPFILE%
|
||||||
|
SET /p VERSIONSTRING= < %TEMPFILE%
|
||||||
|
DEL %TEMPFILE%
|
||||||
|
SET MAJORVERSION=%VERSIONSTRING:~14,1%
|
||||||
|
SET MINORVERSION=%VERSIONSTRING:~16,1%
|
||||||
|
SET UPDATEVERSION=%VERSIONSTRING:~20,-1%
|
||||||
|
IF %MAJORVERSION% GTR 1 GOTO VALID
|
||||||
|
IF %MINORVERSION% GTR 7 GOTO VALID
|
||||||
|
IF %UPDATEVERSION% GTR 0 GOTO VALID
|
||||||
|
ECHO Your JAVA version should be updated. You can download it from https://www.java.com/
|
||||||
|
GOTO EXIT
|
||||||
|
|
||||||
|
:EXIT
|
||||||
|
ENDLOCAL
|
||||||
|
|
||||||
Reference in New Issue
Block a user