Home is for the experience. Projects are for the ones who are interested!

How To Get Default Language In Prestashop

How To Get Default Language In Prestashop

In the following I will add the function through which you can get the default language in prestashop. Id of the default language is saved in the database in configuration table, so as you maybe already know, to get the default language in prestashop you have to use the following line of code:

$lang = Configuration::get('PS_LANG_DEFAULT')

With the above function get the id of the default language in prestashop, and the following code will get all languages which are already activated in our shop

$languages = Language::getLanguages();

One of the uses for these functions are when you make a new form for a module using the helper form in prestashop, because if you have multi-language website you need to add that dropdown to switch the language in order to translate the texts as you wish. 

Leave a Reply

Your email address will not be published. Required fields are marked *