Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 291019

Make the $type parameter of LanguageManager::getLanguage() optional to improve DX

$
0
0

Drupal::languageManager()->getLanguage(Language::TYPE_INTERFACE) is a bit ugly to use.

Let's add helper methods for the hardcoded types (the Language::TYPE_* constants), e.g. getInterfaceLanguage(). Method should be very simple, just call getLanguage($type) internally.

This saves a use of the Language class where we just need it for that and is much easier to understand with method autocompletion.


Viewing all articles
Browse latest Browse all 291019

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>