Bunny's Basic Bilingual Plugin
I've been using hacks to manage my bilingual blog for some time, now. This very simple plugin is meant to assemble these hacks into a correct plugin.
Its focus, however, remains very limited, and strictly bilingual. It has been developed with French and English in mind, and you may bump into unforeseen problems with other languages.
A "bilingual blog" as I understand it is a weblog with posts sometimes in one language, sometimes in another. If you're looking for a plugin to help you manage a blog where all posts are duplicated, you need something like Language Picker instead.
Basic Bilingual is in no way meant to compete with the multilingual efforts currently going on, which are of much broader scope and cover functionalities which go way beyond those of this basic plugin. If you only want to manage two languages on your blog and your needs are limited, this plugin might help make your life a little easier until a better one comes out.
Target Audience: is this plugin for you?
The target audience for this plugin are those I'll name "lazy bilingual bloggers" (no hard feelings, I'm one of them). People who want to blog in two languages, but are too lazy (understandably!) to translate each and every one of their posts (again, if this was what you were thinking of doing, use Language Picker).
The plugin addresses two issues:
# indicate which language each post is in (given it could be in language A, or in language B) # localize the date/time display ("Sunday" works pretty well in English, but "dimanche" is nicer for French posts)
In addition to that, it allows you to make your bilingual blog more monolingual-reader-friendly, by providing a short summary of each post in the language they are not written in (ie, the "other language excerpt").
The idea behind this is to allow monolingual readers to get the gist of your post, even though they won't be able to read it (ie, they know what they're missing). It can also encourage readers who aren't comfortable enough to systematically read the posts in the "foreign language" (for them) to give it a try if the subject of the post is interesting enough.
Another possible use of this plugin would be if you have a monolingual blog, but would like to provide excerpts of your posts in another language. It might be a first step towards bilingualism!
- manage two languages of choice
- allow display of an excerpt for the "other language" for each post
- make HTML and display "language-sensitive" to some extent
- localize post date and time
- allow easy input of "other-excerpt" and "lang" custom fields through the admin posting interface
- initial hack presentation
- first draft of requirements for basic bilingual
- this plugin's page in the wp-plugins.net database
- announcement post on my weblog
Version 0.2 didn't work in Wordpress 2.0 -- 0.21 does, and adds support for Pages.
The plugin seems to work for me, but might not necessarily work for you.
If you're willing to try it out, please do so and let me know how it went!
Put the plugin file in your plugins directory and activate the plugin. Edit the plugin file to specify which two languages you are working with. Put the one you want as "default" first (not a big deal, but will prevent you from having to fill in the language field each time).
Basic Bilingual stores data in two custom fields: "language" and "other-excerpt" (if you don't like these, you'll need to edit the code manually to change them). It does this through a small "language" text input somewhere near the top of the "new post" or "edit post" form (it's placed there with CSS, not sure if it will look nice on your setup) and a "other-excerpt" textarea below the form submit buttons.
Once meta data has been stored for a post, you need to make it visible in the template. Basic Bilingual provides the following template functions:
- bb_the_language(): prints the language (the two-letter code)
- bb_the_other_excerpt(): prints the other language excerpt, with formatting
- bb_the_time(): outputs the date/time in the language of the post
If you're not happy with the default formatting, you can change it:
- bb_the_time($format="%A %d.%m.%Y<br />%Hh%M") (this is the default, play with it)
- bb_the_other_excerpt($before='<div class="other-excerpt" lang="%lg"><p>', $after='</p></div>') (this is the default -- note that if you want more than paragraph in your excerpt, you need to close the first paragraph tag, open the next one, etc...)
In the initial post about my hacks, you'll find information about what I did with CSS to make the colour of the post language-dependant. (Use Firefox if you can't see anything special.)