Created
September 12, 2011 19:14
-
-
Save rissajeanne/1212100 to your computer and use it in GitHub Desktop.
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 | |
function i18nPOStrings() { | |
$locale = str_replace('-', '_', get_instance()->config->item('language_ui')->locale); | |
//$default = str_replace('-', '_', get_instance()->config->item('language_ui_default')->locale); | |
$dir = APPPATH . 'language/locale/' . $locale . '/LC_MESSAGES/'; | |
$files = glob($dir . '*.po'); | |
foreach ($files as $file) { | |
$contents .= file_get_contents($file) or die('Could not read from file.'); | |
preg_match_all('/msgid "(.*)"/', $contents, $keys); | |
preg_match_all('/msgstr "(.*)"/', $contents, $strings); | |
$output = array_combine($keys[1], $strings[1]); | |
} | |
return $output; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment