Get Current store locale/language programmatically in Magento 2.

Magento 2 with multi-store functionality, Different store view contains different locale.

You can set Different locale from admin panel using Stores -> Configuration -> General Tab.
Click on Locale Options,

store locale
Magento store locale

Set Your locale from the Locale Dropdown box. You must set to this locale at the Store view level.

You can get current store locale programmatically using Resolver class.

Magento\Framework\Locale\Resolver class is used to get the Current store locale code.

I have given a demo using simple Class,

namespace Rbj\CurrentLocale\Block;

use Magento\Framework\Locale\Resolver;

class Locale
     * @var Resolver
    private $localeResolver;

    public function __construct(
        Resolver $localeResolver
    ) {
        $this->localeResolver = $localeResolver;

    public function getCurrentLocale()
        $currentLocaleCode = $this->localeResolver->getLocale(); // fr_CA
        $languageCode = strstr($currentLocaleCode, '_', true);
        return $languageCode;

Call from template, $this->getCurrentLocale();
The Result will be,
fr for French Store view.
en for English store view.