You are here

public function DrupalTranslator::getLocale in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Validation/DrupalTranslator.php \Drupal\Core\Validation\DrupalTranslator::getLocale()

Returns the current locale.

Return value

string The locale

Overrides TranslatorInterface::getLocale

File

core/lib/Drupal/Core/Validation/DrupalTranslator.php, line 70
Contains \Drupal\Core\Validation\DrupalTranslator.

Class

DrupalTranslator
Translates strings using Drupal's translation system.

Namespace

Drupal\Core\Validation

Code

public function getLocale() {
  return $this->locale ? $this->locale : \Drupal::languageManager()
    ->getCurrentLanguage()
    ->getId();
}