function lingotek_add_missing_locales in Lingotek Translation 7.2
Same name and namespace in other branches
- 7.7 lingotek.util.inc \lingotek_add_missing_locales()
- 7.3 lingotek.util.inc \lingotek_add_missing_locales()
- 7.4 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()
- LingotekAccount::getManagedTargets in lib/
Drupal/ lingotek/ LingotekAccount.php - lingotek_add_target_language in ./
lingotek.util.inc - Adds the target language as being enabled.
- lingotek_cleanup_utility in ./
lingotek.util.inc - lingotek_update_7210 in ./
lingotek.install - Extend languages table to have lingotek_locale field
File
- ./
lingotek.util.inc, line 786 - Utility functions.
Code
function lingotek_add_missing_locales() {
$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;
// Set default when Enterprise to 1 (unless source language, then set to 0)
//$lingotek_enabled = LingotekAccount::instance()->isEnterprise() ? (($target->language == $default_language->language) ? 0 : 1) : $target->lingotek_enabled;
$lingotek_enabled = $target->lingotek_enabled;
lingotek_enable_language_by_code($drupal_language_code, $lingotek_enabled);
$update_static_language_list = TRUE;
}
}
if ($update_static_language_list) {
drupal_static_reset('language_list');
}
}