You are here

function custom_search_i18n_locale_refresh in Custom Search 7

Same name and namespace in other branches
  1. 6 modules/custom_search_i18n/custom_search_i18n.module \custom_search_i18n_locale_refresh()
1 string reference to 'custom_search_i18n_locale_refresh'
custom_search_i18n_locale in modules/custom_search_i18n/custom_search_i18n.module
Implements hook_locale().

File

modules/custom_search_i18n/custom_search_i18n.module, line 246
Brings Internationalization to Custom Search

Code

function custom_search_i18n_locale_refresh() {
  i18n_string_update('custom_search:common:1:label', variable_get('custom_search_label', CUSTOM_SEARCH_LABEL_DEFAULT));
  i18n_string_update('custom_search:common:1:text', variable_get('custom_search_text', ''));
  i18n_string_update('custom_search:common:1:hint_text', variable_get('custom_search_hint_text', CUSTOM_SEARCH_HINT_TEXT_DEFAULT));
  i18n_string_update('custom_search:common:1:submit_text', variable_get('custom_search_submit_text', CUSTOM_SEARCH_SUBMIT_TEXT_DEFAULT));
  i18n_string_update('custom_search:content_types:1:selector_label', variable_get('custom_search_type_selector_label', CUSTOM_SEARCH_TYPE_SELECTOR_LABEL_DEFAULT));
  i18n_string_update('custom_search:content_types:1:selector_all', variable_get('custom_search_type_selector_all', CUSTOM_SEARCH_ALL_TEXT_DEFAULT));
  i18n_string_update('custom_search:paths:1:selector_label', variable_get('custom_search_paths_selector_label', CUSTOM_SEARCH_PATHS_SELECTOR_LABEL_DEFAULT));
  i18n_string_update('custom_search:criterion:1:or_label', variable_get('custom_search_criteria_or_label', CUSTOM_SEARCH_CRITERIA_OR_LABEL_DEFAULT));
  i18n_string_update('custom_search:criterion:1:phrase_label', variable_get('custom_search_criteria_phrase_label', CUSTOM_SEARCH_CRITERIA_PHRASE_LABEL_DEFAULT));
  i18n_string_update('custom_search:criterion:1:negative_label', variable_get('custom_search_criteria_negative_label', CUSTOM_SEARCH_CRITERIA_NEGATIVE_LABEL_DEFAULT));
  i18n_string_update('custom_search:filter:1:label', variable_get('custom_search_filter_label', CUSTOM_SEARCH_FILTER_LABEL_DEFAULT));
  if (module_exists('custom_search_taxonomy')) {
    $vocabularies = taxonomy_get_vocabularies();
    foreach ($vocabularies as $voc) {
      i18n_string_update('custom_search:vocabulary:' . $voc->vid . ':selector_label', variable_get('custom_search_voc' . $voc->vid . '_selector_label', $voc->name));
      i18n_string_update('custom_search:vocabulary:' . $voc->vid . ':selector_all', variable_get('custom_search_voc' . $voc->vid . '_selector_all', CUSTOM_SEARCH_ALL_TEXT_DEFAULT));
      if (module_exists('custom_search_blocks')) {
        for ($a = 1; $a <= variable_get('custom_search_blocks_number', 1); $a++) {
          i18n_string_update('custom_search:vocabulary:' . $voc->vid . ':blocks_' . $a . '_selector_label', variable_get('custom_search_blocks_' . $a . '_voc' . $voc->vid . '_selector_label', $voc->name));
          i18n_string_update('custom_search:vocabulary:' . $voc->vid . ':blocks_' . $a . '_selector_all', variable_get('custom_search_blocks_' . $a . '_voc' . $voc->vid . '_selector_all', CUSTOM_SEARCH_ALL_TEXT_DEFAULT));
        }
      }
    }
  }
  if (module_exists('custom_search_blocks')) {
    for ($a = 1; $a <= variable_get('custom_search_blocks_number', 1); $a++) {
      i18n_string_update('custom_search:common:1:blocks_' . $a . '_label', variable_get('custom_search_blocks_' . $a . '_label', CUSTOM_SEARCH_LABEL_DEFAULT));
      i18n_string_update('custom_search:common:1:blocks_' . $a . '_text', variable_get('custom_search_blocks_' . $a . '_text', ''));
      i18n_string_update('custom_search:common:1:blocks_' . $a . '_hint_text', variable_get('custom_search_blocks_' . $a . '_hint_text', CUSTOM_SEARCH_HINT_TEXT_DEFAULT));
      i18n_string_update('custom_search:common:1:blocks_' . $a . '_submit_text', variable_get('custom_search_blocks_' . $a . '_submit_text', CUSTOM_SEARCH_SUBMIT_TEXT_DEFAULT));
      i18n_string_update('custom_search:criterion:1:blocks_' . $a . '_or_label', variable_get('custom_search_blocks_' . $a . '_criteria_or_label', CUSTOM_SEARCH_CRITERIA_OR_LABEL_DEFAULT));
      i18n_string_update('custom_search:criterion:1:blocks_' . $a . '_phrase_label', variable_get('custom_search_blocks_' . $a . '_criteria_phrase_label', CUSTOM_SEARCH_CRITERIA_PHRASE_LABEL_DEFAULT));
      i18n_string_update('custom_search:criterion:1:blocks_' . $a . '_negative_label', variable_get('custom_search_blocks_' . $a . '_criteria_negative_label', CUSTOM_SEARCH_CRITERIA_NEGATIVE_LABEL_DEFAULT));
      i18n_string_update('custom_search:content_types:1:blocks_' . $a . '_selector_label', variable_get('custom_search_blocks_' . $a . '_type_selector_label', CUSTOM_SEARCH_TYPE_SELECTOR_LABEL_DEFAULT));
      i18n_string_update('custom_search:content_types:1:blocks_' . $a . '_selector_all', variable_get('custom_search_blocks_' . $a . '_type_selector_all', CUSTOM_SEARCH_ALL_TEXT_DEFAULT));
      i18n_string_update('custom_search:paths:1:blocks_' . $a . '_selector_label', variable_get('custom_search_blocks_' . $a . '_paths_selector_label', CUSTOM_SEARCH_PATHS_SELECTOR_LABEL_DEFAULT));
    }
  }
  return TRUE;
}