0

i want translate " The requested qty exceeds the maximum qty allowed in shopping cart ". I think it's in the template but when I find it, it's here

app\design\frontend\Mgs\dukaken\Magento_Theme\templates\messages.phtml

<div data-bind="scope: 'messages'">
<div data-bind="foreach: { data: cookieMessages, as: 'message' }" class="messages">
    <div data-bind="attr: {
        class: 'message-' + message.type + ' ' + message.type + ' message',
        'data-ui-id': 'message-' + message.type
    }">
        <div data-bind="html: message.text"></div>
        <div class="cl-mes"></div>
    </div>
</div>
<div data-bind="foreach: { data: messages().messages, as: 'message' }" class="messages">
    <div data-bind="attr: {
        class: 'message-' + message.type + ' ' + message.type + ' message',
        'data-ui-id': 'message-' + message.type
    }">
        <div data-bind="html: message.text"></div>
        <div class="cl-mes"></div>
    </div>
</div>

How to translate it and other things in it, please help me. Thanks all

2

UPDATE

I want translate " Box not available. "

enter image description here

I added to csv like this, it not translate

"Box not available.","Box nicht verfügbar.",module,Magento_Checkout
"not available.","nicht verfügbar.",module,Magento_Checkout
"Box not available.","Box nicht verfügbar.",module,Magento_GiftRegistry
"not available.","nicht verfügbar.",module,Magento_GiftRegistry
"Box not available.","Box nicht verfügbar.",module,Magento_Bundle
"not available.","nicht verfügbar.",module,Magento_Bundle

1 Answer 1

0

Instead of using

<div data-bind="html: message.text"></div>

Use

<div data-bind="i18n: message.text"></div>

Be sure you have added the text translation in your respective csv file.

 "%1 not available.","%1 nicht verfügbar."

Where %1 is your product name referred in your file.

8
  • Hi aravind, can you help me custom error message " [ name product ] not available " in magento 2, i can't translate it, i added it to csv but not work.
    – Brian N
    Jun 22, 2019 at 8:51
  • How did you translate in csv ..Place that text too and update the question.
    – aravind
    Jun 22, 2019 at 8:55
  • Please check update question
    – Brian N
    Jun 22, 2019 at 9:05
  • what is the name of CSV file name? and also the folder path you have placed that csv in your theme..
    – aravind
    Jun 22, 2019 at 9:24
  • de_DE.csv, file csv working but only " Box not available. " not translate, i used csv to translate "The requested qty exceeds the maximum qty allowed in shopping cart"
    – Brian N
    Jun 22, 2019 at 9:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.