I am creating my own module and as I am creating some text, that will be shown in the website. The store manager, which installs my module, needs to have the possibility to translate my text into other languages, which run on his Website. How can I achieve this?

To give you an example I make a Popup with the text: "Hello World", but the Store Managers has an shop which runs on German, Dutch, French, Italian and so on and now my "Hello World" should be changed into those languages, if the store view is currently in this language.

Thanks in advance.

1 Answer 1


For this you need to follow the multiLingual feature for magento 2.
Step 1: Inside Magento 2 admin go to Stores –> Configuration –> All store and create new store view for the language(eg:French).

Step 2: Next go to Stores –> Configuration, and now please pay attention on store “scopes”, store view needs to match to language which you want to edit.

Step 3: Now change to desired Country in General -> General -> Desired Country(eg: French, Belgium).

Step 4: Next important thing is Locale, General-> General -> Locale Option you need to select which language store will speak, based on that we will install language pack.

Step 5: Now Install a Language Pack.
Step 6: After you have downloaded language pack, copy it inside Magento app directory, create a new folder i18n, Create Folder named upon vendor, and lastly create folder using store language codes. For eg: magento_install_dir/app/i18n/vendor_name/fr_FR/..

Step 7: In this language package, you have to add the text(eg: Hello World) in the csv file which that language package already contains. Also make sure that you in that you print your text in the following format.

<?php echo __('Hello World'); ?> 
  • Sorry I think you didn't understand my question right, i have a .phtml file in my module with some popups and texts, which will be shown in the website. All my texts are in English, now if the language of the website changes this texts need to be in the language of the website. Aug 28, 2019 at 13:38

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.