By editor, 6 November, 2015 Question কিভাবে পেতে বর্তমানে নির্বাচিত ভাষা (বর্তমান পাতা বা ব্যবহারকারী ভাষা) programmatically Drupal8 ? Drupal এর 8 //পেতে lanuage কোড: $language = \Drupal::languageManager()->getCurrentLanguage()->getId(); //পান ভাষা নাম: $language = \Drupal::languageManager()->getCurrentLanguage()->getName(); Drupal এর 7 আন্তর্জাতিক $<একটি global $language; $language=$language->language; Tags Drupal 8 Code Translation User Add new comment Comments7 You must have JavaScript enabled to use this form. Your name Subject Comment About text formats Plain text No HTML tags allowed. Lines and paragraphs break automatically. Web page addresses and email addresses turn into links automatically. To get all enabled language… To get all enabled language in drupal 8 : \Drupal::languageManager()->getLanguages(); This may be helpful to any one. Reply Yes Yes, Thank you :) Reply Replacement of global $language Drupal 7: global $language; // return lang code; return $language->language; Drupal 8: return $language = \Drupal::languageManager()->getCurrentLanguage()->getId(); Reply Thanks its work for me :) Thanks its work for me :) Reply Thank you! I couldn't figure… Thank you! I couldn't figure out how to call this. Reply thanks thank you worked like a charm Reply Current language in current language And how do I get the current language in the current language, not "French" but "Français"? Reply
To get all enabled language… To get all enabled language in drupal 8 : \Drupal::languageManager()->getLanguages(); This may be helpful to any one. Reply
Replacement of global $language Drupal 7: global $language; // return lang code; return $language->language; Drupal 8: return $language = \Drupal::languageManager()->getCurrentLanguage()->getId(); Reply
Current language in current language And how do I get the current language in the current language, not "French" but "Français"? Reply
Comments7
To get all enabled language…
To get all enabled language in drupal 8 :
\Drupal::languageManager()->getLanguages();
This may be helpful to any one.
Yes
Yes, Thank you :)
Replacement of global $language
Drupal 7:
global $language;
// return lang code;
return $language->language;
Drupal 8:
return $language = \Drupal::languageManager()->getCurrentLanguage()->getId();
Thanks its work for me :)
Thanks its work for me :)
Thank you! I couldn't figure…
Thank you! I couldn't figure out how to call this.
thanks
thank you worked like a charm
Current language in current language
And how do I get the current language in the current language, not "French" but "Français"?