Plugin Author
Gunu
(@grafcom)
@xnau,
did you try – Settings – Languages – Custom Integration – Compatibility Functions?
Not having any luck there, I don’t see anything that might help the __() function do it’s job.
I’m trying to avoid modifying the plugin code, so I can’t really make use of the IDs or classes, or qtranslate functions. I’m not using any custom filters for those strings, either.
Is there a way to get qtranslate to jump in and translate the strings that are going through the __() function?
Plugin Author
Gunu
(@grafcom)
Is there a way to get qtranslate to jump in and translate the strings that are going through the __() function?
Yes.
You use .po files for your plugin?
What language are you talking about?
See under – Settings – Languages – Languages – Edit (your) language what is under Locale?
This corresponds to your language files?
Ok, these strings can’t be in translation files, they are defined by the user. I let the user enter the setting value with the translation blocks. Then I use a __() gettext call with no textdomain to display the translated string.
It’s worked well in the past and doesn’t require the user to install a specific translation plugin. It works great on the frontend, but not in the admin for some reason…I thought it would be a simple thing to get it working in the admin also. As I mentioned, this also works well with the original qtranslate plugin.
Plugin Author
Gunu
(@grafcom)
But I’ve still got no answer to my questions….
What language are you talking about?
See under – Settings – Languages – Languages – Edit (your) language what is under Locale?
Ah I see…sorry…that is blank. In the WP general settings it is en_US
OK, when I edit the language, I see the locale is also en_US
Plugin Author
Gunu
(@grafcom)
What languages are active under qTranslate?
In what language the admin of your plugin is not visible?
Edit:
Did you change the language button in the upper right admin section used?
The site is set up for English, Nederlands, Deutsch, Español, and Français
I’ve tried changing the language, but the strings are still untranslated. For instance, a field label is shown as “[:en]My First Name[:de]Mein Vorname[:fr]Mon prénom[:nl]Mijn voornaam[:es]Mi nombre[:]”
This string is passed through the __() function before being displayed.
I have the same problem – I have a plugin that saves some strings in wp_options. I used to save content with lang string like [:en] and passing them trought __() would always leave the relevant translation in past (with original qtranslate, then qtranslate m). Now it does not.
In fact, just putting _e(‘[:bg]test1[:en]test2’); directly in my php for admin page still does not translate anything? It just echoes [:bg]test1[:en]test2
This means Qtranslate X is not automatically translating __() function… What should I do?
Plugin Author
Gunu
(@grafcom)
@talkingaboutthis,
compatibility functions checked?
@gunu – the problem seems to be that the gettext filter is now moved to qtranslate_frontend with version 3.3… So Qtranslate X just does not work on __() calls in the admin any more… I find this veeeeery strange. __() calls were the way that plugins could let users have multilingual content with different multilanguage plugins. One should not be supposed to develop for a specific multilanguage plugin – my code should work with all major multilanguage plugins.
Here is the use-case in more detail: I have a shopping cart and site user can enter custom payment methods, for example. These payment methods have a name. So the user would be able to name them like [:en]Bank Transfer[:de]Überweisung . This is not only used on the frontend, but also on the backend – in the order information. Or for example, when the seller prints the invoice for the purchase, the invoice is supposed to be in the correct language for the buyer.
Plugin Author
Gunu
(@grafcom)
@talkingaboutthis,
So Qtranslate X just does not work on __() calls in the admin any more
This should work.
Which other plugins do you use?
I already tried turning all other plugins off…
In Qtranslate X release notes for last version it says:
Enhancement: filters ‘gettext’ and ‘gettext_with_context’ are moved to qtranslate_frontend.php, as they are not needed on admin side.
So __(‘[:en]test[:de]test2’) in admin would no longer work… I believe @xnau is referring to the same problem, which is why I wrote here.