Returns the current locale. This is the default locale if
no current locale has been set or the set current locale has
a language code of "mul".
public getCurrentLocale ( ) : |
||
Résultat |
/** * Returns the path to the existing localized version of file given. * * Searching is done for the current locale if no $locale parameter is * provided. The search is done according to the configured fallback * rule. * * If parameter $strict is provided, searching is done only for the * provided / current locale (without searching of files localized for * more generic locales). * * If no localized version of file is found, $filepath is returned without * any change. * * @param string $path Base directory to the translation files * @param string $sourceName name of the translation source * @param Locale $locale Desired locale of XLIFF file * @return array Path to the localized file (or $filename when no localized file was found) and the matched locale * @see Configuration::setFallbackRule() * @api */ public function getXliffFilenameAndPath($path, $sourceName, Locale $locale = null) { if ($locale === null) { $locale = $this->configuration->getCurrentLocale(); } foreach ($this->getLocaleChain($locale) as $localeIdentifier => $locale) { $possibleXliffFilename = Files::concatenatePaths([$path, $localeIdentifier, $sourceName . '.xlf']); if (file_exists($possibleXliffFilename)) { return [$possibleXliffFilename, $locale]; } } return [false, $locale]; }