-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
50 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,58 +24,57 @@ | |
|
||
set -euxo pipefail | ||
|
||
if [ "$CIRCLE_PULL_REQUEST" == "" ]; then | ||
echo -e "Starting translation import...\n" | ||
|
||
echo -e "Starting translation import...\n" | ||
#go to home and setup git | ||
cd $HOME | ||
git config --global user.name 'github-actions[bot]' | ||
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | ||
|
||
#go to home and setup git | ||
cd $HOME | ||
git config --global user.email "${GIT_COMMIT_USER_EMAIL:-circle_ci@rm3l.org}" | ||
git config --global user.name "${GIT_COMMIT_USER_NAME:-'Circle CI'}" | ||
git clone --branch=master https://rm3l:$GITHUB_API_KEY@github.com/rm3l/maoni.git master > /dev/null | ||
|
||
git clone --branch=master https://rm3l:$GITHUB_API_KEY@github.com/rm3l/maoni.git master > /dev/null | ||
cd master | ||
mkdir -p crowdin-cli-gh | ||
cd crowdin-cli-gh | ||
wget -q https://github.com/crowdin/crowdin-cli/releases/download/3.19.4/crowdin-cli.zip | ||
unzip -qj crowdin-cli.zip | ||
cd .. | ||
|
||
cd master | ||
wget -q https://github.com/crowdin/crowdin-cli/releases/download/3.19.4/crowdin-cli.zip | ||
unzip -qj crowdin-cli.zip | ||
# Update sources | ||
java -jar crowdin-cli.jar upload sources | ||
# Download translations | ||
java -jar crowdin-cli.jar download | ||
rm -rf crowdin.bat crowdin-cli.jar crowdin-cli.zip crowdin.sh setup_crowdin.bat | ||
# Update sources | ||
java -jar ./crowdin-cli-gh/crowdin-cli.jar upload sources | ||
# Download translations | ||
java -jar ./crowdin-cli-gh/crowdin-cli.jar download | ||
|
||
# import listing graphics | ||
for playLangPath in ./maoni-sample/src/main/play/*-*; do | ||
# Crowdin reformats the 'title' file, which makes it unusable by the Play Publisher Gradle plugin | ||
awk 'BEGIN{f=1} /#X-Generator/{f=0} f{print} $0{f=1}' ${playLangPath}/listing/title > ${playLangPath}/listing/title.tmp | ||
mv ${playLangPath}/listing/title.tmp ${playLangPath}/listing/title | ||
sed -i 's/Maoni=//g' ${playLangPath}/listing/title | ||
for d in featureGraphic icon phoneScreenshots promoGraphic sevenInchScreenshots tenInchScreenshots tvBanner tvScreenshots; do | ||
cp -r ./maoni-sample/src/main/play/en-US/listing/${d} ${playLangPath}/listing/ || true | ||
done | ||
done | ||
rm -rf ./crowdin-cli-gh | ||
|
||
#Sanitize, so it compiles with what we have in Google Play Store | ||
rm -rf ./maoni-sample/src/main/play/af && mv ./maoni-sample/src/main/play/af-ZA ./maoni-sample/src/main/play/af | ||
rm -rf ./maoni-sample/src/main/play/ar && mv ./maoni-sample/src/main/play/ar-SA ./maoni-sample/src/main/play/ar | ||
rm -rf ./maoni-sample/src/main/play/ca && mv ./maoni-sample/src/main/play/ca-ES ./maoni-sample/src/main/play/ca | ||
rm -rf ./maoni-sample/src/main/play/ro && mv ./maoni-sample/src/main/play/ro-RO ./maoni-sample/src/main/play/ro | ||
rm -rf ./maoni-sample/src/main/play/sr && mv ./maoni-sample/src/main/play/sr-SP ./maoni-sample/src/main/play/sr | ||
rm -rf ./maoni-sample/src/main/play/uk && mv ./maoni-sample/src/main/play/uk-UA ./maoni-sample/src/main/play/uk | ||
rm -rf ./maoni-sample/src/main/play/vi && mv ./maoni-sample/src/main/play/vi-VN ./maoni-sample/src/main/play/vi | ||
rm -rf ./maoni-sample/src/main/play/{he-IL,af-ZA,ar-SA,ca-ES,ro-RO,sr-SP,uk-UA,vi-VN} | ||
#rm -rf ./maoni-sample/src/main/play/{ar,el-GR,fi-FI,nl-NL,ca,pt-PT,sr,it-IT,fr-FR,ja-JP,ru-RU,no-NO,da-DK,uk,sv-SE,de-DE,pl-PL,cs-CZ,zh-CN,es-ES,vi,zh-TW,hu-HU,tr-TR,pt-BR,af,ro,ko-KR,ar}/whatsnew | ||
# import listing graphics | ||
for playLangPath in ./maoni-sample/src/main/play/*-*; do | ||
# Crowdin reformats the 'title' file, which makes it unusable by the Play Publisher Gradle plugin | ||
awk 'BEGIN{f=1} /#X-Generator/{f=0} f{print} $0{f=1}' ${playLangPath}/listing/title > ${playLangPath}/listing/title.tmp | ||
mv ${playLangPath}/listing/title.tmp ${playLangPath}/listing/title | ||
sed -i 's/Maoni=//g' ${playLangPath}/listing/title | ||
for d in featureGraphic icon phoneScreenshots promoGraphic sevenInchScreenshots tenInchScreenshots tvBanner tvScreenshots; do | ||
cp -r ./maoni-sample/src/main/play/en-US/listing/${d} ${playLangPath}/listing/ || true | ||
done | ||
done | ||
|
||
#add, commit and push files | ||
# git add . | ||
# git remote rm origin | ||
# git remote add origin https://rm3l:[email protected]/rm3l/maoni.git | ||
#Sanitize, so it compiles with what we have in Google Play Store | ||
rm -rf ./maoni-sample/src/main/play/af && mv ./maoni-sample/src/main/play/af-ZA ./maoni-sample/src/main/play/af | ||
rm -rf ./maoni-sample/src/main/play/ar && mv ./maoni-sample/src/main/play/ar-SA ./maoni-sample/src/main/play/ar | ||
rm -rf ./maoni-sample/src/main/play/ca && mv ./maoni-sample/src/main/play/ca-ES ./maoni-sample/src/main/play/ca | ||
rm -rf ./maoni-sample/src/main/play/ro && mv ./maoni-sample/src/main/play/ro-RO ./maoni-sample/src/main/play/ro | ||
rm -rf ./maoni-sample/src/main/play/sr && mv ./maoni-sample/src/main/play/sr-SP ./maoni-sample/src/main/play/sr | ||
rm -rf ./maoni-sample/src/main/play/uk && mv ./maoni-sample/src/main/play/uk-UA ./maoni-sample/src/main/play/uk | ||
rm -rf ./maoni-sample/src/main/play/vi && mv ./maoni-sample/src/main/play/vi-VN ./maoni-sample/src/main/play/vi | ||
rm -rf ./maoni-sample/src/main/play/{he-IL,af-ZA,ar-SA,ca-ES,ro-RO,sr-SP,uk-UA,vi-VN} | ||
#rm -rf ./maoni-sample/src/main/play/{ar,el-GR,fi-FI,nl-NL,ca,pt-PT,sr,it-IT,fr-FR,ja-JP,ru-RU,no-NO,da-DK,uk,sv-SE,de-DE,pl-PL,cs-CZ,zh-CN,es-ES,vi,zh-TW,hu-HU,tr-TR,pt-BR,af,ro,ko-KR,ar}/whatsnew | ||
|
||
[[ -z $(git status --porcelain) ]] || \ | ||
( git add . && \ | ||
git commit -m "Automatic translation import (build #$CIRCLE_BUILD_NUM)." -m "Commit $CIRCLE_SHA1" && \ | ||
git pull --rebase && \ | ||
git push origin master 2>&1 ) | ||
[[ -z $(git status --porcelain) ]] || \ | ||
( git add . && \ | ||
git commit -m "Automatic translation import (build #$CI_BUILD_NUM)" \ | ||
-m "Commit $CI_SHA1" \ | ||
-m "Co-authored-by: $GITHUB_ACTOR <$GITHUB_ACTOR@users.noreply.github.com>" && \ | ||
git pull --rebase && \ | ||
git push origin master 2>&1 ) | ||
|
||
echo -e "... Done with importing translations from Crowdin\n" | ||
fi | ||
echo -e "... Done with importing translations from Crowdin\n" |