@param string $key
@param string|null $locale

@return string
512300
public function getName(string $key, string $locale = null)
    {
        return $this->get($key, $locale);
    }
10969
public function get($key, $replacement = array(), $locale = null, $driver = null) {
       $driver = ! is_null($driver) ? $this->getDriver($driver) : $this->driver();

        return $driver
            ->get($key, $replacement, $locale);
    }
1107662
public function getTranslation(string $key, string $locale = null)
    {
        $this->throwExceptionIfAttributeIsNotTranslatable($key);

        $translations = $this->getTranslations($key);

        if (count($translations)) {
            $locale = $locale ?: config('app.locale');

            if (isset($translations[$locale])) {
                $translation = $translations[$locale];
            } else {
                $translation = $translations[$this->getDefaultLocale()] ?? head($translations);
            }

        } else {
            $translation = null;
        }

        if ($this->hasGetMutator($key)) {
            return $this->mutateAttribute($key, $translation);
        }

        return $translation;
    }
716221
@SuppressWarnings("unchecked")
  public <T> T getField(String key, String locale) {
    if (fields == null) {
      return null;
    }

    LinkedHashMap<String, Object> field = fields.get(key);
    if (field == null) {
      return null;
    } else {
      return (T) field.get(locale);
    }
  }
1308694
protected function getUrlLanguage($locale = null)
    {
        // Check if the functionality is activated
        if (!ConfigQuery::isMultiDomainActivated()) {
            return null;
        }

        // If we don't have a locale value, use the locale value in the session
        if (!$locale) {
            $locale = $this->getCurrentEditionLocale();
        }

        return LangQuery::create()->findOneByLocale($locale)->getUrl();
    }
533733
public function searchHelpTextByKeyLocale($translationKey, $locale)
    {
        $qb = $this->createQueryBuilder('h');
        $qb->where('h.locale LIKE :locale')
            ->andWhere('h.translationKey LIKE :translationKey')
            ->orderBy('h.id', 'asc')
            ->setParameter(':locale', substr($locale, 0, 2).'%')
            ->setParameter(':translationKey', $translationKey.'%');

        return $qb->getQuery()->getResult();
    }
888660
public function translate(string $key, ?string $lang = null): ?string
    {
        try {
            // Validate key
            $key = strtolower($key);
            if (!preg_match('/^[a-z0-9\.\-\_]+$/', $key)) {
                throw new TranslatorException('Invalid translation key');
            }

            // Get current language
            $language = $this->_language($lang);
            $translation = $language->get($key);

            if ($translation) { // Translation found
                return $translation;
            }

            // Fallback
            try {
                $fallback = $this->_fallback();
            } catch (LanguageException $e) {
                throw new LanguageException('[Fallback] ' . $e->getMessage());
            }

            if ($fallback && $fallback->name() !== $language->name()) {
                $translation = $fallback->get($key);
                if ($translation) {
                    return $translation;
                }
            }
        } catch (TranslatorException $e) {
            trigger_error(sprintf('Translation error [%s]: %s', $key, $e->getMessage()), E_USER_WARNING);
        }

        return null;
    }
1345358
public function _get($name, $locale=null) {
		$name = strtolower($name);
		
		if(!$locale)
			$locale = $this->getLocale();

		if($this->getDefinition()->hasProperty($name)) {
			if($this->getDefinition()->property($name)->get('i18n') && $locale !== $this->getLocale()) {
				#multiple locales at once
				if(is_array($locale)) {
					$res = [];
					foreach($locale as $locale)
						$res[$locale] = $this->get($name, $locale);
					return $res;
				}
				elseif(isset($this->data['translations'][$locale][$name]))
					return $this->data['translations'][$locale][$name];
				else {
					$this->getDefinition()->trigger('getTranslations', [$this, $name, $locale]);
					if(!isset($this->data['translations'][$locale][$name]))
						return null;
					return $this->data['translations'][$locale][$name];
				}
			}
			elseif(isset($this->data['properties'][$name]))
				return $this->data['properties'][$name];
		}
		elseif(isset($this->data[$name]))
			return $this->data[$name];
	}
1127827
public function getTranslation($locale)
    {
        /** @var TaxClassTranslation $translation */
        foreach ($this->getTranslations() as $translation) {
            if ($translation->getLocale() === $locale) {
                return $translation;
            }
        }

        return null;
    }
389610
public function translate($key, $defaultValue = '', $locale = null) {
		return $this->translation->translate($key, $defaultValue, $locale);
	}
163424
private function searchLocalizationByRequestKey($key)
	{
		$localizationId = $this->getRequestInput()->get($key);

		// Fix for news application filter folders
		if (strpos($localizationId, '_') !== false) {
			$localizationId = strstr($localizationId, '_', true);
		}

		if (empty($localizationId)) {
			return null;
		}

		return $this->getEntityManager()
				->find(Localization::CN(), $localizationId);
	}
1185231
public function locale($locale = null)
    {
        if ($locale) {
            // Normalize the language
            self::$locale = strtolower(str_replace([' ', '_'], '-', $locale));
        }

        return self::$locale;
    }
650461
public function locale($locale = null)
    {
        if ($locale) {
            $this->_locale = $locale;
        }
        if ($this->_locale) {
            return $this->_locale;
        }
        if (isset($this->_params['locale'])) {
            return $this->_params['locale'];
        }
    }
810957
public function t($key, array $options = [], $locale = null)
    {
        if (strpos($key, '.') === 0) {
            $key = str_replace('/', '.', $this->template->prefix()) . $key;
        }
        
        $i18n = $this->actionView->getService('i18n');
        $options['exception'] = true;
        
        try {
            $tr = $i18n->translate($key, $options, $locale);
        } catch (TranslationMissingException $e) {
            $parts = explode('.', $key);
            $title = $this->actionView->getService('inflector')->titleize(end($parts));
            $tr = sprintf(
                '<span class="translation_missing" title="translation missing: %s">%s</span>',
                $i18n->defaultLocale() . '.' . $key,
                $title
            );
        }
        
        return $tr;
    }
1322789
protected function getFormFieldName($locale = null)
    {
        if ( ! $locale) {
            return $this->field->key();
        }

        return $this->field->key() . '[' . $locale . ']';
    }
1108985
public function getLine($key, $replace = [], $locale = null, $fallback = true)
	{
		list($namespace, $group, $item) = $this->parseKey($key);

		// Here we will get the locale that should be used for the language line. If one
		// was not passed, we will use the default locales which was given to us when
		// the translator was instantiated. Then, we can load the lines and return.
		$locales = $fallback ? $this->localeArray($locale)
							 : [$locale ?: $this->locale];

		foreach ($locales as $locale) {
			if (! is_null($line = $this->read(
				$namespace, $group, $locale, $item, $replace
			))) {
				break;
			}
		}

		return isset($line) ? $line : null;
	}
826476
protected function getLocale($locale)
    {
        $result = null;
        if ($locale instanceof LocaleEntity) {
            $result = $locale;
        } elseif (is_string($locale) && $locale !== '') {
            $result = $this->app->make(LocaleRepository::class)->findApproved($locale);
        }

        return $result;
    }