How can you locate the .po file used for translation of a page?

I'm trying to translate a plugin, Dokan Pro, but I can't seem to find the correct .po file that my Wordpress site is using to translate. Part of it is already translated in Italian, but other parts are still in English. I've tried by placing the .po and .mo file for the plugin, named correctly as per documentation (dokan-it_IT and dokan-lite-it_IT) in the /wp-content/languages/plugins directory, but it won't take that files. Is there any other .po files from where it …
Category: Web

How to change language file used by _e function

I am trying to make my own language switcher for my WordPress site. I am generating all labels using the _e and similar functions. So I am guessing the only thing I need to do is to change the locale used by WordPress. How can I do this programmatically? So in the ideal scenario when a user clicks on the desired language "this code" is run and WordPress uses the corresponding .mo file for the translation.
Category: Web

`wp_set_script_translations` with `wp.i18n` does not return translated strings in simple plugin

Short description: I try to translate strings in JS file. To test it I decided to create a simple test plugin. I have PHP and JS strings there. Translated PHP strings work fine, JS strings don't work. Tools and environment: WP-CLI 2.4.0 Wordpress 5.5.1 Ubuntu 20.04 Original languange: English (United States) Translate language: German Plugin PHP file content: <?php /* * Plugin Name: Test * Text Domain: test * Domain Path: /languages */ /** * Init all */ function run() …
Category: Web

Change "published by"

https://i.stack.imgur.com/tHTdu.jpg At my blogg / news is this line is coming at a new post. I use norwegian as language and then I want to change the word I marked yellow. In english is "published by:" In norwegian is would be "publisert av:", but I want it to say "Written by:" or in norwegian "Skrevet av:" How can I fix that ?
Category: Web

How do I change a plugin language of only one page?

My WordPress blog is set up as nl_NL. This means that my bookly plugin is also displayed in nl_NL. In the Plugin directory there is a folder languages with loads of other languages. I have one page in three different languages nl_NL, de_DE, en_EN, on this page I would like the booking plugin to be displayed in the correct language. I changed the page language via page id from nl_NL to de_DE Via the function.php, but this had no effect. …
Category: Web

How do I override a parent theme's language files with a child theme?

I have a parent theme and a child theme, I would like to override the spanish .mo and .po files in the parent theme (or add them if they are not present in the parent theme) with the es_ES ones in my child theme. I added the folder with the modified mo and po files in the child theme with the same folder name as in the parent theme but this is not working. How can I come about this? …
Category: Web

Language switcher for subdomains

We are running a wordpress site with Greek content (political & economical analysis) and we want to set up an English site of our site. The English site will be running on its own wordpress installation in a subdomain of the main site. If the primary site is http://www.analyst.gr then English site will http://en.analyst.gr. My problem that I face is that I can not find a proper solution for the language switcher. Ideally I want a language switcher that recognizes …
Category: Web

change only the theme language

My wordpress admin is in french. and my theme is in arabic. i have two files mo : arabic and french. i used this : add_filter( 'locale', 'change_locale' ); function change_locale(){ return 'pt_AR'; } load_default_textdomain(); load_textdomain('responsive', get_template_directory().'/languages/pt_AR.mo'); i have my site web in araic only if i deleted the file french pt_FR.mo if this file exit, my site web is will be in french not in arabic how can fixed it ?!
Category: Web

How to Fix WordPress Not Saving Settings?

How Can I Manually Fix & What is The Root Cause? The Site Language setting in Settings > General for my site, will not update. It is stuck on English (United States). I have done all the usually debugging procedures, such as disabling all my plugins etc, reinstalling WordPress etc. But the issue remains. Q: What is the best way to manually fix this, and what is the root cause of the issue likely to be?
Category: Web

How to find a language direction?

The function is_rtl() checks the blog language direction if it is LTR or RTL. public function is_rtl() { return 'rtl' == $this->text_direction; } But I couldn't find where or who fills in the text_direction data. If I change the blog language to Arabic then text_direction becomes RTL. Where does it get the language direction information from? The language list data is retrieved from the trasnaltions api https://api.wordpress.org/translations/core/1.0/ but that doesn't include the language direction! Is there another API for this? …
Category: Web

Different Admin language

We are running our WP site in Hungarian but nobody in our team understands this language. We successfully changed admin backend language to our native language but not everything changed. We are still getting notification emails in Hungarian. The top (black) admin bar is also in Hungarian. Woocommerce send orders in Hungarian to admin... Is there a way to change that?
Category: Web

Multi Site Language switcher

I have a multi-site network site. The main site url is example.com (default Korean) and want to have the second language site (example.com/en/ for English) If a user visits the one of Korean page, let's say (example.com/aboutus/) if he clicks the language switcher on the top bar (such as flag buttons to direct English page) I want to redirect him to (example.com/en/aboutus/ <-> vice verse ). Simple as this. Is there any similar switcher plug-in for this? or do I …
Category: Web

How to setup language of a date in a plugin

I am working on a Wordpress theme using a template to manage sports team, matches, players, etc. I settled my local wordpress time in French. In the blog part, no problem the post are displaying date in French. But there is a all part with custom post types managed by a plugin. The dates displayed by this plugins remains in English. By checking the code, I can see the date part formatting is managed here : function team_get_match_start($match_id, $format = …
Category: Web

Can I set is_rtl() to true?

I am adding a section to my site in Pashto, which is a custom Arabic RTL language. I can figure out how to inject "rtl" into the html tag and body tag using add_filter('language_attributes', 'custom_rtl_dir_attr'); add_filter('body_class', 'custom_rtl_body_class'); ... but because is_rtl() still returns false, things like the bootstrap rtl css don't get added automatically: if (is_rtl()) wp_enqueue_style('bootstrap-rtl', "//cdnjs.cloudflare.com/ajax/libs/bootstrap-rtl/3.2.0-rc2/css/bootstrap-rtl.min.css", array()); } What I am really looking for is a way to SET is_rtl() to true, for these pages, so that WP …
Category: Web

Admin menu in different languages

My Wordpress admin language is partially in English and partially in Dutch. This causes some things (like events) to show in English on the site, which is not supposed to happen. I used 'admin menu editor' and hid several items in the menu. It seems tat those items are the ones that are now not being translated to Dutch. I removed the plugin but nothing changed. Hope anyone can help with getting the items to follow the setting of the …
Category: Web

Translate emails into the language of the user

The following scenario: An admin activates a function or similar for a user (in the WordPress frontend). Now the user should be informed about this by email. Therefore an AJAX call is sent to the WordPress backend. There, the mail should be sent in the language set by the user. Here is my code for this: add_action('wp_ajax_handle_action', 'handle_action'); function handle_action(){ $username = $_POST['username']; $user = get_user_by('login', $username); $user_id = $user->ID; $email = $user->user_email; // To check if user lang is …
Category: Web

Override default WordPress core translation

WordPress is set to Dutch language. When I use get_the_archive_title() my theme correctly outputs "Categorie: Category-name" on a category archive page. However I'd like that to read "Sectie: Category-name". I do not want to change the Dutch language file in the wp-content/languages folder, because that will be updated by WordPress updates. I tried copying that translation file, altering the "category" translation and putting the new nl_NL.mo file into my-theme/languages. This did not have any effect. How can I achieve a …
Category: Web

Changing the language of a single page

I have a wordpress site in a language that aligns RTL, but some pages are in English. These pages look terrible, however, because the English text is aligned with the RTL language, and punctuation, etc. appear on the wrong the side. How can I set the language for a single page or several individual pages?
Category: Web

How do I change the language of the login page to Arabic?

I have a website where the backend is english and the frontend is Arabic. My wordpress login is in English but i want to make it Arabic. I have tried the first solution listed here How do I change the language of only the login page? but it is not working for me. In the code by @Stephen Harris, i changed return 'en_US'; to return 'ar' but nothing happened to my login page.
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.