drupal - t() not printing a translated string -
i currenty try make module translateable using t() hard-codes-strings. since call t() advised in documentation don't have clue might doing wrong. call in block_theme of module.
hook_theme();
don't if important…
/* # themes {{{*/ function catchy_overview_theme() { return array( 'catchy_overview_block' => array( 'template' => 'catchy_overview_block', 'arguments' => array('nodes' => null, 'terms' => null, 'imagecache_preset' => imagecache_preset(variable_get("catchy_overview_imagecache_preset", null))) ) ); }/*}}}*/
catchy_overview_block.tpl.php
<?php /* * catchy overview block template * * defined vars: * $nodes collected nodes grouped tid * $terms taxonomy-array-map tid => name * $imagecache_preset configured imagecache preset. */ ?> <ul class="catchy-overview"> <?php foreach ($nodes $key => $value) { ?> <li class="term term-<?php print $key?>"> <h2><?php print t( $terms[$key] ) ?></h2> <ul> <?php foreach ($value $node) { ?> <li class="node node-<?php print $node->nid ?>"> <?php $image = theme_imagecache($imagecache_preset['presetname'], $node->field_photo[0]["filepath"], $node->title, $node->title); print l($image . "<span>" . $node->title . "</span>", 'node/'.$node->nid, array('html' => true)); ?> </li> <?php } ?> </ul> </li> <?php } ?> </ul>
the term translated , printed within <h2>
taxonomy-term grab sql-query:
$terms_result = db_query(" select tid, name {term_data} vid = '".variable_get('catchy_overview_vocabulary_id', false)."' ");
i hope can me out. if need more information, don't hesitate comment… i'm quite confused right now.
you cannot pass variables parameters t() function, has actual code-based string.
you can go here: drupal t() function api, read more, far know isn't possible. need find other way of translating keys. maybe making own relationship table , translate them yourself.
Comments
Post a Comment