• I have a custom plugin running on a site using qtranslate-x. I’m passing all display strings through the WP translation function __() and those strings are using the language tags like this: [:en].

    On the frontend it’s no problem, everything is translated, but in the admin, the strings are untranslated. This was working when I was using the original qtranslate, but qtranslate-x doesn’t translate those strings in the admin.

    What do I need to do differently to get qtranslate-x to translate those strings in the admin?

    https://www.ads-software.com/plugins/qtranslate-x/

Viewing 15 replies - 1 through 15 (of 35 total)
  • Plugin Author Gunu

    (@grafcom)

    @xnau,

    did you try – Settings – Languages – Custom Integration – Compatibility Functions?

    Thread Starter xnau webdesign

    (@xnau)

    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?

    Thread Starter xnau webdesign

    (@xnau)

    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?

    Thread Starter xnau webdesign

    (@xnau)

    Ah I see…sorry…that is blank. In the WP general settings it is en_US

    Thread Starter xnau webdesign

    (@xnau)

    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?

    Thread Starter xnau webdesign

    (@xnau)

    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.

    Plugin Author Gunu

    (@grafcom)

    @xnau,

    I hope this helps

    Most themes/plugins use __() translation by default, otherwise you may ask theme author to make this little modification for each field you need to be translatable.
    Also, proper way for them to pass a variable through a filter, and then you can put the filter name in “Custom Filters” configuration to integrate their plugin. This is the best and proper way which does not require any knowledge about q-X.

    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.

Viewing 15 replies - 1 through 15 (of 35 total)
  • The topic ‘plugin strings in admin not translated’ is closed to new replies.