#!/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