Пример #1
0
 /**
  * Update the translation for an extension
  *
  * @param string $extensionKey The extension key
  * @param string $locale Locale to update
  * @return int Translation state
  */
 protected function updateTranslationForExtension($extensionKey, $locale)
 {
     if (empty($extensionKey) || empty($locale)) {
         return static::TRANSLATION_INVALID;
     }
     $state = static::TRANSLATION_FAILED;
     $updateResult = $this->terService->updateTranslation($extensionKey, $locale, $this->getMirrorUrl($extensionKey));
     if ($updateResult === true) {
         $state = static::TRANSLATION_UPDATED;
     }
     return $state;
 }
Пример #2
0
 /**
  * Update the translation for an extension
  *
  * @param string $extensionKey The extension key
  * @param string $locale Locale to update
  * @return int Translation state
  * @throws \Exception
  */
 protected function updateTranslationForExtension($extensionKey, $locale)
 {
     if (empty($extensionKey) || empty($locale)) {
         return static::TRANSLATION_INVALID;
     }
     $mirrorUrl = $this->getMirrorUrl($extensionKey);
     if (empty($mirrorUrl)) {
         throw new \Exception('Not able to fetch languages files due to missing mirror url.', 1461248062);
     }
     $state = static::TRANSLATION_FAILED;
     $updateResult = $this->terService->updateTranslation($extensionKey, $locale, $mirrorUrl);
     if ($updateResult === true) {
         $state = static::TRANSLATION_UPDATED;
     }
     return $state;
 }