Skip to content

Commit

Permalink
add a script to automatically push translations to WowAce
Browse files Browse the repository at this point in the history
fix casing of some files

switch travis language to minimal
  • Loading branch information
Stanzilla committed Feb 16, 2018
1 parent a03d5a3 commit 5ded252
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ indent_size = 4
[.luacheckrc]
indent_style = tab
indent_size = 4

[*.sh]
end_of_line = lf
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
sudo: false
language: minimal

addons:
apt:
Expand All @@ -9,7 +9,9 @@ install:
- eval $(luarocks path --bin)
- luarocks install --local luacheck

script: /home/travis/.luarocks/bin/luacheck . --no-color -qo "011"
before_script: /home/travis/.luarocks/bin/luacheck . --no-color -qo "011"

script: ./wowace_translations.sh

notifications:
email:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local Type, Version = "WeakAurasMultiLineEditBox", 31
local Type, Version = "WeakAurasMultiLineEditBox", 32
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end

Expand All @@ -12,7 +12,7 @@ local _G = _G

-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
-- List them here for Mikk's FindGlobals script
-- GLOBALS: ACCEPT, ChatFontNormal
-- luacheck: globals ACCEPT ChatFontNormal AceGUIWeakAurasMultiLineEditBoxInsertLink

--[[-----------------------------------------------------------------------------
Support functions
Expand Down
5 changes: 3 additions & 2 deletions babelfish.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ local fileList = {
"WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasIconButton.lua",
"WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasImportButton.lua",
"WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasLoadedHeaderButton.lua",
"WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasMultiLineEditBox.lua",
"WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasNewButton.lua",
"WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasNewHeaderButton.lua",
"WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasSortedDropDown.lua",
Expand All @@ -43,8 +44,8 @@ local fileList = {
"WeakAurasOptions/OptionsFrames/OptionsFrame.lua",
"WeakAurasOptions/OptionsFrames/TextEditor.lua",
"WeakAurasOptions/OptionsFrames/TexturePicker.lua",
"WeakAurasOptions/RegionOptions/Aurabar.lua",
"WeakAurasOptions/RegionOptions/Dynamicgroup.lua",
"WeakAurasOptions/RegionOptions/AuraBar.lua",
"WeakAurasOptions/RegionOptions/DynamicGroup.lua",
"WeakAurasOptions/RegionOptions/Group.lua",
"WeakAurasOptions/RegionOptions/Icon.lua",
"WeakAurasOptions/RegionOptions/Model.lua",
Expand Down
41 changes: 41 additions & 0 deletions wowace_translations.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

declare -A locale_files=(
["WeakAuras"]="WeakAuras_Main.lua"
["WeakAuras/Options"]="WeakAuras_Options.lua"
["WeakAuras/Templates"]="WeakAuras_Templates.lua"
)

tempfile=$( mktemp )
trap 'rm -f $tempfile' EXIT

do_import() {
namespace="$1"
file="$2"
: > "$tempfile"

echo -n "Importing $namespace..."
result=$( curl -sS -X POST -w "%{http_code}" -o "$tempfile" \
-H "X-Api-Token: $CF_API_TOKEN" \
-F "metadata={ language: \"enUS\", namespace: \"$namespace\", \"missing-phrase-handling\": \"DeletePhrase\" }" \
-F "localizations=<$file" \
"https://www.wowace.com/api/projects/65387/localization/import"
) || exit 1
case $result in
200) echo "done." ;;
*)
echo "error! ($result)"
[ -s "$tempfile" ] && grep -q "errorMessage" "$tempfile" && cat "$tempfile" | jq --raw-output '.errorMessage'
exit 1
;;
esac
}

lua babelfish.lua || exit 1
echo

for namespace in "${!locale_files[@]}"; do
do_import "$namespace" "${locale_files[$namespace]}"
done

exit 0

0 comments on commit 5ded252

Please sign in to comment.