function lingotek_add_missing_locales in Lingotek Translation 7.4
Same name and namespace in other branches
- 7.7 lingotek.util.inc \lingotek_add_missing_locales()
- 7.2 lingotek.util.inc \lingotek_add_missing_locales()
- 7.3 lingotek.util.inc \lingotek_add_missing_locales()
- 7.5 lingotek.util.inc \lingotek_add_missing_locales()
- 7.6 lingotek.util.inc \lingotek_add_missing_locales()
Fills in any missing lingotek_locale values to the languages table
4 calls to lingotek_add_missing_locales()
- Lingotek::availableLanguageTargets in lib/
Drupal/ lingotek/ Lingotek.php - Gets the site's available target languages for Lingotek translation.
- lingotek_add_target_language in ./
lingotek.util.inc - Adds the target language as being enabled.
- lingotek_cleanup_utility in ./
lingotek.util.inc - Clean-up utility
- lingotek_update_7210 in ./
lingotek.install - Extend languages table to have lingotek_locale field
File
- ./
lingotek.util.inc, line 871 - Utility functions.
Code
function lingotek_add_missing_locales() {
LingotekLog::trace(__METHOD__);
$languages = language_list();
$default_language = language_default();
$update_static_language_list = FALSE;
//$source_language = variable_get( 'lingotek_source_language', $default_language->language );
foreach ($languages as $target) {
if (isset($target->lingotek_locale) && !strlen($target->lingotek_locale)) {
$drupal_language_code = $target->language;
$lingotek_locale = Lingotek::convertDrupal2Lingotek($drupal_language_code, FALSE);
lingotek_enable_language_by_code($drupal_language_code, $lingotek_locale);
$update_static_language_list = TRUE;
}
}
if ($update_static_language_list) {
drupal_static_reset('language_list');
}
}