4

We've opened our Magento store a few weeks ago. We are located in the Netherlands and only sell items on the Dutch market, so the entire site is in Dutch. Thanks to some excellent translation packs, that was simple.

But: I've been unable to translate the error customers get when they forget to specify the shipping method when using OneStepCheckout. The error logically shows: "Please specify shipping method." But this line isn't translated in Dutch. Inline translation doesn't work because it's apparently somewhere in Javascript. When searching Google, I only found one relevant article from 2008 which links to a bug in Magento which was solved long ago, unfortunately the link it refers to is dead.

Because there isn't a lot to find about this specific issue, it may be something specific in my setup or extensions.

I use:

  • The latest version Magento Community Edition (1.7.2.)
  • Extension: IWD OneStepCheckout
  • Template: Ultimo theme from Themeforest
  • Nothing else that might cause the problem I think

Thanks for the help,

migrated from stackoverflow.com May 29 '13 at 21:15

This question came from our site for professional and enthusiast programmers.

8

I encountered this before. I think it's a magento bug. The text comes from app/code/core/Mage/Checkout/etc/jstranslator.xml:

<validate-shipping-methods-required translate="message" module="checkout">
    <message>Please specify shipping method.</message>
</validate-shipping-methods-required> 

The problem is that in the same file there is an other element with the tag validate-shipping-methods-required(as the item above) and this interferes with the translation of this text. The element is this one (2 elements lower that the first one):

<validate-shipping-methods-required translate="message" module="checkout">
    <message>Please specify payment method.</message>
</validate-shipping-methods-required> 

That should be:

<validate-payment-methods-required translate="message" module="checkout">
    <message>Please specify payment method.</message>
</validate-payment-methods-required> 

I know it's against every Magento best practice, but I modified the core file directly, (in hope that this will be fixed in the next version) and everything works now.

6

To avoid editing core files you should not edit the app/code/core/Mage/Checkout/etc/jstranslator.xml itself. Better integrate the following two elements into a module's etc-Folder (e.g. /app/code/local/YOUR-NAMESPACE/YOUR-MODULE/etc/jstranslator.xml) to prevent overwriting your changes by update if that bug is not fixed in next versions anyway:

<?xml version="1.0"?>
<jstranslator>
    <validate-shipping-methods-required translate="message" module="checkout">
        <message>Please specify shipping method.</message>
    </validate-shipping-methods-required>
    <validate-payment-methods-required translate="message" module="checkout">
        <message>Please specify payment method.</message>
    </validate-payment-methods-required>
</jstranslator>

By the way: Copying app/code/core/Mage/Checkout/etc/jstranslator.xml to app/code/local/Mage/Checkout/etc/jstranslator.xml to remove the bug does not work.

  • This answer should be favored instead of @Marius answer. Never overwrite core files of Magento. – Giel Berkers Mar 31 '15 at 13:06
0

try placing a file called translate.csv in:

app/design/frontend/YOUR_THEME/YOUR_TEMPLATE/locale/nl_NL/translate.csv

and in that file following line:

"Please specify shipping method.","Your translation"

Of course, make sure that the string is not missing a dot, comma etc. If it fails, try contacting onestepcheckout.

0

That is the best way to do it, by using the .csv but I found sometimes it doesnt work or Im not finding the right one.

You can use the inline translator to translate right from the frontend and it works everytime (for me).

Here is a short tutorial with pictures that I created for this exactly:

http://www.savethemage.com/blog/easily-translate-your-magento-store/

But basically do this: Go to System>Developer, put in your IP ins the Allowed IPs. Then under Translate Inline you will see Enable for Frontend. Select yes and save config.

0

Exactly the same problem here. Same version of Magento also. My fix is to just delete the second -element. As far as I can see this element is completely redundant and thus no need for renaming.

FYI: These .xml files tell the Magento code wich lines to translate should be added to the Javascript Translate object.

EDIT Removal of the second element is no option, because the second element is used for the Payment option. OP's solution is the right one at this moment.

0

If you use OnePageCheckout from IDW, you have to edit /skin/frontend/base/default/js/iwd/opc/checkout.js and found at line 953 $j('.opc-message-container').html('Please specify shipping method'); you have to change to $j('.opc-message-container').html(Translator.translate('Please specify shipping method.').stripTags()); Be sure to modify the file "jstranslator.xml" (see how in top on this post).

Hope it will help

-2

In Magento 1.8.1.0 the problem still exist but I found the solution. You have to go to: skin/frontend/base/default/js and edit opcheckout.js file. In line 620 there is a phrase: Please specify shipping method. Translate it and that's all.

  • This is bad practice and does not work with multi language environments. – Simon Jun 2 '15 at 6:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy