YD Setup Locale
It will automatically setup the right XML header lang attribute + the internal WordPress $locale variable that is used to load the right language files for i18n and l10n (.po, .mo).
Usage:
Your blog URL structure should always begin with an official two-letter langage code, for example:
/en/… for english
/es/… for Spanish
/ja/… for Japanese
/fr/… for French
etc.
Pages that don’t comply to this URL scheme will still get your blog’s default locale setting, as configured in your wp-config.php file.
le 7 June 2009 à 1:43 h
[…] the end, I found it simpler to write my own multi-lingual plugin to achieve what I needed. The trick I came about with is quite simple indeed (the plugin is […]
le 23 October 2009 à 18:13 h
Thank you for this plugin. It will be nice for me
le 14 December 2009 à 21:21 h
is this product for just pages or is it for posts as well. seems to suggest that it will be only pages??
Would be nice also if you sorted out this page so that it was in english not in French….. http://www.yann.com/en/wp-plugins/yd-setup-locale as it does not give me much confidence to download and work with your plugin.
le 14 December 2009 à 23:14 h
It does pages and posts, as long as you setup your posts url to begin with 2-letter country code. It only changes the meta and html header information appropriately, as well as WordPress internal variables. You still have to translate the content yourself! As for this page, just lookup the html code, you will see the headers are set right for English (en). I did not translate my site’s side menu but this is unrelated: if I were to provide a .POT translation file for example, it would work.
le 15 December 2009 à 0:25 h
Yann,
thanks for your reply. So in essence I will need to have a seperate wordpress setup for each language /en /fr /es so that I can start my blog with that as the first name, or is there something funky I can do with the Permalinks settings?
I hate to say it, but I am viewing english [en] as my browser language and it is defaulting to french date time and form text is also in french.
i.e
Envoyez votre réponse
Nom (required)
e-mail (ne sera pas publié) (required)
Site Web
le 15 April 2010 à 6:34 h
I am really confused…
If i create a page shall i save it as per normal or i need to override the link with something like /en/….
Please help!
Cheers
le 25 August 2010 à 18:24 h
@All:
The plugin works, but this site (yann.com) has never been totally localized and does not use one of WordPress i18n plugins. So please don’t base your appreciation on all that you see here. Localizing a custom theme is hard work. Also, some plugins don’t support localization, so you would have to either get rid of those or rewrite them to support language switching.
For the plugin to work, you must make sure (using the permalink structure usually) that your page and posts url contain the two-letter sequence that governs the switch. Like on this site: if you look at the html headers, you will see that although some of the CONTENT of the pages might not be translated, the actual language environment is switched depending on the /en or /fr url prefix, which is reflected in the <html lang=”…”> tag at the very top of the page source code.
If you can’t achieve such a URL structure then you won’t be able to use this plugin.
le 25 July 2012 à 20:55 h
Hi Yan
Will your plugin work on WP3.x?
Is there a chance to get it working?
Thanks in advance!
le 25 July 2012 à 23:24 h
Hello again 🙂
Bon, il semble marché nickel en 3.4…
le 26 July 2012 à 9:04 h
@Eric : bonne nouvelle, merci pour l’info.