Last active
March 6, 2019 14:23
-
-
Save edouard/55a05bc4842da12f5074ab8286e77506 to your computer and use it in GitHub Desktop.
Converts a language file from one format to another using PHP and the WebTranslateIt converter http://converter.webtranslateit.com
This file contains hidden or 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
<?php | |
// Converts a language file from one format to another using the WebTranslateIt converter | |
// http://converter.webtranslateit.com | |
// A ruby version can be found here: https://gist.github.com/edouard/093025ce172d266cc74fa7ab22349878 | |
// initialize the curl request | |
$request = curl_init("http:/converter.webtranslateit.com/converter"); | |
// send a file | |
curl_setopt($request, CURLOPT_POST, true); | |
curl_setopt( | |
$request, | |
CURLOPT_POSTFIELDS, | |
array( | |
'file' => new \CURLFile("en.xliff"), // for PHP > 5.5 | |
'convert_to' => 'AndroidXml2' | |
) | |
); | |
// output response | |
curl_setopt($request, CURLOPT_RETURNTRANSFER, true); | |
echo curl_exec($request); | |
// close session | |
curl_close($request); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment