Tuesday, October 1, 2013

How to: write a bilingual blog

This blog has posts in two languages: Russian and English. Some are duplicates, having a translated copy; some are present in only one language.
Setting up a bilingual blog requires some calibrating.

The primary question is how to divide two sections of the blog.

This blog has control links (the ones up there) that allow you to view only Russian, only English and all Russian posts without English duplicates + unique English posts (ideal for an English-speaking Russian reader).

In order to do that here, on blogger, you need to:
1. Set up a label system for which posts goes to which section of the site. This blog has "Russian" "English" and "bilingual post" labels.
2. Create links (on a new HTML-gadget for example). Blogger has a search php script with q parameter that looks like this:
http://cafedomancie.blogspot.ru/search?q=label:somelabel
The first two links are straightforward:
 http://cafedomancie.blogspot.ru/search?q=label:English
 http://cafedomancie.blogspot.ru/search?q=label:Russian (# Note that I was not able to write it in Russian language, there seem to be charset problems in the script. You will need English labels)

Third one requires conditional operators and, yay!, blogger search does a good job at hiding them, but has them.
logical AND is "+"
logical OR is "|"
logical NOT is "-"
You can use as much parentheses as you like as well.

These are enough to build the third link:
http://cafedomancie.blogspot.ru/search?q=(-label:"bilingual post"+label:English)|label:Russian
# Note the quotes around label "bilingual post", because it has a space in it.

That's it. There are other options, like crossposting to another website, but this one is less messy and gives more control.

No comments:

Post a Comment