Mermed Posted November 7, 2012 Share Posted November 7, 2012 Hello How I can get the "iso-code" of the current language? Thanks Link to comment Share on other sites More sharing options...
Herland Posted November 7, 2012 Share Posted November 7, 2012 Search on wikipedia. Some samples of iso codes are: English=EN Spanish=ES. It isn't hard info to find 1 Link to comment Share on other sites More sharing options...
Mermed Posted November 7, 2012 Author Share Posted November 7, 2012 Sorry I have not explained well With the following code I get the id of the current language global $cookie;$id_lang = $cookie->id_lang; but I need the iso-code that is assigned to that id Is there any function or global variable for it? Thanks Herland Link to comment Share on other sites More sharing options...
Herland Posted November 7, 2012 Share Posted November 7, 2012 (edited) try this global $cookie; $iso_code = $cookie->iso_code; success? Edited November 7, 2012 by Herland (see edit history) Link to comment Share on other sites More sharing options...
Mermed Posted November 8, 2012 Author Share Posted November 8, 2012 Not working Is the only way to make a query to the database? Link to comment Share on other sites More sharing options...
serfer2 Posted December 13, 2012 Share Posted December 13, 2012 Hi, no query to the database is needed. Try this: global $cookie; $iso_code = Language::getgetIsoById( (int)$cookie->id_lang ); I think it will work as you wish Link to comment Share on other sites More sharing options...
tomerg3 Posted December 13, 2012 Share Posted December 13, 2012 serfer2: that function goes to the database to get the value Link to comment Share on other sites More sharing options...
PrestaHeroes USA Posted December 13, 2012 Share Posted December 13, 2012 in 1.5 you would use this: $iso_code = $this->context->language->iso_code; 1 Link to comment Share on other sites More sharing options...
prestasafe Posted February 4, 2014 Share Posted February 4, 2014 Hi, no query to the database is needed. Try this: global $cookie; $iso_code = Language::getgetIsoById( (int)$cookie->id_lang );I think it will work as you wish Did you mean global $cookie; $iso_code = Language::getIsoById( (int)$cookie->id_lang ); with only one get ? 1 Link to comment Share on other sites More sharing options...
wpuser Posted June 23, 2016 Share Posted June 23, 2016 Try {$lang_iso} Source : https://mypresta.eu/en/art/developer/global-smarty-template-variables.html 2 Link to comment Share on other sites More sharing options...
Recommended Posts