Question

I followed this tutorial: https://www.damianculotta.com.ar/magento/bug-en-los-locales-es-en-magento-1-y-2/ which suggested to override this file: src/lib/Zend/Locale/Data/es_419.xml. I created the new file in this location: features/Multivac_Theme/app/code/local/Zend/Locale/Data/es_419.xml, but it doesn't work. How can I properly override the file? Thanks!

Was it helpful?

Solution

To alter a locale file without directly editing the library, copy the files to the local code pool and edit the copy: Make a directory :

app/code/local/Zend/Locale/

Copy Data.php file from :

lib/Zend/Locale/Data.php

To :

app/code/local/Zend/Locale/Data.php

And Now here you can copy the file which you have to override. Like :

features/Multivac_Theme/app/code/local/Zend/Locale/Data/es_419.xml

Finally you have to change path In Data.php. Replace code from line 155-159

  $filename = dirname(__FILE__) . '/Data/' . $locale . '.xml';
if (!file_exists($filename)) {
    #require_once 'Zend/Locale/Exception.php';
        throw new Zend_Locale_Exception("Missing locale file '$filename' for '$locale' locale.");
}

With :

    $filename = dirname(__FILE__) . '/Data/' . $locale . '.xml';
if (!file_exists($filename)) {
    $filename = realpath(__DIR__ . '/../../../../../lib/Zend/Locale/Data') . '/' . $locale .'.xml';
    if (!file_exists($filename)) {
        #require_once 'Zend/Locale/Exception.php';
            throw new Zend_Locale_Exception("Missing locale file '$filename' for '$locale' locale.");
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top