private static function store($locale, $entries) { $file = self::getFile($locale); $dir = dirname($file); if (!is_dir($dir)) { mkdir($dir, 0755, true); } Generators\Mo::toFile($entries, $file . 'mo'); Generators\Po::toFile($entries, $file . 'po'); Generators\PhpArray::toFile($entries, $file . 'php'); return $entries; }
public function saveSectionTranslationsToFile(Section $section, Translations $translations) { $po = DIR_LANGUAGES_SITE_INTERFACE . '/' . $section->getLocale() . '.po'; $mo = DIR_LANGUAGES_SITE_INTERFACE . '/' . $section->getLocale() . '.mo'; PoGenerator::toFile($translations, $po); /* Do not generate mo for empty catalog, it crashes Zend\I18n gettext loader */ $empty = true; foreach ($translations as $entry) { if ($entry->hasTranslation()) { $empty = false; break; } } if (!$empty) { MoGenerator::$includeEmptyTranslations = true; MoGenerator::toFile($translations, $mo); } else { if (is_file($mo)) { unlink($mo); } } }