In Magento 2 sometimes, an error displays: No region found within the locale “de” (or other locale code). In this topic we will give you a solution for this issue.
How to get bug “No Region Found within the Locale…”
You have to setup language for your browser. Example with google chrome: Setting → Language → Choose your language → Done
Then please refresh your browser you can get the bug if your extension use \Magento\Framework\CurrencyInterface
How to fix it?
We should use try catch function when define CurrencyInterface
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
public function __construct( \Magento\Framework\ObjectManagerInterface $objectManager ) { $this->_objectManager = $objectManager; try { $this->_currencyInterface = $this->_objectManager->get('\Magento\Framework\CurrencyInterface'); } catch (\Zend_Currency_Exception $e) { $this->_currencyInterface = $localeCurrency->getCurrency($directoryHelper->getBaseCurrencyCode()); } } |
Refresh your browser and this issue has gone.
That is the shortest process for you to Fix Issue “No Region Found within the Locale…” in Magento 2 . With this guide, you can manage the Issue “No Region Found within the Locale…” in Magento 2 easily.
Thank you for reading this post and see you in other posts