Created
June 10, 2013 12:26
-
-
Save Jiwoks/5748358 to your computer and use it in GitHub Desktop.
This gist takes a Joomla language file and export as a po language file
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 | |
| /** | |
| * Php cli script | |
| * @param string file to convert | |
| * @param string file to save | |
| **/ | |
| if(empty($argv[1])){ | |
| die('You have to pass as first argument the file to parse'); | |
| } | |
| if(!empty($argv[2])){ | |
| $filesource = $argv[2]; | |
| }else{ | |
| $filesource = 'translated.po'; | |
| } | |
| $translations = parse_ini_file($argv[1]); | |
| $file = fopen($filesource, 'w+'); | |
| foreach ($translations as $key => $value) { | |
| fwrite($file, "msgid \"$key\" \r\n"); | |
| fwrite($file, "msgstr \"$value\" \r\n"); | |
| fwrite($file, "\r\n"); | |
| } | |
| fclose($file); | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment