function i18nblocks_translate_block in Internationalization 6
Translate block.
Parameters
$block: Core block object
1 call to i18nblocks_translate_block()
- i18nblocks_preprocess_block in i18nblocks/
i18nblocks.module - Implementation of hook_preprocess_block().
File
- i18nblocks/
i18nblocks.module, line 226 - Internationalization (i18n) submodule: Multilingual meta-blocks
Code
function i18nblocks_translate_block($block) {
// Localizable blocks may get the body translated too.
$localizable = _i18nblocks_list();
if (!empty($block->content) && $localizable && isset($localizable[$block->module][$block->delta])) {
$block->content = i18nstrings_text("blocks:{$block->module}:{$block->delta}:body", $block->content);
}
// If it has a custom title, localize it
if (!empty($block->title) && $block->title != '<none>') {
// Check plain here to allow module generated titles to keep any markup.
$block->subject = i18nstrings_string("blocks:{$block->module}:{$block->delta}:title", $block->subject);
}
return $block;
}