/** * Insert translations into database * * @param array $session Session array * * @return void */ protected function insertTranslations($session) { if (empty($session['copy_translations'])) { return; } //Save all languages in database $languagesFilename = glob(GC_APPLICATION_PATH . '/data/install/translation/*.php'); $translator = new Core\Translator(); foreach ($languagesFilename as $language) { $langConfig = (include $language); $locale = basename($language, '.php'); foreach ($langConfig as $source => $destination) { $translator->setValue($source, array(array('locale' => $locale, 'value' => $destination))); } copy($language, GC_APPLICATION_PATH . '/data/translation/' . basename($language)); } }
/** * Save translation * * @param Translator $translator Translator * @param string $locale Locale * @param string $source Source * @param string $value Value * * @return boolean */ protected function saveTranslation(Translator $translator, $locale, $source, $value) { return $translator->setValue($source, array(array('locale' => $locale, 'value' => $value))); }