public function DrupalTranslator::getLocale

public DrupalTranslator::getLocale()

Returns the current locale.

Return value

string The locale

Overrides TranslatorInterface::getLocale

File

core/lib/Drupal/Core/Validation/DrupalTranslator.php, line 65

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();
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Validation!DrupalTranslator.php/function/DrupalTranslator::getLocale/8.1.x