qtranslate / qtranslate-xt

qTranslate-XT (eXTended) - reviving qTranslate-X multilingual plugin for WordPress. A new community-driven plugin soon. Built-in modules for WooCommerce, ACF, slugs and others.
GNU General Public License v2.0
553 stars 104 forks source link

Issue with changing translation #1198

Open kmarosi opened 2 years ago

kmarosi commented 2 years ago

Hi,

I've a website which uses qTranslate for enabling multilingual functionality. The main plugin used on the website is Sportspress Pro. Default language is Hungarian, with the option to change to English.

The English translations works perfectly. However, I'd like to wish to change some of the Hungarian translations. Sportspress has a built in function to change strings etc., but this doesn't seem to work 100% with some of the standard strings. The two strings I specifially would like to change are: Home - translates to Kezdölap (I want it to be Otthoni) Date - translates to Közzétéve (I want it to be Dátum)

I've tried to change PO-files, both manually and using PoEdit but nothing works. The standard translations are not changing. I even tried the SayWhat?-plugin but no dice. Anyone have any ideas on how to solve this?

(Note, if I disable qTranslate, the translations I've put in Sportspress works perfectly)

nabi009 commented 2 years ago

same issue: anyone help!

spleen1981 commented 2 years ago

I took a quick look and that seems to depend on how those "override" text fields are stored as options by Sportpress, Basically that option array is stored using as keys directly the translated string (in admin language). Hence if I add custom text with english language in admin, say "Date_x", option will be stored as var['Date'] = "Date_x". Now if I check frontend using english language, result will be as expected "Date_x". If I change frontend language, say Italian, Sportpress will try to find var['Data'], won't find anything, and will retain translation "Data" from its translation domain (modifying this should work, maybe you didn't regenerate the relevant mo file). Changing language in admin to store different sets won't work, Sportpress will keep only the last array.

I think this is an issue of Sportpress rather than QTX (which brings to light the issue just because allows the user to change the frontend language). They should use constant keys for the associative array above, instead of strings variable with frontend language: in that case you could directly add the translations for each language in the settings field (e.g. with ML tags), and that field would become automatically multilingual. You can mention this thread if you open an issue there.

For the time being I think you have these options (first one tested, others not but should work):