1

Hi have an issue like currency format. with multi language.

My currency showing in base store english language : 6,084 CAD $

But when i change franch language its showing like : 6 084 CAD $

I resolved the issues to change Zend/Locale/Data/fr.xml

<symbols numberSystem="latn">
   <decimal>,</decimal>
   <group> </group>

<symbols numberSystem="latn">
    <decimal>.</decimal>
    <group>,</group>

But I feel like change directly in lib/zend folder is not a good way. So i need to create a custom module to achieve this.

So please could you share your idea to create a custom module.

Thanks,

3 Answers 3

5

Class files located in the code pools will take precedence over files in the lib directory. To alter a locale file without directly editing the library, copy the files to the local code pool and edit the copy:

mkdir -p app/code/local/Zend/Locale/
cp -r lib/Zend/Locale/Data/ app/code/local/Zend/Locale/Data
cp lib/Zend/Locale/Data.php app/code/local/Zend/Locale/Data.php
editor app/code/local/Zend/Locale/Data/fr.xml

All locale data should now be read from the copied files.

  • If necessary, the edited copy can be bundled in a module.
  • Alternatively, the edited copy can be placed into the community code pool.

From this moment, updates of the original library locale files will not have any effect. The local edit will still be in place but the installation will no longer benefit from improvements or bug fixes.

2
  • thanks for the update. There is no need any modules to pointer local/zend?
    – Srihari
    Mar 3, 2016 at 16:06
  • You're welcome. Feel free to mark this answer accepted then.
    – mam08ixo
    Mar 4, 2016 at 10:23
0

To expand on @mam08ixo answer.

You have to expand the Data.php file so it first checks the local folder and than falls back to lib folder.

In the local file replace lines 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.");
    }
}
0

Unable to comment, but wanted to note on @René Schep's answer.

Use Mage::getBaseDir('base') instead of realpath(__DIR__.etc..

$filename = Mage::getBaseDir('base') . '/lib/Zend/Locale/Data/' . $locale .'.xml';

@René Schep's answer, with my update:

$filename = dirname(__FILE__) . '/Data/' . $locale . '.xml';
if (!file_exists($filename)) {
    $filename = Mage::getBaseDir('base') . '/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.");
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.