where magento stores country full name

rramiii picture rramiii · Jul 24, 2014 · Viewed 9.1k times · Source

I have spent hours searching to find where magento stores full county name. We can get a full list of countries using this code:

$_countries = Mage::getResourceModel('directory/country_collection')
    ->loadData()
    ->toOptionArray(false);

This will return an array with country code and name, I investigated the directory module, and found out this call gets data from the table

directory_county

But this table don't have full county name! So where is it stored? and how is it retrieved using that call?

Thanks in advance.

Answer

letsanov picture letsanov · Jul 24, 2014

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.