where magento stores country full name

巧了我就是萌 提交于 2019-12-05 12:33:03

Ok so to compensate for my wrong answer. Here is how this works:

  1. /lib/Zend/Locale/Data/en.xml - if your store is in english, else another xml in the same directoery is read. Every country is there and its code under the xml tag <territory>

  2. The xml is cached using the Zend_Cache_Core class.

  3. /lib/Zend/Locale.php - function getTranslation invokes the lib/Zend/Cache/Core.php class to load from the cache.

Example: If you change the name of some country in en.xml and clear the magento cache. You will see the change when u invoke your code again.

Full country names are not stored in database. Magento uses inbuilt Zend functionality.

Check file: lib/Zend/Locale/Data/Translation.php for full list.

tommy

Use the Zend_Local translation.

<?php
$code = 'EN';
echo Mage::app()->getLocale()->getTranslation($code, 'Territory', null, 2);
?>

Use the column 'iso2_code' from the table 'directory_country' for your $code.

Magneto only stores country codes in DB, and relies for names on Zend's Locale module to provide translated names, for different locale.

By the toOptionArray method it invokes the Zend_Locale class to get the translated value.

Refer $name = Mage::app()->getLocale()->getCountryTranslation($data['value']);, which gets to Mage_Core_Model_Locale and then to Zend_Locale.

It decides which of the node from the data to read, by the switch case statement in Zend_Locale_Data::getContent() line# 962, 963

Magento caches the names, so if you make any change to XML files, make sure to clean your cache folder to get what you seek.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!