You are here

function i18nblocks_locale_refresh in Internationalization 6

Refresh all strings.

1 string reference to 'i18nblocks_locale_refresh'
i18nblocks_locale in i18nblocks/i18nblocks.module
Implementation of hook_locale().

File

i18nblocks/i18nblocks.module, line 76
Internationalization (i18n) submodule: Multilingual meta-blocks

Code

function i18nblocks_locale_refresh() {
  $result = db_query("SELECT DISTINCT b.module, b.delta, b.title, bx.body, bx.format, i.ibid, i.language FROM {blocks} b LEFT JOIN {boxes} bx ON b.module = 'block' AND b.delta = bx.bid LEFT JOIN {i18n_blocks} i ON b.module = i.module AND b.delta = i.delta");
  while ($block = db_fetch_object($result)) {
    if (!$block->language) {

      // If the block has a custom title and no language it must be translated
      if ($block->title && $block->title != '<none>') {
        i18nstrings_update("blocks:{$block->module}:{$block->delta}:title", $block->title);
      }

      // If the block has body and no language, must be a custom block (box)
      if ($block->body) {
        i18nstrings_update("blocks:{$block->module}:{$block->delta}:body", $block->body, $block->format);
      }
    }
  }
  return TRUE;

  // Meaning it completed with no issues
}