-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
revised how we import locales into builds that are packaged for the c…
…lient so that we are always pulling from CurseForge locale
- Loading branch information
1 parent
f655f53
commit 35e9479
Showing
4 changed files
with
76 additions
and
34 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,3 +48,4 @@ node_modules | |
# Client related files we don't need to commit back to git | ||
CHANGES.txt | ||
db_client_*.lua | ||
.env |
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 |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/bin/bash | ||
# | ||
# Pull the localization data from CurseForge | ||
# | ||
# Setup: | ||
# Ensure this environment variable is set! | ||
# | ||
# CF_API_TOKEN | ||
# | ||
|
||
# Raider.IO Project ID | ||
CF_PROJECT_ID=279257 | ||
|
||
LOCALE_FOLDER=$1 | ||
|
||
if [ ! -d "$LOCALE_FOLDER" ]; then | ||
echo "Usage: $0 <locale_folder>" | ||
exit 1 | ||
fi | ||
|
||
echo "Updating latest locale files from CurseForge..." | ||
|
||
CF_LOCALE_FILE=locale_temp_cf.$$ | ||
for locale in deDE esES frFR itIT koKR ptBR ruRU zhCN zhTW ; do | ||
# where we will write out the newly created locale file | ||
NEW_LOCALE_FILE=locale_temp_new.$$ | ||
|
||
curl -s -H "x-api-token: $CF_API_TOKEN" -XGET "https://wow.curseforge.com/api/projects/$CF_PROJECT_ID/localization/export?table-name=L&export-type=TableAdditions&unlocalized=ShowBlankAsComment&lang=$locale" > $CF_LOCALE_FILE | ||
if [ "x$?" != "x0" ]; then | ||
echo "Failed to get locale $locale" | ||
rm $CF_LOCALE_FILE | ||
exit 1 | ||
fi | ||
|
||
grep 'L = L or' $CF_LOCALE_FILE > /dev/null | ||
if [ "x$?" != "x0" ]; then | ||
echo "Invalid results from locale query $locale" | ||
rm $CF_LOCALE_FILE | ||
exit 1 | ||
fi | ||
|
||
# where we are reading the source locale template file from | ||
LOCALE_TEMPLATE_FILE=${LOCALE_FOLDER}/${locale}.lua | ||
|
||
grep -- '--@localization' $LOCALE_TEMPLATE_FILE > /dev/null | ||
if [ "x$?" != "x0" ]; then | ||
echo "Failed to find localization tag in template file $LOCALE_TEMPLATE_FILE" | ||
rm $CF_LOCALE_FILE | ||
exit | ||
fi | ||
|
||
cat $CF_LOCALE_FILE | grep -v 'L = L or ' > $NEW_LOCALE_FILE | ||
|
||
DATE_TAG=$(date) | ||
echo "-- Generated from CurseForge on ${DATE_TAG}" > $NEW_LOCALE_FILE | ||
|
||
# append lines before the localization tag | ||
awk '/--@localization/ {exit} {print}' $LOCALE_TEMPLATE_FILE >> $NEW_LOCALE_FILE | ||
|
||
cat $CF_LOCALE_FILE | grep -v 'L = L or ' >> $NEW_LOCALE_FILE | ||
|
||
# append lines after the localization tag | ||
awk 'x==1 {print} /--@localization/ {x=1}' $LOCALE_TEMPLATE_FILE >> $NEW_LOCALE_FILE | ||
|
||
mv -v $NEW_LOCALE_FILE $LOCALE_TEMPLATE_FILE | ||
done | ||
|
||
rm $CF_LOCALE_FILE |
This file was deleted.
Oops, something went wrong.