You are here

function lingotek_admin_prepare_menus in Lingotek Translation 7.5

Same name and namespace in other branches
  1. 7.7 lingotek.admin.inc \lingotek_admin_prepare_menus()
  2. 7.3 lingotek.admin.inc \lingotek_admin_prepare_menus()
  3. 7.4 lingotek.admin.inc \lingotek_admin_prepare_menus()
  4. 7.6 lingotek.admin.inc \lingotek_admin_prepare_menus()
1 call to lingotek_admin_prepare_menus()
lingotek_admin_additional_translation_settings_form_submit in ./lingotek.admin.inc

File

./lingotek.admin.inc, line 1038

Code

function lingotek_admin_prepare_menus() {

  // update all menus to use 'Translate and Localize' in the Multilingual Options
  $result = db_update('{menu_custom}')
    ->fields(array(
    'i18n_mode' => LINGOTEK_MENU_LOCALIZE_TRANSLATE_VALUE,
  ))
    ->execute();
  if ($result) {
    drupal_set_message(format_plural($result, t('Set 1 menu to <i>Translate and Localize</i>.'), t('Set @num menus to <i>Translate and Localize</i>.', array(
      '@num' => (int) $result,
    ))));
  }
  else {
    drupal_set_message(t('All menus already set to <i>Translate and Localize</i>.'));
  }

  // find all menu links that are not language-neutral and not part of a
  // translation set and update them to be language-neutral (so they will
  // be added to the locales_source table as a string to be translated)
  $result = db_update('{menu_links}')
    ->fields(array(
    'language' => LANGUAGE_NONE,
  ))
    ->condition('language', LANGUAGE_NONE, '!=')
    ->condition('i18n_tsid', 0)
    ->execute();
  if ($result) {
    drupal_set_message(format_plural($result, t('Set 1 menu link to <i>language neutral</i>.'), t('Set @num menu links to <i>Language neutral</i>.', array(
      '@num' => (int) $result,
    ))));
  }
  else {
    drupal_set_message(t('All menu links already set to <i>language neutral</i>.'));
  }
  return TRUE;
}