Requirements for a Multilingual WordPress Plugin [en]

[fr] Quelques réflexions concernant un plugin multilingue pour WordPress.

My blog has been bilingual for a long time now. I’ve hacked bilingualism into it and then plugged it in. Other plugins for multilingual bloggers have been written, and some unfortunately got stuck somewhere in the development limbo.

Defining specs is a hairy problem. They need to work for the person visiting the site (polyglot or monoglot). They need to work for the person (or people! translation often involves more than one person) writing the posts. They need to work for all the robots, search engines, and fancy browsers who deal with the site.

Here is what I would like a multiple language plugin to do (think “feature requirements”, suggestion, draft):

  1. Recognize the browser language preference of the visitor and serve “page furniture” and navigation in the appropriate language. This can be overridden by a cookie-set preference when clicking on a “language link”.
    • “WordPress” furniture can be provided by the normal localization files
    • how do we deal with other furniture content in the theme (navigation, taglines, etc.)? should the plugin provide with guidelines for theme localization? do such guidelines already exist? extra information appreciated on this point
    • “language links” shouldn’t be flags, but language names in their respective languages; can this list be generated automatically based on present localization files? otherwise, can it be set in an admin panel?
    • upon “language change” (clicking on a language link), could the localization (action) be done in an AHAH– or AJAX-like way?
    • inevitable hairy problem: tag and category localization
  2. Manage “lazy multilingualism” in the spirit of the Basic Bilingual plugin and “true multilingualism” elegantly and on a per-post basis.
    • allow for “other language abstracts”
    • allow for actual other language version of the post
    • given the “general user language” defined above, show posts in that language if a version for that language exists, with mention of other language versions or abstracts
    • if that language doesn’t exist, show post in “main blog language” or “main post language” (worst case scenario: the wordpress install default) and show alongside other language abstracts/versions
    • abstract in one language (would be “excerpt” in the “main” language) and existence of the post in that language are not mutually exclusive, both can coexist
    • does it make more sense to have one WordPress post per language version, or a single post with alternate language content in post_meta? For lazy multilingualism, it makes more sense to have a single WP post with meta content, but fore “translation multilingualism”, it would make more sense to have separate posts with language relationships between them clearly defined in post_meta
  3. Use good markup. See what Kevin wrote sometime back. Make it nice for both polyglot and monoglot visitors. Inspiration?
    • use <div lang="xx"> and also rel attributes
  4. Provide a usable admin panel.
    • when I’m writing the other version of a post, I need access to the initial version for translation or abstracting
    • ideally, different language version should be editable on the same admin panel, even if they are (in the WordPress database) different posts
    • languages in use in the blog should be defined in an options screen, and the plugin should use that information to adapt the writing and editing admin panels
    • idea: radio button to choose post language; N other language excerpt/abstract fields with radio buttons next to them too; abstract radio buttons change dynamically when main post language is set; in addition to other language abstract fields, another field which can contain a post id/url (would have to see what the best solution is) to indicate “this is an equivalent post in another language” (equivalent can be anything from strict translation to similar content and ideas); this means that when WP displays the blog, it must make sure it’s not displaying a post in language B which has an equivalent in language A (language A being the visitor’s preferred language as defined above)
  5. Manage URLs logically (whatever that means).
    • if one post in two languages means two posts in WP, they will each have their own slug; it could be nice, though, to be able to switch from one to an other by just adding the two-letter language code on the end of any URL; a bit of mod_rewrite magic should do it
  6. Integrate into the WordPress architecture in a way that will not break with each upgrade (use post-meta table to define language relationships between different posts, instead of modifying the posts table too much, for example.)
    • one post translated into two other languages = 3 posts in the WP posts table
    • excerpts and post relationships stored in post_meta
    • language stored in post_meta

I have an idea for plugin development. Once the specs are drafted out correctly, how about a bunch of us pool a few $ each to make a donation to (or “pay”) the person who would develop it? Who would be willing to contribute to the pool? Who would be willing to develop such a plugin (and not abandon the project half-way) in these conditions?

These specs need to be refined. We should start from the markup/reader end and get that sorted out first. Then, think about the admin panel/writer end. Then worry about code architecture. How does that sound?

We’ve started a discussion over on the microformats.org wiki. Please join us!

Update: this post is going to suffer from ongoing editing as I refine and add ideas.

Plugin Updates for WordPress 2.0 [en]

[fr] Les plugins "Bunny's Technorati Tags" et "Basic Bilingual" fonctionnent à  présent avec WordPress 2.0.

It took me a couple of hours, but both Basic Bilingual and Bunny’s Technorati Tags are now WordPress 2.0-compatible.

A few minor tweaks have been made, most significant of which is that these two plugins can now be used for Pages in addition to normal posts.

They should work, though I haven’t troubleshooted them extensively — please ring the bell if you bump into any problems.

Basic Bilingual Plugin [en]

This is a simple plugin which wraps together my bilingual hacks to make day-to-day posting less of a hassle.

[fr] Ce plugin pour WordPress regroupe les hacks que j'utilise depuis un moment déjà pour gérer le bilinguisme de mon weblog. Il permet d'afficher un sommaire de chaque billet dans "l'autre langue" et d'appliquer un formattage par langue via l'attribut lang.

Plus de détails sur la page officielle du plugin.

Update 01.02.2007: This plugin broke badly with WordPress 2.1, but has now been (hopefully) updated. The wiki page on wp-plugins.org is frozen and may not be up-to-date anymore. Download here.

This post is the test run for my Basic Bilingual plugin.

It doesn’t add much functionality to what I already have through my hacks, but it’s cleaner from a code point of view, and it’s portable — you can use it too if you wish.

Be patient if the wiki page isn’t exactly up-to-date. It will be shortly — and the plugin will be available through the Plugin Manager as soon as I’ve made sure it’s functional enough (ie, when I press publish and hell doesn’t break loose).

This plugin basically allows you to do what you can see on this weblog: add lang attributes to your posts, excerpts in “the other language”, and localize the date. It also creates permanent fields in the admin pages for entering the language and “other language excerpt” easier.

I’d like to emphasize that this plugin is very simple. It is in no way a replacement of any sort for the larger-scale multilingual efforts going on these days. I wanted to get my code cleaned up and my hacks back in the admin interface (I lost them when I upgraded WP), and I’m making the result public.

Call to WordPress Plugin Developers [en]

Call for help to WordPress plugin developers. I have a bunch of hacks and modifications I’d like to turn into plugins, but I am unfortunately as plugin-challenged as ever.

[fr] Un descriptif des plugins que j'écrirais pour WordPress si je ne faisais pas un vilain blocage sur le sujet. Ne vous gênez pas si vous voulez contribuer!

If I was fluent in WordPress plugin coding, here are the plugins I’d write. If you feel like coding one of them yourself, or helping me get it done, you’re most welcome. Carthik has already pointed me to Plunge into Plugins, which I will have a close look at once I’ve finished writing this post.

Of course, if you know of a plugin which does precisely what I’m describing here, leave a link to it in the comments!

Keywords plugin

This would be a pretty straightforward one:

  • add a “keywords” text input to post.php
  • save the value of that text input to a custom field called “keywords”
  • add those keywords as an HTML meta tag on the individual post pages.
Excerpt plugin

This one would also be pretty straightforward, as all it would do is add the “excerpt” field to the “simple” post.php layout.

Customize post.php plugin

This would be more complex, but allow for more flexibility than the previous plugin. I don’t yet have a clear idea of how to make it work, but the basic principle would be to allow the user to select which fields should appear on the post.php page. Instead of having “simple” and “advanced” controls, this would add the option to have “custom” controls and define them.

TopicExchange plugin

As far as functionality is concerned, this plugin would do what my TopicExchange hack did:

  • add a “trackback TopicExchange channels” text input to post.php
  • store the space-separated list of keywords in a meta value named (e.g.) ite_topic (one record for each value)
  • for each value, trackback the appropriate TopicExchange channel
  • display the trackbacked channels (with link) on each post.
Bilingual plugin

This would be a clean version of my language hacks:

  • add a small “language” text input to post.php (with a default value)
  • add an “other language excerpt” textarea, which posts to the corresponding custom value
  • display the “other language excerpt” at the top of each post
  • provide a function to return the post language, and the other-excerpt language (so it can be declared in a lang attribute, allowing the use of language-dependant CSS formatting, in addition to being semantically correct)
  • if this is not already possible with the date function in the WordPress core, provide an alternative date function which will format the date correctly corresponding on the language of the post
  • optional: figure out a way to adapt text like “comments”, “categories” etc. to the post language; make the plugin usable with more than two languages.
Smart Linkroll plugin

I love the way ViaBloga manages blogrolls and would love to see a plugin for WordPress that does the same thing. In ViaBloga, you simply enter the URL of the site you want to add to your links. ViaBloga then retrieves the title, description, RSS feed address, and even (yes!) a screenshot for the site. No need to fill in fields manually anymore…

Wiki-Keywords plugin

I haven’t through this through yet completely, but it seems to me that a plugin which would add wiki-like capability to WordPress, like ViaBloga does with keywords, could be an interesting idea to explore.

Technorati plugin

This is really a simple one: add a function which will allow easy display of the Technorati cosmos of each post, like I have done manually for this weblog.

On the subject of multilingual blogging, Kevin Marks has some interesting markup suggestions I need to look at more closely.

Chosen Spam Tidbits [en]

Some fun things spammers tried to leave in my comments.

[fr] Quelques commentaires, drôles à  mon goût, que les spammeurs ont tenté de laisser sur ce blog.

Now that Spam Karma has been efficiently killing nearly 600 spams during the last 48 hours, here are a few chosen tidbits from the deletion log.

Your website is beautifully decorated and easily navigated. I have enjoyed visiting this site today and hope to visit many more times in the future.
Easily navigated! Wow. Now that exceeds my expectations. I’m not certain I want you to visit many more times in future, though.
Thank you for opening a wonderfully new sight..I wish you the best of luck with your new venture.
Er… thanks to you!
Good morning, I am new to this site. I have just learned about this site. I am going to read on and it’s very interesting to know
Yes, I’m very glad to know that!
I put my step in to your guestbook like I always.
Hope you didn’t break anything there.
I found your website after I have been surfing the internet to be useful.
That sounds like a great way to make oneself useful.
Just stopped by to visit and got the crunch on your stuff in here – bravo!
Did it taste nice?

Which one do you prefer? If you got fun spam lines too, post them in the comments.

Quick Comment Spam Tip for WordPress [en]

Here are the two plugins you need to fight comment spam using WordPress.

[fr] Deux plugins pour combattre le spam de commentaires sous WordPress: Kitten's Spaminator et Kitten's Spam Words. [Edit 03.12.2004] Ou plus simple, Spam Karma, que j'utilise à  présent.

If you want a quick tip to protect your WordPress installation from comment spam, the killer plugin combination is Kitten’s Spaminator and Kitten’s Spam Words.

The second allows you to “delete as spam”, adding keywords and IPs to the filter, and the second gives “spam points” to new comments (ie, for words matching the filter, previous comment posted within the last x minutes, IP matching the filter), deleting those over a certain threshold directly, and queuing the others for moderation. It’s also smart enough to give bonus points if the commentor has already had comments posted on the blog.

Edit 04.12.2004: See the comment, I’m now using Spam Karma rather than the two plugins presented above.

Batch Categories 0.9 [en]

Batch Categories for WordPress has been fixed and enhanced. If you have major category jobs to do, it can probably help you. Feedback and testers welcome.

[fr] Batch Categories pour WordPress a été corrigé et fonctionne à  présent. Le compagnon idéal si vous desirez changer les catégories de nombreux billets en même temps.

Batch Categories 0.9 is out! It’s the ideal companion for large-scale post-import messy category work. List all posts belonging to a category or matching a keyword, and edit their categories, easily visible at a glace with a collection of sexy drop-down lists. What’s new since the the first draft?

  • It now works, and does not “eat” categories without a warning. (Pretty nice of it, huh?)
  • It tells you what it did — which categories it added to which posts, and which ones it removed.
  • Add a whole bunch of posts to a category with one click.
  • Remove a whole bunch of posts from a category with one click.
  • Ensures that all the categories for a post are always listed, whatever the setting for the limit number of drop-down lists.
  • This is what it can look like.

You can still access it as a plugin or edit the Edit navigation menu, as described in my post introducing Batch Categories. If you’re in a hurry, just drop the PHP file into your wp-admin directory and send your browser straight on it.

Next steps?

  • Gather feedback from courageous testers (please don’t blame me if you haven’t backed up your post2cat table and things go wrong) for chasing the last bugs, improving interface and functionality.
  • Redo the code which generates the drop-down lists to take advantage of the category cache, and avoid flooding the database with useless queries.
  • Allow more subtle selection of posts: combinations of categories (AND/OR/NOT), categories without their subcategories…
  • Anything else you would want…?

Update 24.07.04: BB made me notice that “All” and “None” didn’t make much sense in the drop-down which allows one to select the categories to display. Replaced them in v. 0.91 by “Any category”.