Skip to content

Instantly share code, notes, and snippets.

@rissajeanne
Created September 12, 2011 19:14
Show Gist options
  • Save rissajeanne/1212100 to your computer and use it in GitHub Desktop.
Save rissajeanne/1212100 to your computer and use it in GitHub Desktop.
<?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