commit 0e03bf873a4886f9c35ff576d730b2cbf3c74abf Author: Michael Clemens Date: Wed Nov 26 13:44:39 2014 +0100 first commit diff --git a/MSTerminology.sh b/MSTerminology.sh new file mode 100755 index 0000000..3f2318f --- /dev/null +++ b/MSTerminology.sh @@ -0,0 +1,67 @@ +#!/bin/bash +# This script translates terminologies used in MS products by sending a SOAP +# request to api.terminology.microsoft.com/terminology and extracting the result +# MS Language Portal: http://www.microsoft.com/Language/en-US/Search.aspx +# WSDL: http://api.terminology.microsoft.com/Terminology.svc?singleWsdl +# More info: http://www.microsoft.com/Language/de-de/Microsoft-Terminology-API.aspx +# +# Copyright (C) 2014 Michael Clemens +# +# This program is free software: you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation, either version 3 of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with this program. +# If not, see http://www.gnu.org/licenses/.# +# +# usage: ./MSTerminology "STRING TO BE TRANSLATED" + +text=$1 + +from="en-us" +to="de-de" +product="Windows" +version="7" + +xml=" \ + \ + \ + \ + ${text} \ + ${from} \ + ${to} \ + Contains \ + \ + UiStrings \ + \ + false \ + 1 \ + true \ + \ + \ + ${product} \ + \ + \ + ${version} \ + \ + \ + \ + \ + \ + \ +" + +output=$(curl -s -H "Content-Type: text/xml; charset=utf-8" -H "SOAPAction: \"http://api.terminology.microsoft.com/terminology/Terminology/GetTranslations\"" -d "${xml}" -X POST http://api.terminology.microsoft.com/Terminology.svc) + +result=$(echo ${output} | sed -e 's,.*\([^<]*\).*,\1,g') + +if [[ $result != *s:Envelope* ]]; then + echo $result +else + echo "'"$text"' could not be translated. The server's response was:" + echo $output +fi diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29