/** * Adds the translation snippets for the frontend and admin view to the shopware tables * * @throws Exception * @return array Languages returns an array of all languages currently supported */ private function _addTranslationSnippets() { $languages = array(); $csv = new Shopware_Plugins_Frontend_SofortPayment_Components_Services_Csv(); $helper = new Shopware_Plugins_Frontend_SofortPayment_Components_Helpers_Helper(); //Add snippets from the csv files $csv->setPath($this->_bootstrap->Path() . "snippets/"); $csv->loadCsvFiles(); $translations = $csv->getTranslations(); //Add Backend Snippets that are not included in the csv files $translations['de_DE']['sofort_admin_view_lable_date'] = 'Datum'; $translations['de_DE']['sofort_admin_view_lable_version'] = 'Version'; $translations['de_DE']['sofort_admin_view_lable_source'] = 'Ursprung'; $translations['de_DE']['sofort_admin_view_lable_entry'] = 'Eintrag'; $translations['de_DE']['sofort_admin_view_lable_action'] = 'Aktionen'; $translations['en_GB']['sofort_admin_view_lable_date'] = 'Date'; $translations['en_GB']['sofort_admin_view_lable_version'] = 'Version'; $translations['en_GB']['sofort_admin_view_lable_source'] = 'Source'; $translations['en_GB']['sofort_admin_view_lable_entry'] = 'Entry'; $translations['en_GB']['sofort_admin_view_lable_action'] = 'Actions'; //Save snippets try { foreach ($translations as $locale => $snippets) { $languages[] = $locale; $parameter['localeId'] = $helper->database()->getLocaleId($locale); $parameter['shopIds'] = $helper->database()->getShopIds($locale); array_walk($snippets, array(Shopware_Plugins_Frontend_SofortPayment_Components_Helpers_DatabaseHelper, 'addLocaleSnippet'), $parameter); } } catch (Exception $exception) { $this->uninstall(); throw new Exception("Can not insert translation-snippets." . $exception->getMessage()); } return $languages; }