cancel
Showing results for 
Search instead for 
Did you mean: 

Translate parts of shop and theme

SOLVED

Translate parts of shop and theme

Hi all,

I'm using the Dutch tranlation for Magento itself but still the theme needs to be translated. I used the CVS way to translate the theme? I was wondering if there is a faster way to tranlate the theme?

Regards Rob

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Translate parts of shop and theme

You have to just create  nl_NL.csv file into your theme i18n folder.

app/design/frontend/{Vendorname}/{themename}/i18n/nl_NL.csv

 Check links,

https://devdocs.magento.com/guides/v2.0/frontend-dev-guide/translations/translate_theory.html

 

You can translate string inside template file using php,

<?php __('translate word');?>

You can translate knockout js file using i18n,

    <span data-bind="i18n: 'Sign In'"></span>

You can translate xml using translate="true",

    <item name="label" xsi:type="string" translate="true">Delete</item>

For js file translation,

Use the $.mage.__('') function when adding a string:

	$.mage.__('<string>');

https://devdocs.magento.com/guides/v2.0/frontend-dev-guide/translations/xlate.html

 

https://devdocs.magento.com/guides/v2.2/frontend-dev-guide/translations/translate_practice.html

If Issue Solved, Click Kudos/Accept As solutions. Get Magento insight from
Magento 2 Blogs/Tutorial

View solution in original post

17 REPLIES 17

Re: Translate parts of shop and theme

You have to just create  nl_NL.csv file into your theme i18n folder.

app/design/frontend/{Vendorname}/{themename}/i18n/nl_NL.csv

 Check links,

https://devdocs.magento.com/guides/v2.0/frontend-dev-guide/translations/translate_theory.html

 

You can translate string inside template file using php,

<?php __('translate word');?>

You can translate knockout js file using i18n,

    <span data-bind="i18n: 'Sign In'"></span>

You can translate xml using translate="true",

    <item name="label" xsi:type="string" translate="true">Delete</item>

For js file translation,

Use the $.mage.__('') function when adding a string:

	$.mage.__('<string>');

https://devdocs.magento.com/guides/v2.0/frontend-dev-guide/translations/xlate.html

 

https://devdocs.magento.com/guides/v2.2/frontend-dev-guide/translations/translate_practice.html

If Issue Solved, Click Kudos/Accept As solutions. Get Magento insight from
Magento 2 Blogs/Tutorial

Re: Translate parts of shop and theme

Hi @Jojobaa

 

If you wanted to make your shop front in Dutch language - then First you need to installed Dutch language translation package(Ignore if you have already installed) ! 

 

How to install dutch language translation package , follow this link - https://www.mageplaza.com/magento-2-dutch-language-pack.html

 

so automatically - few translation will be covered by installing this package !

 

Few translations are still missing which you have added as custom - so for that you need to override this language pack in your custom theme here is the full path - app/design/frontend/VENDORNAME/THEMENAME/i18n/nl_NL.csv

 

So add the rest of the translations over here , run deploy command again and check it will works !

 

 

 

if issue solved,Click Kudos & Accept as Solution

Re: Translate parts of shop and theme

Ok thanks I will look into this. I'll let you guys know if I still have some questions ;-). So far, thanks for the support.

Re: Translate parts of shop and theme

Hi @Jojobaa

 

Sure , Not an issue ! try it and let us know if you still have any issue on the same 

if issue solved,Click Kudos & Accept as Solution

Re: Translate parts of shop and theme

Is there maybe an example file on how to stranslate for a theme? How does this work and look exactly?


For the Dutch Magento 2 translation I have the honl/mc-magento2 module installed. Is this the correct way to set Magento 2 in Dutch?

Re: Translate parts of shop and theme

You just need to create i18n folder in your theme root folder,

Create nl_NL.csv file and create two columns, one column with original text and second column with your translated text.

 

Run deploy command and check your changes.

If Issue Solved, Click Kudos/Accept As solutions. Get Magento insight from
Magento 2 Blogs/Tutorial

Re: Translate parts of shop and theme

If I do this will that overide my honl/mc-magento2 Dtuch tranlation module? Because I only want to translate some parts of the frontend and keep the honl/mc-magento2 module.

Re: Translate parts of shop and theme

By default magento gives Dutch translation with its setup so you dont need to add any third party library for dutch translation. You just need to create nl_NL.csv file and run deploy command.

If Issue Solved, Click Kudos/Accept As solutions. Get Magento insight from
Magento 2 Blogs/Tutorial

Re: Translate parts of shop and theme


My theme pad is /html/app/design/frontend/Alothemes. Inside this pad are more versions of the theme. Where should I create the nl_NL.csv file. And what does it mean to use the deploy command? And if I installed the nl_NL.csv file I can remove the module translation and add the missing theme tranlations to the nl_NL.csv file?