Articles of translation

Does wp_nav_menu use the gettext filter?

I’m working on some multilingual code in a theme, and I was wondering if wp_nav_menu uses the gettext filter internally (i.e. same functionality as __() and _e().)

Should I always prefer esc_attr_e & esc_html_e instead of _e?

I am working to internationalize my plugin. As I can see on WordPress site about esacaping, it says you should always use it. But as I can see in many popular plugins, they have used _e instead apart from few specific cases. So should I always use escaping or not for all strings, if not […]

Can't set proper WooCommerce language translation

I’ve set WordPress’ language to my language (General -> Site Language) and downloaded latest translations for WooCommerce and uploaded it via FTP but I still see untranslated strings on webpage. What am I doing wrong? I’m using WP v4.6.1 and WC v2.6.6. Here I selected WP language (not sure why woocommerce-sl_SI is listed but after […]

use __($str) to translate strings (symfony/twig)

I usually use frameworks like Yii(2), Zend or Laravel to build pages but a customer forced us to use WordPress this time. I integrated Symfony/Twig as my template engine but now I have trouble with localization/translation. Because no matter what I do my strings won’t be translated or even found by WordPress. Like in Laravel […]

How to set translations in javascripts for my plugin?

I have in my plugin : form.js : js script to do a custom validation on form fields js_lang.php : based on this stackoverflow post my-plugin-domain-fr_FR.po In form.js, I use a var (msg_must_match) from js_lang.php function inputsMatch( inputTypes, idInputReferring, idInputRepeat ){ var inputReferring = document.getElementById( idInputReferring ); var inputRepeat = document.getElementById( idInputRepeat ); var checkPasswordValidity […]

Theme localization in WPML – .mo file error

We are creating a multi-lingual multi-site (on sub-domains/domain mapping) on WordPress. We recently bought WPML WordPress plugin and installed it on the basic language (English) version. Now we are trying to work on Theme Localization. Here we are following the steps as in this guide. Here we are being instructed to install a .mo file […]

How to override languages files in wp-content/languages/themes with child theme

I want to create a child theme for TwentyFifteen theme, which will customize a lot of things, including translation. When I install WordPress in my language (Farsi), it includes TwentyFifteen language files in wp-content/languages/themes So when I create a languages folder in my child theme and add customized language files to it and add load_theme_textdomain( […]

How to i18n text coming from the db or from an external source

I’m writing a plugin and i wanted to i18n correctly text which i’m storing in the db or in an external file. How should i do that?As of now we are generating pot files with wordpress and so all the Translatable text is in calls __( ‘text’, ‘plugin_name’); But there is some text i would […]

Where is the right .mo file inside the language repository?

I need to translate my WordPress in Italian. Following the instruction written on WordPress in Your Language, I’ve searched my .mo file inside the Language Repository but I’ve some problems. The folder structure is not as expected, there are lots of folders that don’t make me any sense: branches/ buddypress/ mu/ rosetta/ tags/ trunk/ I’ve […]

WordPress po files

Hi all I have one problem. Po file doesn’t work. I use qtransltae-x for translation. And I create custom pot file example # Copyright (C) 2015 Gawatt msgid “” msgstr “” “Project-Id-Version: Gawatt 1.0.0\n” “POT-Creation-Date: 2015-06-03 11:30+0400\n” “MIME-Version: 1.0\n” “Content-Type: text/plain; charset=UTF-8\n” “Content-Transfer-Encoding: 8bit\n” “PO-Revision-Date: 2015-MO-DA HO:MI+ZONE\n” “Last-Translator: FULL NAME <EMAIL@ADDRESS>\n” “Language-Team: LANGUAGE <LL@li.org>\n” “X-Generator: […]