How BookMooch does its translations
September 23, 2007
I get a lot of questions at conferences about how BookMooch manages to be in several languages, and keep up to date with them.
I call my technique “wiki + machine translation”, and here is how it works:
1) every piece of text on the web site needs to be a function call, and break up paragraphs into separate chunks
2) use a separate domain name for each language (ie http://fr.bookmooch.com)
3) this function looks at the domain name, and if that domain name is english, then the function returns what it was given (ie, everything is first written in english), that way the main language used is no database load
4) if you’re in a non-english language, look for that string in the translation database table you have. If you don’t have that text translated, then have google translate it, and store that in your database, displaying that to the user
5) for a single page a user requests, store in a global variable all the strings that were translated. Assign that information a unique ID, and keep that data around at least 10 mins, possibly in a database. This is important, because sometimes there is if/then logic on a page, and different text gets translated for a user’s case.
6) put a “correct this translation” button on each non-english page, pointing to that unique ID
7) make a translation correction page, that stores these changes in the database
8) user can now see the translation live on the site