Some strings stay untranslated in Wordpress plugin - wordpress

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') ?>

Related

Wordpress POT file ignored

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.

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/

WordPress tanslation .po file

I translate one row in a code and still any result.
This row I need translate
This is I put into the .po file
Can you tell me what I'm doing wrong?
I need translate the custom button "Poptávka" on this page usb-4-logo.com/en/
For strings to be translatable you need to use any of WordPress translation functions around the string:
For example:
This string <-- this will not be translatable
<?php __e('This string','your-namespace'); ?> <-- this will be translatable.
You have quite a few methods for making content translatable: __(), _e() and others. Read more in the documentation about translation: https://codex.wordpress.org/L10n

Why strings don't appear in "String translation" of WPML?

I have in my php files string like this:
<?php
__('My string A', 'a_theme');
_e('My string B', 'a_theme');
?>
and there are not appearing in "String translation" .
I have also bought and installed this theme: http://preview.ait-themes.com/index.php?bartype=desktop&theme=touroperator and strings from that theme aren't also appearing in "Strings translation" of WPML.
This is one example of string which was already in theme when I installed it:
<input type="text" id="dir-searchinput-location" class="dir-searchinput-select" placeholder="{__ 'Destination'}">
Is there some extra configuration which I need to do or something else?
Thanks for help
To get strings to appear in String Translation, you first need to go to Theme and plugins localization. Scroll down to the Strings in the theme section and then click the Scan the theme for strings button. WPML will then detect any unregistered or newly added strings that are properly formatted for localization.
If it works, you'll see your theme a-theme listed in the Domain column and the number of detected strings in the Count column. Clicking the View strings that need translation button will take you to String Translation. If any of the strings aren't properly formatted for localization, the count won't be updated.
If you update existing strings or add new ones, you'll need to rescan before WPML adds them to String Translation.
The formatting in your first example looks OK and WPML should detect the strings, but in the second example, you haven't declared a domain. Without a domain, WPML won't pick up the string.
The correct format is
__('Your string', 'yourDomain')
or
_e('Your string', 'yourDomain')
In this case, the domain should be the name of your theme, 'a_theme'.
Those strings are cached somehow. So, if you added new one (the right way) and it still doesn't appear in String translation go to "Theme and plugin localization" and hit "Scan the theme for strings" button. This will re-index strings and your newly added one should appear (worked for me).
I have same problem, my theme is "bookyourtravel", and plugin "WPML string translation",did not translate these texts:
<?php _e('Accommodations', 'bookyourtravel'); ?>
<?php _e('Tour', 'bookyourtravel'); ?>
<?php _e('Accommodation', 'bookyourtravel'); ?>
No translated!!!
My solution was:
In WPML go to "localization of themes and plugins", check in
Translated by WPML, then clic en Save.
Now in, "Translated string", clic in button: save the settings and rescan strings.
If you use Cache, then Clear all cache in pages.
ready, this worked!!!!!!!
source : https://wpml.org/forums/topic/using-gettext-for-hard-coded-strings-what-else/

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