Help Help
Configuring 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.

Tags: 

blog comments powered by Disqus

Call nowCall now

Feel free to contact us at any time to discuss your multilingual or translation project.

Ph. +46 70 885 9690 (Sweden)
Ph. +33 6 76 59 21 07 (France)
Ph. +44 20 8133 8055 (UK)
Skype. sprawk

Not registered?Not registered?

Try out our team features free for 30 days, no deposit or credit card required.

Freelance translator?Freelance translator?

Are you interested in working with us as a freelance translator?