Wordpress POT file ignored - wordpress

I generated pot file for my theme with wp-cli.
wp i18n make-pot wp-content/themes/my-theme/
Then I copied it and change name to pl_PL.pot which is my native language, but even when I change value in this file on my website i still see English version instead of Polish.
#: tools/customizer.php:5
msgid "Theme options"
msgstr "Opcje motywu"
I use __() and _e() function. I added Text Domain: my-theme to style.css and set polish language in wordpress setting but still not work.

Related

How do I change wordpress texts

I'm pretty newbie with wordpress.
I already created my website based on template. I did couple changes on ".po" file, like:
#: wp-login.php:875 wp-login.php:950 wp-login.php:1010 wp-login.php:1112
#: wp-includes/general-template.php:324
msgid "Log in"
msgstr "Log into your awesome account"
...
#: wp-login.php:1347 wp-login.php:1391 wp-includes/general-template.php:466
msgid "Log In"
msgstr "Another Log In text"
None of them were changed. Why it happened?
.po files are for translations to other languages, not to change what is displayed by your templates.
To change texts that are part of template files, you have to change the according php files in the theme folder. But that's not a good idea, since next time the theme is updated, these changed files will be replaced by the new files and your changes will be lost.
So to avoid that, it's best to use a child theme and only include the files (as copies from the parent theme) where you want to make changes.
More on child themes here: https://developer.wordpress.org/themes/advanced-topics/child-themes/

Some strings stay untranslated in Wordpress plugin

There is a plugin with other languages translations. I used poedit, online po editors and even plugins to update some strings in localization.
Here are sources:
<label for="user_login"><?php _e("Username or E-mail:") ?><br />
on line 911 in plugin's php file
#: ../other-includes/wp-security-rename-login-feature.php:561
#: ../other-includes/wp-security-rename-login-feature.php:911
msgid "Username or E-mail:"
msgstr "Имя пользователя или e-mail:"
in plugin's localization po file.
The name of locale files is correct. The files are correct. Other strings are fine end whean I edit them, the translation works.
I've changed string in php, then updated po from sources, edited translation, but nothing has happened.
Your code looks right just do one thing provide the text domain of your current theme in the _e() function like below code :
<label for="user_login"><?php _e("Username or E-mail:",'textdomain') ?>

Text domain issue on ThemeCheck

I am running my theme through ThemeCheck ( https://wordpress.org/plugins/theme-check/ )
One of the required fixes states:
REQUIRED: This theme text domain does not match the theme's slug. The text domain used: This theme's correct slug and text-domain is my-theme-name.
This is not a multi-language theme and I have removed all the translation from the theme, I have looked at all __() statements and _e and I believe I have successfully removed everything required for translation.
The error message should have a value after 'The text domain used: ' but it is just displaying blank too, which maybe means the issue is an empty '' in my code...?
The folder for the theme is correct and is my-theme-name
How do I find/fix this...?
The theme review standards require the following:
All theme text strings are to be translatable.
Include a text domain in style.css
You're receiving a warning because you're not following this requirement, and your text domain is an empty string.
Theme check plugin required __() function with your text domain.
If plugin can`t find __('string','my-theme-name') in theme files, he return error
"REQUIRED: This theme text domain does not match the theme's slug"

WordPress multiple text domain

I am working on a wordpress theme which is based on buildpress and it has its own languages/en_US.po translation file. I would like to add my own custom translations, seperated from the main translation file. so I've added some _e('My string', 'my-domain') and placed languages/my-domain_en_US.po but how can I make Poedit scan only my text domain since i'm scanning the theme and getting all the buildpress's strings. any ideas?

Translation for wordpress theme "Tarski"

I'm using the Tarski theme for a wordpress blog.
I want the blog to be french.
I looked at this page http://tarskitheme.com/help/localisation/, but I can't catch up how to use the .POT file to translate it in french.
I downloaded the file and opened it with geany, made all the translation, ex:
msgid "Search Results"
msgstr "Résultats de recherche
But then can someone explain to me what to do with this file?
I suppose I have to rename it to tarski_3.0-fr_FR.pot, but then where do I put it? Do I have to "compile" it somehow?
Thank you all.
EDIT
It seems that I must ask a question here to find a answer by myself, I just find that I must generate .mo file from the .POT
http://en.wikipedia.org/wiki/GNU_gettext#Translating
But I'm still don't know where to put this file... still searching.
You simply drop the .mo file in the root directory of your theme, and load the text domain. In your case, this last step is already done: the theme already loads its text domains (line 78 in functions.php, the function is load_theme_textdomain).
If you'd like a GUI for editing your translation and generating the .mo, try Poedit.

Resources