/** * @depends testGetAvailableLanguages */ public function testGetPoFileUrl() { $url = ZurmoTranslationServerUtil::getPoFileUrl('de'); $headers = get_headers($url); list($version, $status_code, $msg) = explode(' ', $headers[0], 3); $this->assertEquals(200, intval($status_code)); }
/** * Updates a language */ public function updateLanguage($languageCode) { try { $language = ActiveLanguage::getByCode($languageCode); } catch (NotFoundException $e) { throw new NotFoundException(Zurmo::t('ZurmoModule', 'Language not active.')); } $translationUrl = ZurmoTranslationServerUtil::getPoFileUrl($language->code); // Check if the po file exists $headers = get_headers($translationUrl); list($version, $status_code, $msg) = explode(' ', $headers[0], 3); if ($status_code != 200) { throw new NotFoundException(Zurmo::t('ZurmoModule', 'Translation not available.')); } if (ZurmoMessageSourceUtil::importPoFile($language->code, $translationUrl)) { $language->lastUpdateDatetime = DateTimeUtil::convertTimestampToDbFormatDateTime(time()); if ($language->save()) { return true; } } throw new FailedServiceException(Zurmo::t('ZurmoModule', 'Unexpected error. Please try again later.')); }