Get store code value from current store programmatically in Magento 2.

You can get the current store’s, store code value in Magento 2.

You need to use Magento\Store\Model\StoreManagerInterface interface for fetching current store locale.

I have given a demo using Block Class,

Call from template, $block->getStoreCode();

If your store URL like,
http://magento2.docker/default (English USA)
Result:default

http://magento2.docker/en_ca (English Canada)
Result: en_ca

http://magento2.docker/fr_ca (French Canada)
Result: fr_ca