public static function LingotekLocale::convertDrupal2Lingotek in Lingotek Translation 3.8.x
Same name and namespace in other branches
- 8 src/LingotekLocale.php \Drupal\lingotek\LingotekLocale::convertDrupal2Lingotek()
- 8.2 src/LingotekLocale.php \Drupal\lingotek\LingotekLocale::convertDrupal2Lingotek()
- 4.0.x src/LingotekLocale.php \Drupal\lingotek\LingotekLocale::convertDrupal2Lingotek()
- 3.0.x src/LingotekLocale.php \Drupal\lingotek\LingotekLocale::convertDrupal2Lingotek()
- 3.1.x src/LingotekLocale.php \Drupal\lingotek\LingotekLocale::convertDrupal2Lingotek()
- 3.2.x src/LingotekLocale.php \Drupal\lingotek\LingotekLocale::convertDrupal2Lingotek()
- 3.3.x src/LingotekLocale.php \Drupal\lingotek\LingotekLocale::convertDrupal2Lingotek()
- 3.4.x src/LingotekLocale.php \Drupal\lingotek\LingotekLocale::convertDrupal2Lingotek()
- 3.5.x src/LingotekLocale.php \Drupal\lingotek\LingotekLocale::convertDrupal2Lingotek()
- 3.6.x src/LingotekLocale.php \Drupal\lingotek\LingotekLocale::convertDrupal2Lingotek()
- 3.7.x src/LingotekLocale.php \Drupal\lingotek\LingotekLocale::convertDrupal2Lingotek()
Converts the Lingotek language code for the specified Drupal language code.
Parameters
string $drupal_language_code: A Drupal language code.
Return value
mixed The Lingotek language code if there is a match for the passed language code, FALSE otherwise.
4 calls to LingotekLocale::convertDrupal2Lingotek()
- LanguageLocaleMapper::getLocaleForLangcode in src/
LanguageLocaleMapper.php - Gets the Lingotek locale for the given Drupal langcode.
- LingotekLocale::isSupportedLanguage in src/
LingotekLocale.php - Returns whether the given language is supported.
- LingotekLocale::testConvertFunctions in src/
LingotekLocale.php - LingotekLocaleTest::testConvertLingotek2Drupal in tests/
src/ Functional/ LingotekLocaleTest.php
File
- src/
LingotekLocale.php, line 228
Class
- LingotekLocale
- A utility class for Lingotek translation.
Namespace
Drupal\lingotekCode
public static function convertDrupal2Lingotek($drupal_language_code) {
$lingotek_locale = $drupal_language_code;
$exceptions = self::$language_mapping_d2l_exceptions;
if (array_key_exists($drupal_language_code, $exceptions)) {
$lingotek_locale = $exceptions[$drupal_language_code];
}
else {
// If the code contains a dash then, keep it specific
$dash_pos = strpos($drupal_language_code, "-");
if ($dash_pos !== FALSE) {
$lang = substr($drupal_language_code, 0, $dash_pos);
$loc = strtoupper(substr($drupal_language_code, $dash_pos + 1));
$lingotek_locale = $lang . '_' . $loc;
}
elseif (isset(self::$language_map[$drupal_language_code])) {
$lingotek_locale = self::$language_map[$drupal_language_code];
}
}
return $lingotek_locale;
}