0

I'm developing a wordpress based site in English but I've installed the Italian version of it...
In my blog page, I get dates, exactly months, in Italian instead of English...

How can I translate this? Are there other things I must manually translate?
For example, where should I translate errors?

Thanks!

migrated from stackoverflow.com Jan 27 '11 at 12:23

This question came from our site for professional and enthusiast programmers.

1

I do this with the One Backend Language plugin. This way, the WPLANG language is only used in the frontend, and another used in the admin area.

There are more plugins that do this, some allow you to choose a language per user. The downside is that you can still be logged in when you visit the frontend, and thus get the language of the admin area there too.

  • Yes, I hope to help someone in this community, like in stackoverflow :) Thanks! – matteodv Jan 31 '11 at 0:21
1

The developers of Wordpress chose to use GNU gettext method to handle localization.

This is all documented and bit you'll need specifically can be found here http://codex.wordpress.org/Translating_WordPress#Date_and_Time_Locale_Settings

  • thanks but I don't understand how to translate it... should I use a terminal (I'm on a Mac)... Should I create pot files? How can I create them? – Matthew Jan 26 '11 at 21:18
  • Is is all documented on the link I gave you. Translating With Gettext Tools 1. Download the official WordPress POT file 2. Open the file in your favorite text editor 3. Update the header information 4. Translate the messages 5. Save the file with a .po file extension 6. Issue msgfmt -o filename.mo filename.po – John Cartwright Jan 26 '11 at 21:21
  • Just to be clear, the instructions above are found here -- codex.wordpress.org/… – John Cartwright Jan 26 '11 at 21:22
  • 1
    @Matthew: There are plugins that allow you to have a different language in the frontend and in the admin area. You can make "English" the main language so that the dates and messages there are in English, and the admin area in Italian. – Jan Fabry Jan 27 '11 at 14:13
  • 1
    @Matthew: Ah, that login works per-user, so perhaps it detects you are still logged in when you visit the site and thus gives you the backend language on the frontend too. I use One Backend Language, which is simpler, and works for me: Dutch in the frontend, English in the backend, but the reverse is also possible. The frontend language is the one you set in wp-config.php, the backend language is set via the plugin. – Jan Fabry Jan 28 '11 at 6:44
1

When date is retrieved from database WordPress passes it through date_i18n() function that draws your locale settings and translates date. You can filter its hook to override translated date with PHP default one in English.

Try this:

add_filter('date_i18n', 'eng_date', 10, 3);

function eng_date($j, $req_format, $i) {

    return date($req_format, $i);
}

As for more global solution I know there are plugins to handle separate languages for front-end and back-end. Hadn't used any myself so can't recommend one, search official plugins repository.

0

You might find the WordPress Multilingual plugin helpful here.

It probably does a lot more than you need, but it has superb functionality for automatically displaying the system-generated messages in the right language for a specific post/page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.