Automated content translation with Google

Google translation "widget" will crash your bitweaver. Surround google code with {LITERAL} smarty tag.

Created by: Matt, Last modification: 05 Aug 2012 (21:28 UTC)
With a Google account, you can have a drop-down menu on your bitweaver website that will use the Google translation engine to make your site available to millions of people who don't speak your language.

If you have already crashed your Bitweaver and are looking for help how to restore it, read on.

NOTE: this article is NOT about how to translate bitweaver interface (menus, options etc). This topic has been covered here: TranslationTutorial

  • Get a Google account and set up your site at translation.google.com
  • In the Website Translator Settings, after you configure your domain (it can also be your localhost) you will receive two pieces of code that you must insert in two different locations.
    • Open the template located in kernel>templates>header_inc.tpl. Locate the meta section and paste the first piece of google code within that section. Save the modified template to themes>force>kernel>templates>header_inc.tpl. (This will substitute the template code without changing the template that originally came with bitweaver.)
    • Copy the second piece of google code to clipboard.
  • In your bitweaver admin panel go to Administration>Themes>Custom Modules
  • Create a new custom module, call it googletrans, or whatever else you will remember.
  • Paste the copied google code into the Data text field.
  • VERY IMPORTANT: surround the pasted google code with {literal}...{/literal} smarty tags. These are tags that prevent Smarty engine from trying to interpret whatever google will throw back at you (their translated content).
  • Save your custom module.

You are free to use Administration>Themes>Module Layouts to assign your new Custom Module to the website area of your choice.

How to fix bitweaver if all you can see is Smarty error or White Screen Of Death


If you are testing locally, you probably use something like WAMP stack, otherwise you know how to manage your database using SSH to your local server.
If you are with a hosting company, they probably give you access to some database editing interface (mentioned below).
Stacks like WAMP (MAMP, LAPP, etc) come with some sort of database interface, like phpMyAdmin or phpPgAdmin.

Open the bitweaver database for editing, locate the themes_custom_modules table on the list, and click "browse" - you will find all your custom modules listed, including the one that caused the smarty error. Edit the content of that module by addind the {literal}...{/literal} tags as describe above. Save the table entry and refresh your bitweaver page. You will now see the google translation box!