1

How can I translate text in i18n Enter keywords to search...shows in this way? I add to file translate: "Enter keywords to search...","Szukaj produktu" but no result.

<input id="search"
                       data-mage-init='{"quickSearch":{
                            "formSelector":"#search_mini_form",
                            "url":"<?php /* @escapeNotVerified */
                       echo $block->getUrl('search/ajax/suggest'); ?>",
                            "destinationSelector":"#search_autocomplete"}
                       }'
                       type="text"
                       name="<?php /* @escapeNotVerified */
                       echo $helper->getQueryParamName() ?>"
                       onfocus="if(this.value=='Enter keywords to search...') this.value='';"
                       onblur="if(this.value=='') this.value='Enter keywords to search...';"
                       value="Enter keywords to search..."
                       class="input-text"
                       maxlength="<?php /* @escapeNotVerified */
                       echo $helper->getMaxQueryLength(); ?>"
                       role="combobox"
                       aria-haspopup="false"
                       aria-autocomplete="both"
                       autocomplete="off"/>

1 Answer 1

1

You are missing the PHP translate function :

...
onfocus="if(this.value=='<?= __("Enter keywords to search...") ?>') this.value='';"
onblur="if(this.value=='') this.value='<?= __("Enter keywords to search...") ?>';"
value="<?= __("Enter keywords to search...") ?>"
...

Then, you can clear your Magento Cache, or do a php bin/magento setup:upgrade in ssh console.

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.