Initializes field descriptors for product media.

@param string $locale
189669
protected function initFieldDescriptors($locale)
    {
        $this->fieldDescriptors = [];

        $mediaJoin = [
            self::$mediaEntityName => new DoctrineJoinDescriptor(
                self::$mediaEntityName,
                $this->productEntityName . '.media',
                null,
                DoctrineJoinDescriptor::JOIN_METHOD_INNER
            ),
        ];
        $fileVersionJoin = array_merge(
            $mediaJoin,
            [
                self::$fileEntityName => new DoctrineJoinDescriptor(
                    self::$fileEntityName,
                    self::$mediaEntityName . '.files'
                ),
                self::$fileVersionEntityName => new DoctrineJoinDescriptor(
                    self::$fileVersionEntityName,
                    self::$fileEntityName . '.fileVersions',
                    self::$fileVersionEntityName . '.version = ' . self::$fileEntityName . '.version'
                ),
            ]
        );
        $fileVersionMetaJoin = array_merge(
            $fileVersionJoin,
            [
                self::$fileVersionMetaEntityName => new DoctrineJoinDescriptor(
                    self::$fileVersionMetaEntityName,
                    self::$fileVersionEntityName . '.meta',
                    self::$fileVersionMetaEntityName . '.locale = \'' . $locale . '\''
                ),
            ]
        );

        $this->fieldDescriptors['product'] = new DoctrineFieldDescriptor(
            'id',
            'product',
            $this->productEntityName,
            null,
            [],
            true,
            false
        );

        $this->fieldDescriptors['id'] = new DoctrineFieldDescriptor(
            'id',
            'id',
            self::$mediaEntityName,
            'public.id',
            $mediaJoin,
            true,
            false
        );

        $this->fieldDescriptors['thumbnails'] = new DoctrineFieldDescriptor(
            'id',
            'thumbnails',
            self::$mediaEntityName,
            'media.media.thumbnails',
            $mediaJoin,
            false,
            true,
            'thumbnails',
            '',
            '',
            false
        );

        $this->fieldDescriptors['name'] = new DoctrineFieldDescriptor(
            'name',
            'name',
            self::$fileVersionEntityName,
            'public.name',
            $fileVersionJoin
        );

        $this->fieldDescriptors['size'] = new DoctrineFieldDescriptor(
            'size',
            'size',
            self::$fileVersionEntityName,
            'media.media.size',
            $fileVersionJoin,
            false,
            true,
            'bytes'
        );

        $this->fieldDescriptors['changed'] = new DoctrineFieldDescriptor(
            'changed',
            'changed',
            self::$fileVersionEntityName,
            'public.changed',
            $fileVersionJoin,
            true,
            false,
            'date'
        );

        $this->fieldDescriptors['created'] = new DoctrineFieldDescriptor(
            'created',
            'created',
            self::$fileVersionEntityName,
            'public.created',
            $fileVersionJoin,
            true,
            false,
            'date'
        );

        $this->fieldDescriptors['title'] = new DoctrineFieldDescriptor(
            'title',
            'title',
            self::$fileVersionMetaEntityName,
            'public.title',
            $fileVersionMetaJoin,
            false,
            true,
            'title'
        );

        $this->fieldDescriptors['description'] = new DoctrineFieldDescriptor(
            'description',
            'description',
            self::$fileVersionMetaEntityName,
            'media.media.description',
            $fileVersionMetaJoin
        );
    }
378862
private function withBuiltInTemplates(string $locale): ValidatorFactory
    {
        $templates = include(__DIR__ . '/../lang/' . $locale . '.php');

        return $this->withDefaultTemplates($templates);
    }
525496
public function setLocale($locale)
	{
		$this['config']->set('app.locale', $locale);

		$this['translator']->setLocale($locale);

		$this['events']->fire('locale.changed', array($locale));
	}
783069
public function setLocale( MShop_Locale_Item_Interface $locale )
	{
		$this->_notifyListeners( 'setLocale.before', $locale );

		$this->_locale = clone $locale;
		$this->_modified = true;

		$this->_notifyListeners( 'setLocale.after', $locale );
	}
606754
public static function setLocale($locale)
		{
			static::$_locale = $locale;

			// Apply to PHP locale
			$sysLocales = \ChickenWire\Application::getConfiguration()->systemLocales;
			if (array_key_exists($locale, $sysLocales)) {
				setlocale(LC_ALL, $sysLocales[$locale]);
			}

		}
927451
public function setLocale($locale)
    {
        // Setup the Framework locale.
        $this->locale = $locale;

        // Retrieve the full locale from languages list.
        $language = array_get($this->languages, $locale .'.locale', 'en_US') .'.utf8';

        // Setup the Carbon and PHP's time locale.
        setlocale(LC_TIME, $language);

        Carbon::setLocale($locale);
    }
941920
public function setLocale($locale = null, $remember = false)
    {
        $this->_locale->setLocale($locale);
        $t = $this->getTranslator();
        if ($t->isAvailable($this->_locale))
            $t->setLocale($this->_locale);
        if ($remember) $this->_session->locale = $this->_locale->toString();
    }
29455
public static function getDisplayLanguages($locale)
    {
        if (!isset(self::$languages[$locale])) {
            self::$languages[$locale] = Intl::getLanguageBundle()->getLanguageNames($locale);
        }

        return self::$languages[$locale];
    }
976403
protected function markAsInitializedLocale($locale, $domain) {
		if (! isset($this->initializedCatalogs[$locale])) {
			$this->initializedCatalogs[$locale] = [];
		}

		if (is_string($domain)) {
			$this->initializedCatalogs[$locale][$domain] = true;
			return;
		}

		if (is_array($domain)) {
			$this->initializedCatalogs[$locale] += array_combine($domain, array_fill_keys($domain, true));
			return;
		}
	}
1220198
protected function markAsInitialized($locale, $domain) {
		if (! isset($this->initializedCatalogs[$locale])) {
			$this->initializedCatalogs[$locale] = [];
		}

		$this->initializedCatalogs[$locale][$domain] = true;
	}
205388
public function setLocale($locale)
    {
        $this->locale = $locale;
        if ($this->coreFormatter instanceof Multilingual) {
            $this->coreFormatter->setLocale($locale);
        }
        if ($this->textProvider instanceof Multilingual) {
            $this->textProvider->setLocale($locale);
        }
        return $this;
    }
683336
protected function initLocale($locale)
    {
        $file = $this->localeDir . '/' . $locale . '.php';
        if (file_exists($file)) {
            $data = include $file;

            if (!is_array($data)) {
                $data = [];
            }
        } else {
            $data = [];
        }

        if (!isset($data['pluralForm']) || !is_callable($data['pluralForm'])) {
            $data['pluralForm'] = null;
        }
        if (!isset($data['texts'])) {
            $data['texts'] = [];
        }

        $this->data[$locale] = $data;
    }
392482
public function store($locale)
    {
        foreach ($this->stores as $store) {
            $this->getInstance($store)->store($locale);
        }
    }
1004825
public function setUserLocale($locale)
    {
        $locales = $this->getAvailableLocales();
        $this->userManager->setLocale($this->getCurrentUser(), $locale);
    }
963639
private function loadData($locale)
    {
        if (!empty($this->ids)) {
            return $this->mediaManager->getByIds($this->ids, $locale);
        } else {
            return [];
        }
    }
386315
public static final function configuration(string $locale) {
    if (!empty($locale)) {
      Lang::$locale = $locale;
    } else {
      Lang::$locale = Lang::STANDARD_LOCALE;
    }
    return null;
  }
867715
public void setLocale(Locale locale) {
		if (!initialized) {
			super.setLocale(locale);
		} else {
			this.locale = locale;
			super.setLocale(locale);
			init();
		}
	}