How to translate widgets on Magento 2 Print

Modified on: Tue, Nov 16, 2021 at 11:38 AM


You can translate or change the text of:

Instant Search Widget

You can translate or change the text of the following Instant Search Widget's elements:

  • Section labels: Categories, Products, Pages
  • Product labels: SKU, In stock, Pre-Order, Out of stock, etc.
  • Messages
  • Search input placeholders for desktop and mobile

You can also translate or change the text of the Sticky Widget's search input placeholder.

Steps:

  1. Go to the Searchanise control panel > Translations section > Instant Search Widget tab.
  2. Type the phrases you'd like to display instead of the original ones into the corresponding fields. If you leave a field empty, the text won't be shown in the widget.
  3. Apply the changes.

Search Results Widget

Widget's content

You can translate or change the text of the following Search Results Widget's elements:

  • Product labels:  SKU, In stock, Pre-Order, Out of stock, etc.
  • Button and link labels
  • Section labels (tabs): Categories, Products, Pages
  • Sorting values
  • Quick view elements: "Quick View" button + "Quick view" popup's elements
  • Pagination on Mobile
  • SEO data of the page
  • Messages

Steps:

  1. Go to the Searchanise control panel > Translations section > Search Results Widget tab.
  2. Type the phrases you'd like to display instead of the original ones into the corresponding fields. If you leave a field empty, the text won't be shown in the widget.
  3. Apply the changes.

Widget's title

To change the widget's title, follow these steps:

  1. Go to <intall_module_dir>/Controllers/Result/Index.php file.
    Note
    There can be two variants for the <intall_module_dir> part depending on the installation process. It can be "app/code/Searchanise/SeachAutocomplete" or "vendor/searchanise/search-autocomplete".
  2. Edit the "Search results" part of the following line: 
    $page->getConfig()->getTitle()->set(__("Search results"));
    Tip
    If you want to replace the "Search results" text with the "Résultats de recherche" one, the code line should look like this: 
    $page->getConfig()->getTitle()->set(__("Résultats de recherche"));		

  3. Save the changes.
  4. Clear the cache in the Magento 2 admin panel > System > Cache Management by clicking the Flush Magento Cache button in the top-right corner.

Filters

You can edit filters' titles as well as their values' names.

To edit filters' titles, follow these steps:

  1. Go to the Searchanise control panel > Filters section > General tab.
  2. Click the Edit filters button in the top-right corner.
  3. Edit the filters' titles in the Title column. 
  4. Save the changes.

That's it. You can now go to the storefront if you'd like to make sure filters' titles are up-to-date.

To edit the names of filters' values, follow these steps:

Note
Filter values (options) correspond to the product attributes that can be found in Magento 2 admin panel > Stores > Attributes.
  1. Go to the Searchanise control panel > Filters section > General tab.
  2. Click the Manage filter link in the filter row whose values you'd like to rename.
  3. Click the Edit values button in the top-right corner.
  4. Edit the values' names in the Display name column. 
  5. Save the changes.

That's it. You can now go to the storefront if you'd like to make sure the values' names are up-to-date.

Default Search Results Page

If you choose to use the default Magento Search Results page for displaying search results, its elements are translated through the default Magento language variables. See the Magento instructions.



Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.