Hot answers tagged

8

You can use the tool POEdit to translate your theme from scratch or update/add new strings into the .po/.mo files. Here is the tool usage tutorial: Translating_With_Poedit There is a plugin that can do the job for you: codestyling-localization STEPS: 1. Load a text domain for the theme. add_action('after_setup_theme', 'my_theme_setup'); function ...


3

You have incomplete code. You register your Theme's textdomain, but don't actually tell WordPress to load your translation files. To this: load_theme_textdomain('INTERluminaires', get_template_directory() . '/languages'); Add this: $locale = get_locale(); $locale_file = get_template_directory() . "/languages/$locale.php"; if ( is_readable( $locale_file ) ...


3

Child themes should use load_child_theme_textdomain(). You can find it in /wp-includes/l10n.php. Use a new slug and a separate po file.


3

There are already an en_US.po file in the theme you are using. You can simply make a copy of that file and rename it as pl_PL.po. You can now open the pl_PL.po template with poedit, do all your translations in there, and just save it. Poedit will automatically create a pl_PL.mo template. No need to go through all the pt. Just remember, as previously stated,...


3

Hi to translate your website you can do the following: Define your language in wp-config.php : define('WPLANG', 'pl_PL'); Then generate a po file for your theme with e.g this service: iCanLocalize Scanner Then your po and mo files should be named pl_PL.po and pl_PL.mo and put into a folder called languages or lang or something like this in your theme. if ...


2

First of all, the plugin should support translation. If it is so, the directory where to put po/mo file is defined by plugin, usually they are in a directory /langs or /languages in plugin directory. That directory is (should be) defined by plugin using load_plugin_textdomain The plugin you are using has a subfolder cimy-user-extra-fields/langs where you ...


2

A .mo file is the machine readable Version of a .po file, which in turn holds the translation of a .pot file. Hence, the latter is what you want to have in the first place. And if it is your theme you want to localize, you certainly do not need a random plugin's simplified Chinese .mo file... Using either, poedit, any other gettext application or the ...


2

Have you added the Function load_theme_textdomain to the theme? so if you have them themes .mo files in theme/mytheme/languages Loads the theme's translated strings: add_action('after_setup_theme', 'my_theme_setup'); function my_theme_setup(){ load_theme_textdomain('my_theme', get_template_directory() . '/languages'); } Put this in your functions.php


2

Yes, sort of. Any localized plugin such as WP-Members runs off of the "locale" that WordPress is set to. This value can be filtered for WP as a whole using the locale filter. But it can also be filtered for plugins using plugin_locale See: https://developer.wordpress.org/reference/hooks/plugin_locale/ To use plugin_locale specific to the text domain for ...


1

Found a solution that works for me: add_action( 'after_setup_theme', 'avia_lang_setup' ); function avia_lang_setup() { $lang = apply_filters('parent-theme-slug', get_template_directory() . '/lang'); load_theme_textdomain('avia_framework', $lang); load_child_theme_textdomain( 'child-theme-text-domain', get_stylesheet_directory() . '/lang' ); } ...


1

1) Presuming you're running WordPress 4.x. The WPLANG constant does nothing. WordPress 3 and below defined the default language in wp-config.php but since WordPress 4 setting your site language is done via the General Settings page in your admin area. Go to Settings > General and scroll to the bottom where is says "Site Language" next to a dropdown list. 2) ...


1

You can edit .po files in text editor. Structure is very simple (some header, do not touch it) and a number of translations like that: #: 404.php:21 msgid "Sorry! Page Not Found !" msgstr "" You can ignore comments started with #. msgid - string how it appears in php code msgstr - translation (if empty, msgid string will be shown on site) You can find ...


1

You can use POedit to generate the PO file from source code: https://codex.wordpress.org/User:Skippy/Creating_POT_Files The problem for me is that my WordPress installation is running on an Amazon Linux server, which does not have a package in the repos for POedit and I couldn't figure out how to install POedit on my server (only on my local Windows ...


1

Here's how to do it in 2018: Install wp-cli on your development machine. Run wp i18n make-pot . languages/my-theme.pot in your plugin/theme folder (wp-cli i18n) Wrap your strings with gettext: // Requires WordPress >= 4.7 __('Something'); // Compatible with WordPress < 4.7 (Roughly 15%~ of all WordPress Websites) __('Something', 'my-theme'); Run ...


1

The default text domain is registered in wp_load.php before plugins are loaded. See the function wp_load_translations_early(). So when you register your action callback, the text domain has been loaded already. For an alternative way to list all registered text domains see this answer: List of Default Translated Phrases.


Only top voted, non community-wiki answers of a minimum length are eligible