Blog Archives
Steps to Translate your theme to native language.
- Download a gettext file editor like poedit and install it.
- Open the English .po file that came with your WordPress theme or plugin with poedit. If you only got a .pot, just rename it to .po and open it in poedit.
- Now go through and translate all the text one line at a time in the bottom box.
- Then “File” => “Save” to your desktop or a folder on your computer. This will output a filename.po and filename.mo file.
your file may look like this
msgid “”
msgstr “”
“Project-Id-Version: Arras Theme 1.4\n”
“Report-Msgid-Bugs-To: \n”
“POT-Creation-Date: 2010-03-14 01:12+0800\n”
“PO-Revision-Date: \n”
“Last-Translator: Praveen \n”
“Language-Team: \n”
“MIME-Version: 1.0\n”
“Content-Type: text/plain; charset=UTF-8\n”
“Content-Transfer-Encoding: 8bit\n”
“X-Poedit-Language: English\n”
“X-Poedit-Country: SINGAPORE\n”
“X-Poedit-SourceCharset: utf-8\n”
“X-Poedit-KeywordsList: _e;__\n”
“X-Poedit-Basepath: .\n”
“X-Poedit-SearchPath-0: ..\n”
#: ../404.php:7
msgid “Error 404 – Not Found”
msgstr “”
#: ../404.php:9
msgid “”
“<p><strong>We’re very sorry, but that page doesn’t exist or has been moved.</strong><br />\n”
“\t\tPlease make sure you have the right URL.</p>\n”
“\t\t<p>If you still can’t find what you’re looking for, try using the search form below.<br />”
msgstr “”
#: ../archive.php:10
#: ../archive.php:12
#, php-format
msgid “%s Archive”
msgstr “”
#: ../archive.php:14
#: ../archive.php:16
#: ../archive.php:18
#, php-format
msgid “Archive for %s”
msgstr “”
put those file into your theme folder.
edit function.php as follows.
<?php load_theme_textdomain(‘theme_name’); ?>
replace theme_name as your wish and use the same below.
you may seen like this in your theme or plugin.
replace theme_name as your wish where ever you use.
<?php _e(‘message’,’theme_name’) ?>
You will need to make a change your WordPress wp-config.php file (located in your WP root directory) with the correct language codes like the example below. If you don’t have a WPLANG entry then create one.
define (‘WPLANG’, ‘filename’);
replace filename by your saved file name alone