Creates new translation objects.

@param array $languageIds List of two letter ISO language IDs
@return \Aimeos\MW\Translation\Interface[] List of translation objects
972234
public function get( array $languageIds )
	{
		$i18nPaths = $this->container->get( 'aimeos' )->get()->getI18nPaths();

		foreach( $languageIds as $langid )
		{
			if( !isset( $this->i18n[$langid] ) )
			{
				$i18n = new \Aimeos\MW\Translation\Gettext( $i18nPaths, $langid );

				$apc = (bool) $this->container->getParameter( 'aimeos_shop.apc_enable' );
				$prefix = $this->container->getParameter( 'aimeos_shop.apc_prefix' );

				if( function_exists( 'apcu_store' ) === true && $apc === true ) {
					$i18n = new \Aimeos\MW\Translation\Decorator\APC( $i18n, $prefix );
				}

				$translations = $this->container->getParameter( 'aimeos_shop.i18n' );

				if( isset( $translations[$langid] ) ) {
					$i18n = new \Aimeos\MW\Translation\Decorator\Memory( $i18n, $translations[$langid] );
				}

				$this->i18n[$langid] = $i18n;
			}
		}

		return $this->i18n;
	}
932905
public function loadTranslations($languages)
    {
        $languages = (array)$languages;

        foreach ($languages as $language) {
            $this->loadTranslation($language);
        }
    }
364409
public function extractLanguageIdsFromMask($languageMask): array
    {
        $exp = 2;
        $result = array();

        // Decomposition of $languageMask into its binary components.
        while ($exp <= $languageMask) {
            if ($languageMask & $exp) {
                $result[] = $exp;
            }

            $exp *= 2;
        }

        return $result;
    }
126520
public static function getLanguageRedirects($languageRedirects)
    {
        if (!$languageRedirects && isset(Yii::$app->params['languageRedirects'])) {
            $languageRedirects = Yii::$app->params['languageRedirects'];
        }

        return $languageRedirects;
    }
723083
public function actionList(int $productId, int $languageId)
    {

        $product = Product::findOne($productId);
        $products = Product::find()->joinWith('translations')->orderBy('title')->all();
        $relatedProducts = $product->relatedProducts;
        $newRelatedProduct = new RelatedProduct();

        $selectedLanguage = Language::findOne($languageId);
        $languages = Language::find()->all();

        if (\Yii::$app->request->isPost && $newRelatedProduct->load(\Yii::$app->request->post())) {
            if (empty(RelatedProduct::find()
                ->where(['product_id' => $productId, 'related_product_id' => $newRelatedProduct->related_product_id])->one())
            ) {

                $newRelatedProduct->product_id = $productId;
                if ($newRelatedProduct->validate()) $newRelatedProduct->save();
                \Yii::$app->session->setFlash('info', \Yii::t('shop', 'Relation product has added successfully'));
            } else {
                \Yii::$app->session->setFlash('info', \Yii::t('shop', 'Such relation product already exists for this product'));
            }

            return $this->redirect(\Yii::$app->request->referrer);
        }

        return $this->render('../product/save', [
            'viewName' => '../related-product/list',
            'selectedLanguage' => $selectedLanguage,
            'product' => $product,
            'languages' => $languages,

            'params' => [
                'product' => $product,
                'products' => $products,
                'relatedProducts' => $relatedProducts,
                'newRelatedProduct' => $newRelatedProduct,
                'languages' => $languages,
                'selectedLanguage' => $selectedLanguage,
            ]
        ]);
    }
512093
protected function _addLanguage( MW_Container_Content_Interface $contentItem, $langid, array $ids )
	{
		$manager = MShop_Product_Manager_Factory::createManager( $this->_getContext() );
		$search = $manager->createSearch();

		if( !empty( $ids ) ) {
			$search->setConditions( $search->compare( '==', 'product.id', $ids ) );
		}

		$sort = array( $search->sort( '+', 'product.code' ) );
		$search->setSortations( $sort );

		$start = 0;

		do
		{
			$result = $manager->searchItems( $search, array('text') );

			foreach( $result as $item ) {
				$this->_addItem( $contentItem, $item, $langid );
			}

			$count = count( $result );
			$start += $count;
			$search->setSlice( $start );
		}
		while( $count == $search->getSliceSize() );
	}
467494
public function getSupportedLanguages($currentID)
    {
        $environment  = $this->getEnvironment();
        $dataProvider = $environment->getDataProvider();

        // Check if current data provider supports multi language.
        if ($dataProvider instanceof MultiLanguageDataProviderInterface) {
            $supportedLanguages = $dataProvider->getLanguages($currentID);
        } else {
            $supportedLanguages = null;
        }

        // Check if we have some languages.
        if (null === $supportedLanguages) {
            return [];
        }

        $translator = $environment->getTranslator();

        // Make an array from the collection.
        $languages = [];
        foreach ($supportedLanguages as $value) {
            /** @var LanguageInformationInterface $value */
            $locale = $value->getLocale();

            $languages[$locale] = $translator->translate('LNG.' . $locale, 'languages');
        }

        return $languages;
    }
979343
public function getRepositories(
        array $domains = [],
        array $languages = []
    ) : array {
        $repositories = array_filter(
            $this->repositories,
            function (Repository $repository) use ($domains) {
                return
                    empty($domains) ||
                    in_array($repository->getDomain(), $domains);
            }
        );

        return array_filter(
            $repositories,
            function (Repository $repository) use ($languages) {
                return
                    empty($languages) ||
                    in_array($repository->getLanguage(), $languages);
            }
        );
    }
1236548
protected function filterLanguages(array $contentLanguages): array
    {
        return array_filter(
            $this->languageService->loadLanguages(),
            function (Language $language) use ($contentLanguages) {
                return in_array($language->languageCode, $contentLanguages, true);
            }
        );
    }
1043955
public function getLanguagesWithMasterLanguagePromoted()
    {
        $languages = $this
            ->languageManager
            ->getLanguages()
            ->toArray();

        $masterLocale = $this
            ->masterLocale
            ->getIso();

        $index = array_search($masterLocale, $languages);

        if (false !== $index) {
            $mainLanguage = $languages[$index];
            unset($languages[$index]);
            array_unshift($languages, $mainLanguage);
        }

        return new ArrayCollection($languages);
    }
1007491
public function translateToAnyLanguageOf(array $languageCodes): self
    {
        foreach ($languageCodes as $languageCode) {
            if (!is_string($languageCode) || empty($languageCode)) {
                throw new InvalidArgumentException('$languageCodes', 'All language codes should be non-empty strings');
            }
        }

        $this->targetVersionProperties['allLanguageCodesList'] = $languageCodes;

        return $this;
    }
662893
public static function getLanguageTranslateByIdAndLanguageId($id, $languageId)
    {
        $languageTranslate = self::findOne(['id' => $id, 'language' => $languageId]);
        if (!$languageTranslate) {
            $languageTranslate = new self([
                'id' => $id,
                'language' => $languageId,
            ]);
        }

        return $languageTranslate;
    }
865808
public function translateToRoleIds($roles)
    {
        if (!is_array($roles)) {
            if ($roles) {
                $roles = explode(",", $roles);
            } else {
                $roles = array();
            }
        }

        $lookup = array_flip($this->_roleTranslations);

        foreach ($roles as $key => $role) {
            if (isset($lookup[$role])) {
                $roles[$key] = $lookup[$role];
            }
        }

        return $roles;
    }
842252
public function export(array $fieldIds)
    {
        $fields = array();

        foreach ($fieldIds as $fieldId) {
            $field = Craft::$app->fields->getFieldById($fieldId);

            if ($field) {
                $newField = array(
                    'name' => $field->name,
                    'handle' => $field->handle,
                    'instructions' => $field->instructions,
                    'required' => $field->required,
                    'translationMethod' => $field->translationMethod,
                    'translationKeyFormat' => $field->translationKeyFormat,
                    'type' => \get_class($field),
                    'settings' => $field->settings,
                );

                if (get_class($field) == 'craft\fields\Matrix') {
                    $newField['settings'] = $this->processMatrix($field);
                }

                if (get_class($field) == 'verbb\supertable\fields\SuperTableField') {
                    $newField['settings'] = $this->processSuperTable($field);
                }

                $fields[] = $newField;
            }
        }

        return $fields;
    }
149779
public function getPages($uids, int $languageUid = null): array {
    $pages = [];

    if (is_string($uids)) {
      $uids = GeneralUtility::intExplode(',', $uids, true);
    }

    if ($uids) {
      foreach($uids as $uid) {
        $record = $this->getPage($uid, $languageUid);

        if ($record) {
          $pages[] = $record;
        }
      }
    }

    return $pages;
  }
352291
public function removeTranslations($translationId)
    {
        return $this->createQueryBuilder('t')
            ->delete()
            ->where('t.translationId = :translationId')
            ->setParameter('translationId', $translationId)
            ->getQuery()
            ->execute();
    }
1048727
public function loadLanguageById($languageId)
    {
        $language = $this->languageHandler->load($languageId);

        return $this->buildDomainObject($language);
    }