WordPress.org

Support

Support » How-To and Troubleshooting » How to localize widgets?

How to localize widgets?

  • For example, the Recent Comments widget has a line that says “__(‘%1$s on %2$s’)”. The “on” is obvioulsy an English word. How to properly localize it without hacking widgets.php?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Samuel Wood (Otto)

    @otto42

    WordPress.org Tech Dude

    Start reading here: http://codex.wordpress.org/Translating_WordPress

    That __ bit is the gettext translation function. You need to create a POT file for the widgets.php file, add the proper translations, and create the relevant MO file.

    Thanks for the reply. I’ve played with POT and created MO before, but only to translate bits of the main WP ware. What is unclear to me (even after reading Codex) is where you put the widget’s translated strings. Since you mentioned “create a POT file for the widgets.php file”, I’d assume each widget gets its own POT (and MO)?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to localize widgets?’ is closed to new replies.