[checkoutpaypal] problem with the translation of "Clicking the Paypal button will..."
bchantre
Joined: 2005-11-16
Posts: 55 |
Posted: Mon, 2008-09-08 11:15 |
Here's the beginning of Payment.tpl (not modified) with information about payment through Paypal. Normally, this text should be displayed translated (in french in my case), but it stays in english. The translation exists in the .po file and .mo file too. I don't understand why this doesn't display the translated version. I made a test with a copy/paste of another translated text: "{g->text text="Payment received through Paypal - thanks."}", but it stays in english too. Database cache, template cache and browser cache were deleted before test. {* * $Revision: 1586 $ * Read this before changing templates! http://codex.gallery2.org/Gallery2:Editing_Templates *} {if $payment.paymentVariables.active} {if $payment.paymentVariables.orderTotal > 0} <tr> <td align="left" class="checkoutPaymentOptionText"> {g->text text="Clicking the PayPal button will redirect you to PayPal where you can pay by credit card. Your information is securely encrypted and cannot be intercepted. You do not need a PayPal account to complete the transaction via PayPal."} </td> Any suggestions? Thank you |
|
Posts: 11
Hello,
I have exactly the same problem. All the traduction I've made for checkout and checkoutpaypal are successfully display, except the payment page where the "Clicking the PayPal button will redirect you to PayPal ..." sentence remains untranslated.
The only solution I've found is to create a local/Payment.tpl with my own translation without the g->text mechanism. But it is an awful solution, which can't adapt with the client language.
Is there someone here who can explain what is wrong with checkoutpaypal Payment.tpl ? Or give a solution ?
Many Thanks.
Posts: 4342
My experience of these kinds of things is that unexplained translation problems tend to be rooted in various gettext caches that the server uses.
Posts: 11
Thanks alecmyers for your answer, and sorry for the time I made to respond to you.
I have to learn more on the "various gettext caches".
Could you give me some idea on how to flush them ?
Posts: 4342
Unfortunately, so do I...
I think an Apache restart is needed. I'm guessing here; there have been threads where, for example pages have been randomly translated or not: one refresh the page is in English - then in (eg) Dutch a couple of times, then back to English for a bit - and so on. The problem eventually went away.
A google search turns up these interesting pages:
http://answers.yahoo.com/question/index?qid=20080322210552AARdcRx
http://forums.thedailywtf.com/forums/t/11122.aspx
http://forums.codewalkers.com/php-coding-7/clear-the-gettext-cache-without-restarting-the-server-help-needed-78688.html
Posts: 11
Many thanks for the various links.
I tried to rename my module_checkoutpaypal.mo, restart my Apache server, and I also flush the template G2 cache. But It doesn't solve the problem.
It made me crasy ! It is the only one sentence I can't translate. All the others are OK.
Posts: 4342
You'll be pleased to know (actually I think the whole planet will) that G3 doesn't use gettext at all.
What if you try changing some of the other texts, as an experiment? If you can get those to change, but the one you're having problems with still isn't being translated then it's unlikely the issue is with caching.
Posts: 11
Actually, I can translate every message from the Admin.tpl, but I can't do the same with messages from Payment.tpl
Following is my translation method that I use :
make PO=fr
make install PO=fr
and a
cp ../locale/fr/LC_MESSAGES/modules_checkoutpaypal.mo ../../../../../g2data/locale/fr/LC_MESSAGES/
But messages from Payment.tpl never appears in the translated form. For having it in French, I should add a local/Payment.tpl with my translated messages without the use of any {g->text text="my message"}
It's like the Payment.tpl doesn't use gettext at all.
Anyway, many thanks for your help.
Posts: 4342
Payment.tpl is correctly formatted, or the strings wouldn't appear in the .po file for you to translate.
Have you checked the date on the actual .mo file that you're copying to make sure it matches the latest changes to your .po file?
Posts: 11
Yes, I check the date of the module_checkoutpaypal.mo and it matches the latest changes of my fr.po file.
I agree with you that Payment.tpl is probably correctly formatted. But is it a possibility that Payment.tpl is not include has it should in classes/CheckoutPaypalPaymentPlugin.class ? Or should it be possible that it lacks a gettext include somewhere ?
Posts: 4342
Gettext support is built into the Gallery core, it's not an option for modules not to support it.
Posts: 11
So, I really do not understand why this sentence isn't translatable...
Posts: 4342
Divide and conquer. Change the original text to something else, and see if that translates. Try a different language. Try putting the same text in a different template, and translating that. See what facts follow the problem around.
Posts: 11
So do I. I take the following test :
<br />{g->text text="My english sentence"}
BUT the same sentence IS NOT display in french on the payment page.
So it seems to be desperate to use gettext in the Payment.tpl template...
Posts: 4342
What happens if you put some text to translate in the Payment.tpl from another module, eg. checkoutemail?
Posts: 11
Hello alecmyers,
I tried the followings things :
{g->text text="My english sentence"}
in the checkoutemail Admin.tplThe result is the string is display in English in the checkoutemail admin page, while it is display in French in the checkoutpaypal admin page.
{g->text text="Checkoutemail Settings"}
in the checkoutpaypal Payment.tpl.The result is this string is also display in English in the checkoutpaypal payment page, while it is diplay in French in the checkoutemail admin page
{g->text text="Checkoutemail Settings"}
in the checkoutpaypal Admin.tpl.This string is then display in English in the checkoutpaypal admin page.
So, I can say that a string translated in one module is never displayed translated in another module.
Is it what is expected ?
Many thanks again for your help.
Posts: 4342
Yes, each module is it's own seperate translation domain.
What happens if you put a new string in checkoutemail/templates/Payment.tpl, rebuild the fr.po for checkoutemail, translate the new string, build a new modules_checkoutemail.mo, etc. Is the string correctly translated in *that* template? (Looking at the same string in a different module isn't interesting.)
Posts: 11
I do the following test :
{g->text text="My payment checkoutemail sentence"}
{g->text text="My admin checkoutemail english sentence"}
Then I display the admin checkoutemail page : the sentence is translated in French.
But in the payment page, the sentence stay in English.
So the problem is on inclusion of Payment.tpl of various modules when making the payment page. What can I check on the payment process ?
Posts: 4342
OK, I understand the problem now. The checkoutpaypal/templates/Payment.tpl is being translated with the wrong domain (modules_checkout instead of modules_checkoutpaypal) - because, presumably, it's included from within checkout/templates/Confirm.tpl. I don't know how to change the translation domain for a template to something else (or if indeed you can) but you could try this:
Put the string you want translated (manually) into the fr.po file for the *checkout* module, recompile, and replace the modules_checkout.mo.
EDIT: right, I think this is the answer.
Change checkoutpaypal/templates/Payment.tpl to read (line 9)
Try that, and tell me if it works.
Posts: 11
Yes, that is the solution. Everything works if you give the right l10domain for the g->text method.
So for every Payment.tpl that will be included in the checkout payment page, you have to give the l10domain owner's module.
For checkoutemail/templates/Payment.tpl you must use :
{g->text l10Domain="modules_checkoutemail" text="My payment checkoutemail sentence"}
And for checkoutpaypal/templates/Payment.tpl you must use :
{g->text l10Domain="modules_checkoutpaypal" text="My english sentence"}
I am really happy that you have find the solution.
Thank you very much for your great help.