[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

 
patdef

Joined: 2009-03-24
Posts: 11
Posted: Tue, 2009-03-24 15:09

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.

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Tue, 2009-03-24 22:34

My experience of these kinds of things is that unexplained translation problems tend to be rooted in various gettext caches that the server uses.

 
patdef

Joined: 2009-03-24
Posts: 11
Posted: Thu, 2009-04-02 08:29

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 ?

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Thu, 2009-04-02 08:50
Quote:
I have to learn more on the "various gettext caches".

Unfortunately, so do I...

Quote:
Could you give me some idea on how to flush them ?

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

 
patdef

Joined: 2009-03-24
Posts: 11
Posted: Thu, 2009-04-02 09:37

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.

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Thu, 2009-04-02 09:48

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.

 
patdef

Joined: 2009-03-24
Posts: 11
Posted: Thu, 2009-04-02 11:52

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 :

  • I do a make PO=fr
  • I found all the messages in the fr.po file, that I can translate with poedit.
  • Then I do a
    make install PO=fr
    and a
    cp ../locale/fr/LC_MESSAGES/modules_checkoutpaypal.mo ../../../../../g2data/locale/fr/LC_MESSAGES/
  • I flush the template cache from g2
  • I even try to restart my Apache server

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.

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Thu, 2009-04-02 12:03

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?

 
patdef

Joined: 2009-03-24
Posts: 11
Posted: Thu, 2009-04-02 13:44

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 ?

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Thu, 2009-04-02 13:51
Quote:
But is it a possibility that Payment.tpl is not include has it should in classes/CheckoutPaypalPaymentPlugin.class

Gettext support is built into the Gallery core, it's not an option for modules not to support it.

 
patdef

Joined: 2009-03-24
Posts: 11
Posted: Thu, 2009-04-02 14:05

So, I really do not understand why this sentence isn't translatable...

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Thu, 2009-04-02 14:17

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.

 
patdef

Joined: 2009-03-24
Posts: 11
Posted: Thu, 2009-04-02 14:41

So do I. I take the following test :

  • I add the same following sentence in Payment.tpl and Admin.tpl : <br />{g->text text="My english sentence"}
  • I then update the fr.po and translate it :
    msgid "My english sentence"
    msgstr "Ma phrase en anglais"
  • I do a make install and copy the file modules_checkoutpaypal.mo to g2data/locale/fr/LC_MESSAGES/
  • I do a flush of the template cache.
  • Then I ask for the admin checkoutpaypal page and the sentence is correctly display in french.
    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...

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Thu, 2009-04-02 15:49

What happens if you put some text to translate in the Payment.tpl from another module, eg. checkoutemail?

 
patdef

Joined: 2009-03-24
Posts: 11
Posted: Fri, 2009-04-03 06:51

Hello alecmyers,

I tried the followings things :

  • I put {g->text text="My english sentence"} in the checkoutemail Admin.tpl

    The result is the string is display in English in the checkoutemail admin page, while it is display in French in the checkoutpaypal admin page.

  • I put {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

  • I put {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.

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Fri, 2009-04-03 07:45
Quote:
So, I can say that a string translated in one module is never displayed translated in another module.
Is it what is expected ?

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.)

 
patdef

Joined: 2009-03-24
Posts: 11
Posted: Fri, 2009-04-03 08:30

I do the following test :

  • add a new sentence {g->text text="My payment checkoutemail sentence"}
  • add a new sentence {g->text text="My admin checkoutemail english sentence"}
  • rebuild the fr.po, translate the two sentences, build a new modules_checkoutemail.po, and copy this one in the g2data/locale/fr/LC_MESSAGES/
  • flush the template cache

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 ?

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Fri, 2009-04-03 10:07

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)

     {g->text l10Domain="modules_checkoutpaypal" text="Clicking the PayPal button will ...

Try that, and tell me if it works.

 
patdef

Joined: 2009-03-24
Posts: 11
Posted: Fri, 2009-04-03 12:12

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.