I have en_US.mo and en_US.po files in themes/languages folder.
My themes/functions.php are
function custom_theme_setup() {
$lang_dir = get_template_directory() . '/languages';
$locale = "en_US"; // get_locale() is also returning same
if ( is_readable( "$lang_dir/$locale.mo"))
echo "Yes, its working";
echo load_theme_textdomain('tutsplus', $lang_dir);
_e("Hellon","tutsplus");
}
add_action('after_setup_theme', 'custom_theme_setup');
_e("Hellon","tutsplus");
I have en_US.po file which contains
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSIONn"
"Report-Msgid-Bugs-To: n"
"POT-Creation-Date: 2014-07-22 18:39+0530n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONEn"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>n"
"Language-Team: LANGUAGE <LL@li.org>n"
"Language: en_USn"
"MIME-Version: 1.0n"
"Content-Type: text/plain; charset=UTF-8n"
"Content-Transfer-Encoding: 8bitn"
#: getetxt.php:80
#, php-format
msgid "Hellon"
msgstr "bonjuren"
I have included one file at the end, which also has the same
_e("Hellon", 'tutsplus');
but none of this seems to work.
The native translators in WordPress does not recognise
"
, so it skips that translation, that is why you don’t see the translated text in the front endYou should, and this is a golden rule, ALWAYS use the single
'
. So your string should beAnother point of note. You can drop the text domain completely.
If you make use of the text domain, it must be the same as the text domain explicitly named in your main stylesheet’s header.