Question
programlı Drupal8 (geçerli sayfa veya kullanıcı dili) seçili olan dili Nasıl ?
Siteye 8
//Ankara kodu
$language = \Drupal::languageManager()->getCurrentLanguage()->getId();
//dil adı:
$language = \Drupal::languageManager()->getCurrentLanguage()->getName();
Drupal 7
global $language;
$language=$language->language;
Comments
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
Add new comment