HelpConfiguring Drupal 7 themes to use Sprawk
Configuring Drupal 7 themes to use Sprawk
Note: This guide is for Drupal 7. See also "Configuring Drupal 6 themes"
Once the Sprawk module is installed and configured correctly with your team's code and password, you need to make a few small edits to your theme to trigger Sprawk's content translation functionality.
If you don't already have these files, you will need to create them in your theme's "templates" folder.
block.tpl.php
Replace
<h2<?php print $title_attributes; ?>><?php print $block->subject; ?></h2>
with
<h2<?php print $title_attributes; ?>><?php print ct($block->subject); ?></h2>
And then
<?php print ct($content); } ?>
with
if (strcmp($block_html_id, 'block-locale-language') == 0) {
print $content;
} else {
print ct($content);
} ?>which will translate the content of all blocks except the language switcher. See also an example block.tpl.php that you can copy.
field.tpl.php
Change the line displaying form labels
<div class="field-label"<?php print $title_attributes; ?>><?php print $label ?>: </div>
with
<div class="field-label"<?php print $title_attributes; ?>><?php print ct($label) ?>: </div>
See also an example field.tpl.php that you can copy.
node.tpl.php
Once again, change the content line
print render($content);
to
print ct(render($content));
See also an example node.tpl.php that you can copy.
page.tpl.php
Change the title print line from
<?php print $title; ?>
to
<?php print ct($title); ?>
See also an example page.tpl.php that you can copy.
Finally, you will need to reset the cache on your theme registry to reload the code changes.
blog comments powered by Disqus
