/** * Gets the language file for the given language and stores it. * * @param string $application The name of the application. * @param string $language The identifier of the language. * * @throws CurlException If there was an error during the download of the language file. * * @return bool The success of the operation. */ public function getFile($application, $language) { try { $result = ApiCall::call('system_api', 'language_api', array('system' => 'LanguageFiles', 'action' => 'getLanguageFile'), array('language' => $language)); $this->_apiErrorHandler->checkForApiErrorResult($result); } catch (\Exception $e) { echo '\\nError getting language file: (' . $application . '/' . $language . ') ' . $e->getMessage(); } return $result['data']; }
/** * Gets the available languages for the given applet. * * @param string $applet The applet identifier. * * @return array The list of the available applet languages. */ public function getAppletLanguages($applet) { $result = ApiCall::call('system_api', 'language_api', array('system' => 'LanguageFiles', 'action' => 'getAppletLanguages'), array('applet' => $applet)); try { $this->_apiErrorHandler->checkForApiErrorResult($result); } catch (\Exception $e) { echo "\nGetting languages for applet ({$applet}) was unsuccessful. {$e->getMessage()}"; } return $result['data']; }
/** * Gets a language xml for an applet. * * @param string $applet The identifier of the applet. * @param string $language The language identifier. * * @return string|false The content of the language file or false if weren't able to get it. */ protected static function getAppletLanguageFile($applet, $language) { $result = ApiCall::call('system_api', 'language_api', array('system' => 'LanguageFiles', 'action' => 'getAppletLanguageFile'), array('applet' => $applet, 'language' => $language)); try { self::checkForApiErrorResult($result); } catch (\Exception $e) { throw new \Exception('Getting language xml for applet: (' . $applet . ') on language: (' . $language . ') was unsuccessful: ' . $e->getMessage()); } return $result['data']; }