I added the below code to the function.php
of a .po file and finished localization and edited the webconfig.php
to add Arabic language but nothing happened. I want to know what should happen. Will the site include the new language – in my situation Arabic, or what?
Now the website is in English and I want to add an Arabic version.
<?php load_theme_textdomain('themename', TEMPLATEPATH.'/language'); ?>
First, read this Codex page about translating WordPress.
You have to create a language file to put into your language directory, do this by following the next steps:
I assume you want to use poedit since you talk about a
.po
filear
nplurals=2; plural=n == 1 ? 0 : 1;
../
and add path:.
__
_e
_n
_x:2c,1
_xn
_ex
esc_attr__
esc_attr_e
esc_attr_x
esc_html__
esc_html_e
esc_html_x
_n_noop
_nx_noop
translate_nooped_plural
This
.po
file will contain all your translated strings wich WordPress will use to translate your added code.To display WordPress itself in your language, download the language files from the Codex page and add them to your wordpress languages directory.
Then, in your
wp-config.php
, set the following line:I agree with @Mike regarding the purpose and general how to, I can just suggest that instead of using poedit, you can use a plugin called “codestyling localization” which enables editing the .po files directly from wordpress.
Also, make sure you create the appropriate .mo files, otherwise things won’t be loaded.