4

I need to change the name of country in magento store e.g. United Kingdom needs to be changed to Great Britain. How can I achieve this?

I tried looking at the following tables directory_country_region, directory_country_region_name, directory_country but country full names are not stored here.

I also tried using locale files to see if it updates, but no luck there as well.

Is there any way I can achieve this?

  • I have added the answer ! – Manish Goswami Apr 25 '18 at 17:16
  • @prateek did you solve this issue, if yes please update the answer – Rajeev Singh Jan 21 '19 at 15:33
0

The easiest way for changing the label is by translation.

You need to just make i18N folder in your app/code/namespace/modulename/i18n and just create one CSV file en_US.csv and give translation script over there.

See Example : en_US.csv

"United Kingdom","Great Britain"

No need to do anything for the small change.

| improve this answer | |
  • That did not work, I guess because country is fetched from product attributes and translation is not applied there. But I also need the product searched by country name so just changing the locale won't cut it. I need to change the country name from source. – Prateek Apr 27 '18 at 3:05
0

I don't know where exactly you'd want to change the country name, but the country names in Magento come from the Zend framework.

In Zend they are stored in locale file, for example in

/vendor/magento/zendframework1/library/Zend/Locale/Data/en_GB.xml

<territories>
    <territory type="GB">United Kingdom</territory>
    <territory type="GB" alt="short">UK</territory>
    <territory type="GS">South Georgia and the South Sandwich Islands</territory>
    <territory type="HM">Heard Island and McDonald Islands</territory>
    <territory type="UM">U.S. Minor Outlying Islands</territory>
    <territory type="US">United States</territory>
    <territory type="US" alt="short">US</territory>
    <territory type="VC">Saint Vincent and the Grenadines</territory>
</territories>
| improve this answer | |
  • Although it is not recommended to change files in the vendor folder, I still tried it, in en.xml and en_GB.xml, cleared my cache, but that did not work either. I'm still getting United Kingdom. – Prateek Apr 25 '18 at 9:14
  • 1
    @Prateek which locale are you using? Maybe you have to edit the en_US.xml. Don't forget to clear all the cache, i.e. delete var/cache or clear Redis as it's not stored in one of the usual caches. – Andreas von Studnitz Apr 25 '18 at 13:13
  • @AndreasvonStudnitz I have en_GB as my locale, I did clear var/cache too but no use – Prateek Apr 27 '18 at 3:01
0

I had the same issue (Magento 2.3.5-p1) and I fixed it by updating the translation file of my theme.

Go to app/design/frontend/YOURTHEME/YOURTHEME/i18n

if your locale language is English (US), you will have a en_US.csv file in it. Then add a line with: United Kingdom, Great Britain

For other languages, do the same in the other csv files or create them if they don't alrady exist.

| improve this answer | |
0

I have the same issue and solved by following steps:

  1. edit TranslatedListsTest.php in lib/internal/Magento/Framework/Locale/Test/Unit/
  2. edit TranslatedLists.php in lib/internal/Magento/Framework/Locale/
  3. make i18N folder in your app/design/frontend/[theme]/ and create en_US.CSV file if your language is en_US

"United Kingdom","Great Britain"

  1. clean all the cache by commend:

    php bin/magento s:up

    php bin/magento s:s:d

    php bin/magento c:f

  2. Complete to translate

Hope it's work for you.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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