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. 

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x