WordPress.org

Ready to get started?Download WordPress

Forums

How to localize widgets? (3 posts)

  1. akc
    Member
    Posted 7 years ago #

    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?

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    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.

  3. akc
    Member
    Posted 7 years ago #

    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)?

Topic Closed

This topic has been closed to new replies.

About this Topic