function lingotek_add_missing_locales in Lingotek Translation 7.3
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.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
3 calls to lingotek_add_missing_locales()
- 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 781 - 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_enabled = $target->lingotek_enabled ? $target->lingotek_enabled : ($target->language == $default_language->language ? 0 : 1);
// enable default source language by default
$lingotek_locale = Lingotek::convertDrupal2Lingotek($drupal_language_code, FALSE);
lingotek_enable_language_by_code($drupal_language_code, $lingotek_enabled, $lingotek_locale);
$update_static_language_list = TRUE;
}
}
if ($update_static_language_list) {
drupal_static_reset('language_list');
}
}