Language Picker Plugin for WordPress

Eine deutsche Version gibt es noch nicht. Tut mir leid. Bis dann kann man die englische Version lesen. The Language Picker Plugin is my personal solution for writing posts in more than one language. When activated, the plugin will display posts in either the default language (as configured in lang_picker.php) or in the visitor’s preferred language, if available.

Using the plugin is simple.

  1. To begin with, download lang_picker.phps and rename it lang_picker.php
  2. Change the default language in lang_picker.php, if neccessary, by replacing en with the appropriate language code
  3. Upload the file to your plugins directory (/wp_content/plugins)
  4. Then activate it in the Plugins section of the WP admin panel
  5. To write a post in more than one language, simply enclose everything not in the default language in these tags: <lang_xx> and </lang_xx>. Be sure to replace xx with the appropriate language code
  6. At first, only posts in the specified default language will be displayed. To temporarily view another language, append ?lp_lang_view=xx to any cruft-free URL, or &lp_lang_view=xx to any cruft-full URL, being sure to replace xx with the appropriate language code. For example, you can temporarily view the German version of this entry.
  7. To permanently view another language, use lp_lang_pref instead of lp_lang_view. This will set a cookie and display the new language preference whenever it is available. For example, you can set your preference to the German version of this site. (Or switch back to English.)

Note: If you do not manually specify an excerpt (in one language), your RSS feed will generate one for you without running it through the Language Picker Plugin. Thus, both languages will be visible.

History:

  • Version .6: First public release
  • Version .5: Switched from my-hacks to plugin
  • < .5: Hacked together for personal use with WP 1.0

To do:

  • Optimize
  • Add function to display list of available languages
  • Add other features from the old my-hacks version

19 Responses to “Language Picker Plugin for WordPress”


  1. 1 skippy

    Very nice plugin. I have been considering how to handle multi-language posts for an upcoming project.

    Suggestions for improvement:
    1) mod_rewrite rules of the sort
    example.com/permalink/XX
    where XX is the language code to use.
    2) add a filter that will display a flag icon next to (or under) the post title that links to the language-specific display; so that visitors can quickly choose the language they want.

    Again, great plugin!

  2. 2 Jason

    skippy: Not sure if you noticed the update to the plugin, but your flags could probably be accomplished by changing to string to put in front of each langauge to something like <img src="> and the after each language to something like .gif" />

    As for mod_rewrite, I have exactly that kind of thing running. I need to document it better.

    Thanks for the suggestions!

  3. 3 Jason

    Ok, I see why my image suggestion won’t work… I’ll look into adding an option…

  4. 4 spdyvkng

    Great plugin, I miss the following functions:

    • translation of excerpts and titles
      a system for picking out postins which aren’t translated already, there needs to be a list for each language, and in each list there should be a list of entries which hasn’t been translated yet. This would also need a flagging of “untranslateable”, for articles which shouldn’t show up in the translate list
      Use the list of preferred languages as sent by the browser (opera does this)
  • 5 spdyvkng

    Ah, forgot:

    Need to create links automatically in each posting for the translations available, probably for each archive page/category page as well.

    And that leads to the wish for translations of categories as well :)

  • 6 André Wegner

    Dear Jason,
    I’ve installed your plugin and wrote a comment in german (de) and english (en) on my blog to test it, but it didn’t worked. I can see only the german text (default language) even if I choose EN as prefered language in my browser (MSIE and Firefox). Plugin is activated. I used no for german comment and for english comment. Any hints?

  • 7 Ralf

    I can’t log-in anymore when the plugin is active. Any suggestions?

  • 8 Jason

    Strange. I guess you’ll have to delete it.

  • 9 Lobo

    Thank you for this great plugin!!
    Maybe you save my live already :) heheheh http://wordpress.org/support/topic.php?id=21730

  • 10 shuvro

    I can’t download the plugin. the link shows 404 error message

    1. 1 Blogging Pro - Blog News, Tools and Hacks » WordPress Plugin: Language Picker
    2. 2 No Prerequisite » Language Picker Plugin Version .9
    3. 3 Weblog Tools Collection » Post in multiple languages using WordPress
    4. 4 serendipity » Bilingualisme
    5. 5 serendipity » Bilingualisme
    6. 6 Litux Blog » Language Plugin Test
    7. 7 Litux Blog » Language Plugin Test
    8. 8 Meine erste Seite » Lang Picker URL
    9. 9 Note to self… &raquo; Blog Archive &raquo; New plugin
    Comments are currently closed.