Prida remote soubor
@param string $file
@param string $locale
@return self
334533
public function addRemoteFile(string $file, string $locale = null): self
	{
		$collection = $this->getCollection($this->getType($file), $locale);
		$collection->addRemoteFile($file);
		return $this;
	}
1229745
public function pathToFile($file, $locale): string
    {
        return resource_path('lang'.DIRECTORY_SEPARATOR.(is_a($locale, Locale::class) ? $locale->iso6391() : $locale).DIRECTORY_SEPARATOR.$file.'.php');
    }
1355686
public function getTranslationFile($locale)
    {
        if (isset($this->locales[$locale]) === false) {
            return null;
        }

        return $this->locales[$locale];
    }
130599
public static function setLocale($locale=null)
    {
        global $CFG, $TSUGI_LOCALE, $TSUGI_LOCALE_RELOAD;

        // No internationalization support
        if ( isset($CFG->legacytranslation) ) {
            if ( ! function_exists('bindtextdomain') ) return;
            if ( ! function_exists('textdomain') ) return;
        }

        if ( isset($CFG->legacytranslation) && $locale && 
            strpos($locale, 'UTF-8') === false ) $locale = $locale . '.UTF-8';

        if ( $locale === null && isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ) {

            if ( class_exists('\Locale') ) {
                try {
                    // Symfony may implement a stub for this function that throws an exception
                    $locale = \Locale::acceptFromHttp($_SERVER['HTTP_ACCEPT_LANGUAGE']);
                } catch (exception $e) { }
            }
            if ($locale === null) { // Crude fallback if we can't use Locale::acceptFromHttp
                $pieces = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
                $locale = $pieces[0];
            }
        }

        if ( $locale === null && isset($CFG->fallbacklocale) && $CFG->fallbacklocale ) {
            $locale = $CFG->fallbacklocale;
        }

        if ( $locale === null ) return;

        $locale = str_replace('-','_',$locale);
        if ( isset($CFG->legacytranslation) ) {
            putenv('LC_ALL='.$locale);
            setlocale(LC_ALL, $locale);
        }
        // error_log("setLocale=$locale");
        if ( $TSUGI_LOCALE != $locale ) $TSUGI_LOCALE_RELOAD = true;
        $TSUGI_LOCALE = $locale;
    }
569527
public function setLocale($locale = null)
    {
        $locale = self::_prepareLocale($locale);

        if (isset(self::$_localeData[(string) $locale]) === false) {
            $region = substr((string) $locale, 0, 3);
            if (isset($region[2]) === true) {
                if (($region[2] === '_') or ($region[2] === '-')) {
                    $region = substr($region, 0, 2);
                }
            }

            if (isset(self::$_localeData[(string) $region]) === true) {
                $this->_locale = $region;
            } else {
                $this->_locale = 'root';
            }
        } else {
            $this->_locale = $locale;
        }
    }
434923
public static function fromLocale(string $locale): LocaleFormatter
    {
        $formatter = new NumberFormatter((string) $locale, NumberFormatter::CURRENCY);

        return new self($formatter);
    }
685444
public static function setLocale(string $locale, string $backup) : array {
		$result = [
			'locale_locales' => [],
			'locale_locale_js' => null,
			'locale_set_name' => null,
			'locale_options' => [],
			'locale_override_class' => null
		];
		$temp = $locale;
		$result['locale_locales'] = [];
		$result['locale_locales'][] = $temp;
		if (strpos($temp, '@') !== false) {
			$temp = explode('@', $temp);
			$temp = $temp[0];
			$result['locale_locales'][] = $temp;
		}
		if (strpos($temp, '.') !== false) {
			$temp = explode('.', $temp);
			$temp = $temp[0];
			$result['locale_locales'][] = $temp;
		}
		$result['locale_locale_js'] = str_replace('_', '-', $temp);
		$result['locale_set_name'] = setlocale(LC_ALL, $result['locale_locales']);
		// grab settings
		$result['locale_options'] = localeconv();
		// form a class name from locale name
		// todo: finilize locale
		$class = str_replace('-', '', $locale);
		$class = str_replace('.', '_', $class);
		$class = strtolower($class);
		// see if class exists
		$override_format_filename = __DIR__ . '/Object/Format/Locales/' . $class . '.php';
		if (file_exists($override_format_filename)) {
			require_once($override_format_filename);
			$class = 'object_format_locales_' . $class;
			$result['locale_override_class'] = $class;
			// grab overrides
			$result['locale_options'] = $class::localeconv($result['locale_options']);
			// if locale does not exists but we have override we simply accept it
			if (empty($result['locale_set_name'])) {
				$result['locale_set_name'] = $locale;
			}
		} else if (empty($result['locale_set_name']) && !empty($backup)) {
			$result = self::setLocale($backup, '');
		}
		return $result;
	}
32666
public function setRelAuthor($relAuthor, $locale = null)
    {
        $this->translate($locale, false)->setRelAuthor($relAuthor);
        $this->mergeNewTranslations();

        return $this;
    }
980825
public function setActiveLocale($locale)
    {
        if (empty($locale)) {
            $this->getCore()->session()->forget(static::ACTIVE_LOCALE_SESSION_KEY);
        } else {
            $this->getCore()->session()->put(static::ACTIVE_LOCALE_SESSION_KEY, $locale);
        }

        return $this;
    }
1073188
private function setLocale(string $locale)
    {
        $arr = \Locale::parseLocale($locale);
        
        if ($arr === false) {
            throw new \InvalidArgumentException('Invalid locale');
        }
        
        $this->locale = $arr;
    }
165563
public function loadLocaleFile($file, $domain) {
		$filename = $this->findLocaleFile($file);

		if ($filename !== null) {
			$locale = $this->getLocaleFromFilename($filename);
			$translator = $this->service->getTranslator();
			$translator->addResource('json', $filename, $locale, $domain);
		}
	}
825598
public function joinTranslations($locale)
    {
        $this->getInstance()
            ->innerJoin($this->mainAlias.'.translations', 'translation', Expr\Join::WITH, 'translation.locale = :locale')
            ->setParameter('locale', $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;
    }
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;
    }
1362871
public static function create(string $text, string $locale = self::DEFAULT_LOCALE): self
    {
        return new self($text, $locale);
    }
1193885
public function setLocale(string $locale): self
	{
		if ($locale === '') {
			$this->locale = $locale;
		} else {
			if (!\Locale::parseLocale($locale)) {
				throw new \InvalidArgumentException(sprintf('Invalid locale "%s"', $locale));
			}
			$this->locale = \Locale::canonicalize($locale);
		}

		$this->setOptions['locale'] = null;

		return $this;
	}
358426
public function setFile($file, $contentDisposition = null, $autoLastModified = true)
    {
        $this->file = $file;

        if ($autoLastModified) {
            $this->setAutoLastModified();
        }

        if ($contentDisposition) {
            $this->setContentDisposition($contentDisposition);
        }

        return $this;
    }