Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By Gábor Hojtsy on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.x
Issue links:
Description:
You can now load a language by its language code with a dedicated load function.
Drupal 7:
$languages = language_list();
$language = $languages[$langcode];
Drupal 8:
$language = language_load($langcode);
Comments
Changing the current language
We needed to change the language as part of the checkout processes of a Drupal 7 commerce site
The following code did not work:
however assigning the properties of $new_language to $language did work:
Guy Schneerson
Main Site: www.blue-bag.com
Technology Blog: http://technology.blue-bag.com