You are here

public static function LingotekLanguageForm::isValidLocale in Lingotek Translation 8

Same name and namespace in other branches
  1. 8.2 src/Form/LingotekLanguageForm.php \Drupal\lingotek\Form\LingotekLanguageForm::isValidLocale()
  2. 4.0.x src/Form/LingotekLanguageForm.php \Drupal\lingotek\Form\LingotekLanguageForm::isValidLocale()
  3. 3.0.x src/Form/LingotekLanguageForm.php \Drupal\lingotek\Form\LingotekLanguageForm::isValidLocale()
  4. 3.1.x src/Form/LingotekLanguageForm.php \Drupal\lingotek\Form\LingotekLanguageForm::isValidLocale()
  5. 3.2.x src/Form/LingotekLanguageForm.php \Drupal\lingotek\Form\LingotekLanguageForm::isValidLocale()
  6. 3.3.x src/Form/LingotekLanguageForm.php \Drupal\lingotek\Form\LingotekLanguageForm::isValidLocale()
  7. 3.4.x src/Form/LingotekLanguageForm.php \Drupal\lingotek\Form\LingotekLanguageForm::isValidLocale()
  8. 3.5.x src/Form/LingotekLanguageForm.php \Drupal\lingotek\Form\LingotekLanguageForm::isValidLocale()
  9. 3.6.x src/Form/LingotekLanguageForm.php \Drupal\lingotek\Form\LingotekLanguageForm::isValidLocale()
  10. 3.7.x src/Form/LingotekLanguageForm.php \Drupal\lingotek\Form\LingotekLanguageForm::isValidLocale()
  11. 3.8.x src/Form/LingotekLanguageForm.php \Drupal\lingotek\Form\LingotekLanguageForm::isValidLocale()

Checks if a locale is valid.

Parameters

string $locale: The locale to validate.

Return value

bool TRUE if it's a valid locale in Lingotek. FALSE if not.

1 call to LingotekLanguageForm::isValidLocale()
LingotekLanguageForm::validateLocale in src/Form/LingotekLanguageForm.php
Validate the configurable language type form with lingotek options.

File

src/Form/LingotekLanguageForm.php, line 131

Class

LingotekLanguageForm
Alters the Drupal language module language forms.

Namespace

Drupal\lingotek\Form

Code

public static function isValidLocale($locale) {
  $locales = \Drupal::service('lingotek')
    ->getLocales();
  return in_array($locale, $locales);
}