Zen - cart, google wallet integration with states list - zen-cart

I have a problem with the integration of google checkout in zencart using the google checkout contribution.
http://www.zen-cart.com/downloads.php?do=file&id=206
The main problem here is that google keeps returning the error.
"Error parsing XML; message from parser is: Invalid value for body of allowed-areas in checkout-shopping-cart/checkout-flow-support/merchant-checkout-flow-support/shipping-methods/flat-rate-shipping/shipping-restrictions: Must be a U.S. 2-letter postal code or state name"
Below is an extract of one of the payment methods with the problem, I don't know and can't figure out what's wrong. Any help will be really appreciated.
Forgive my bad English.
<flat-rate-shipping name="Table: Vary by Weight/Price">
<price currency="USD">0</price>
<shipping-restrictions>
<allow-us-po-box>false</allow-us-po-box>
<allowed-areas>
<us-state-area>
<state>AL</state>
</us-state-area>
<us-state-area>
<state>AS</state>
</us-state-area>
<us-state-area>
<state>AZ</state>
</us-state-area>
<us-state-area>
<state>AR</state>
</us-state-area>
<us-state-area>
<state>AA</state>
</us-state-area>
<us-state-area>
<state>AE</state>
</us-state-area>
<us-state-area>
<state>AM</state>
</us-state-area>
<us-state-area>
<state>AP</state>
</us-state-area>
<us-state-area>
<state>CA</state>
</us-state-area>
<us-state-area>
<state>CO</state>
</us-state-area>
<us-state-area>
<state>CT</state>
</us-state-area>
<us-state-area>
<state>DE</state>
</us-state-area>
<us-state-area>
<state>DC</state>
</us-state-area>
<us-state-area>
<state>FL</state>
</us-state-area>
<us-state-area>
<state>GA</state>
</us-state-area>
<us-state-area>
<state>ID</state>
</us-state-area>
<us-state-area>
<state>IL</state>
</us-state-area>
<us-state-area>
<state>IN</state>
</us-state-area>
<us-state-area>
<state>IA</state>
</us-state-area>
<us-state-area>
<state>KS</state>
</us-state-area>
<us-state-area>
<state>KY</state>
</us-state-area>
<us-state-area>
<state>LA</state>
</us-state-area>
<us-state-area>
<state>ME</state>
</us-state-area>
<us-state-area>
<state>MH</state>
</us-state-area>
<us-state-area>
<state>MD</state>
</us-state-area>
<us-state-area>
<state>MA</state>
</us-state-area>
<us-state-area>
<state>MI</state>
</us-state-area>
<us-state-area>
<state>MN</state>
</us-state-area>
<us-state-area>
<state>MS</state>
</us-state-area>
<us-state-area>
<state>MO</state>
</us-state-area>
<us-state-area>
<state>MT</state>
</us-state-area>
<us-state-area>
<state>NE</state>
</us-state-area>
<us-state-area>
<state>NV</state>
</us-state-area>
<us-state-area>
<state>NH</state>
</us-state-area>
<us-state-area>
<state>NJ</state>
</us-state-area>
<us-state-area>
<state>NM</state>
</us-state-area>
<us-state-area>
<state>NY</state>
</us-state-area>
<us-state-area>
<state>NC</state>
</us-state-area>
<us-state-area>
<state>ND</state>
</us-state-area>
<us-state-area>
<state>MP</state>
</us-state-area>
<us-state-area>
<state>OH</state>
</us-state-area>
<us-state-area>
<state>OK</state>
</us-state-area>
<us-state-area>
<state>OR</state>
</us-state-area>
<us-state-area>
<state>PA</state>
</us-state-area>
<us-state-area>
<state>RI</state>
</us-state-area>
<us-state-area>
<state>SC</state>
</us-state-area>
<us-state-area>
<state>SD</state>
</us-state-area>
<us-state-area>
<state>TN</state>
</us-state-area>
<us-state-area>
<state>TX</state>
</us-state-area>
<us-state-area>
<state>UT</state>
</us-state-area>
<us-state-area>
<state>VT</state>
</us-state-area>
<us-state-area>
<state>VI</state>
</us-state-area>
<us-state-area>
<state>VA</state>
</us-state-area>
<us-state-area>
<state>WA</state>
</us-state-area>
<us-state-area>
<state>WV</state>
</us-state-area>
<us-state-area>
<state>WI</state>
</us-state-area>
<us-state-area>
<state>WY</state>
</us-state-area>
</allowed-areas>
</shipping-restrictions>
</flat-rate-shipping>

Disclaimer - I'm not a Zen dev/user.
I suspect it has to do with the Armed forces State Codes. See if removing them fixes the error.
However, it's probably better to use either
us-country-area, or,
instead of listing States where you do ship, define States where you don't with excluded-areas
Hth...

Related

How to get a list of constants from Locale class of Flutter?

I have an application who use locale to choose the language and a json with translations and I am making a configurator. For it, I need to have a list of locale in the format language_COUNTRYNAME like en_US.
I have found this list of constants in Locale flutter class and I want to get the complete list in JSON without copy it manually, how can I do this ?
I have do finally with the manual way.
Here the list:
{
"af_NA": "Afrikaans Namibia",
"af_ZA": "Afrikaans South Africa",
"agq_CM": "Aghem Cameroon",
"ak_GH": "Akan Ghana",
"am_ET": "Amharic Ethiopia",
"ar_001": "Arabic World",
"ar_AE": "Arabic United Arab Emirates",
"ar_BH": "Arabic Bahrain",
"ar_DJ": "Arabic Djibouti",
"ar_DZ": "Arabic Algeria",
"ar_EG": "Arabic Egypt",
"ar_EH": "Arabic Western Sahara",
"ar_ER": "Arabic Eritrea",
"ar_IL": "Arabic Israel",
"ar_IQ": "Arabic Iraq",
"ar_JO": "Arabic Jordan",
"ar_KM": "Arabic Comoros",
"ar_KW": "Arabic Kuwait",
"ar_LB": "Arabic Lebanon",
"ar_LY": "Arabic Libya",
"ar_MA": "Arabic Morocco",
"ar_MR": "Arabic Mauritania",
"ar_OM": "Arabic Oman",
"ar_PS": "Arabic Palestine",
"ar_QA": "Arabic Qatar",
"ar_SA": "Arabic Saudi Arabia",
"ar_SD": "Arabic Sudan",
"ar_SO": "Arabic Somalia",
"ar_SS": "Arabic South Sudan",
"ar_SY": "Arabic Syria",
"ar_TD": "Arabic Chad",
"ar_TN": "Arabic Tunisia",
"ar_YE": "Arabic Yemen",
"as_IN": "Assamese India",
"asa_TZ": "Asu Tanzania",
"az_AZ": "Azerbaijan",
"bas_CM": "Basaa Cameroon",
"be_BY": "Belarusian Belarus",
"bem_ZM": "Bemba Zambia",
"bez_TZ": "Bena Tanzania",
"bg_BG": "Bulgarian Bulgaria",
"bm_ML": "Bambara Mali",
"bn_BD": "Bengali Bangladesh",
"bn_IN": "Bengali India",
"bo_CN": "Tibetan China",
"bo_IN": "Tibetan India",
"br_FR": "Breton France",
"brx_IN": "Bodo India",
"bs_BA": "Bosnian Bosnia Herzegovina (Cyrillic/Latin)",
"ca_AD": "Catalan Andorra",
"ca_ES": "Catalan Spain",
"ca_FR": "Catalan France",
"ca_IT": "Catalan Italy",
"cgg_UG": "Chiga Uganda",
"chr_US": "Cherokee United States",
"cs_CZ": "Czech Czech Republic",
"cy_GB": "Welsh United Kingdom",
"da_DK": "Danish Denmark",
"da_GL": "Danish Greenland",
"dav_KE": "Taita Kenya",
"de_AT": "German Austria",
"de_BE": "German Belgium",
"de_CH": "German Switzerland",
"de_DE": "German Germany",
"de_LI": "German Liechtenstein",
"de_LU": "German Luxembourg",
"dje_NE": "Zarma Niger",
"dua_CM": "Duala Cameroon",
"dyo_SN": "Jola Fonyi Senegal",
"dz_BT": "Dzongkha Bhutan",
"ebu_KE": "Embu Kenya",
"ee_GH": "Ewe Ghana",
"ee_TG": "Ewe Togo",
"el_CY": "Greek Cyprus",
"el_GR": "Greek Greece",
"en_001": "English World",
"en_150": "English Europe",
"en_AG": "English Antigua Barbuda",
"en_AI": "English Anguilla",
"en_AS": "English American Samoa",
"en_AU": "English Australia",
"en_BB": "English Barbados",
"en_BE": "English Belgium",
"en_BM": "English Bermuda",
"en_BS": "English Bahamas",
"en_BW": "English Botswana",
"en_BZ": "English Belize",
"en_CA": "English Canada",
"en_CC": "English Cocos Keeling Islands",
"en_CK": "English Cook Islands",
"en_CM": "English Cameroon",
"en_CX": "English Christmas Island",
"en_DG": "English Diego Garcia",
"en_DM": "English Dominica",
"en_ER": "English Eritrea",
"en_FJ": "English Fiji",
"en_FK": "English Falkland Islands Islas Malvinas",
"en_FM": "English Micronesia",
"en_GB": "English United Kingdom",
"en_GD": "English Grenada",
"en_GG": "English Guernsey",
"en_GH": "English Ghana",
"en_GI": "English Gibraltar",
"en_GM": "English Gambia",
"en_GU": "English Guam",
"en_GY": "English Guyana",
"en_HK": "English Hong Kong",
"en_IE": "English Ireland",
"en_IM": "English Isle Of Man",
"en_IN": "English India",
"en_IO": "English British Indian Ocean Territory",
"en_JE": "English Jersey",
"en_JM": "English Jamaica",
"en_KE": "English Kenya",
"en_KI": "English Kiribati",
"en_KN": "English Saint Kitts Nevis",
"en_KY": "English Cayman Islands",
"en_LC": "English Saint Lucia",
"en_LR": "English Liberia",
"en_LS": "English Lesotho",
"en_MG": "English Madagascar",
"en_MH": "English Marshall Islands",
"en_MO": "English Macau",
"en_MP": "English Northern Mariana Islands",
"en_MS": "English Montserrat",
"en_MT": "English Malta",
"en_MU": "English Mauritius",
"en_MW": "English Malawi",
"en_NA": "English Namibia",
"en_NF": "English Norfolk Island",
"en_NG": "English Nigeria",
"en_NR": "English Nauru",
"en_NU": "English Niue",
"en_NZ": "English New Zealand",
"en_PG": "English Papua New Guinea",
"en_PH": "English Philippines",
"en_PK": "English Pakistan",
"en_PN": "English Pitcairn Islands",
"en_PR": "English Puerto Rico",
"en_PW": "English Palau",
"en_RW": "English Rwanda",
"en_SB": "English Solomon Islands",
"en_SC": "English Seychelles",
"en_SD": "English Sudan",
"en_SG": "English Singapore",
"en_SH": "English Saint Helena",
"en_SL": "English Sierra Leone",
"en_SS": "English South Sudan",
"en_SX": "English Sint Maarten",
"en_SZ": "English Swaziland",
"en_TC": "English Turks Caicos Islands",
"en_TK": "English Tokelau",
"en_TO": "English Tonga",
"en_TT": "English Trinidad Tobago",
"en_TV": "English Tuvalu",
"en_TZ": "English Tanzania",
"en_UG": "English Uganda",
"en_UM": "English Us Outlying Islands",
"en_US": "English United States",
"en_VC": "English St Vincent Grenadines",
"en_VG": "English British Virgin Islands",
"en_VI": "English Us Virgin Islands",
"en_VU": "English Vanuatu",
"en_WS": "English Samoa",
"en_ZA": "English South Africa",
"en_ZM": "English Zambia",
"en_ZW": "English Zimbabwe",
"es_419": "Spanish Latin America",
"es_AR": "Spanish Argentina",
"es_BO": "Spanish Bolivia",
"es_CL": "Spanish Chile",
"es_CO": "Spanish Colombia",
"es_CR": "Spanish Costa Rica",
"es_CU": "Spanish Cuba",
"es_DO": "Spanish Dominican Republic",
"es_EA": "Spanish Ceuta Melilla",
"es_EC": "Spanish Ecuador",
"es_ES": "Spanish Spain",
"es_GQ": "Spanish Equatorial Guinea",
"es_GT": "Spanish Guatemala",
"es_HN": "Spanish Honduras",
"es_IC": "Spanish Canary Islands",
"es_MX": "Spanish Mexico",
"es_NI": "Spanish Nicaragua",
"es_PA": "Spanish Panama",
"es_PE": "Spanish Peru",
"es_PH": "Spanish Philippines",
"es_PR": "Spanish Puerto Rico",
"es_PY": "Spanish Paraguay",
"es_SV": "Spanish El Salvador",
"es_US": "Spanish United States",
"es_UY": "Spanish Uruguay",
"es_VE": "Spanish Venezuela",
"et_EE": "Estonian Estonia",
"eu_ES": "Basque Spain",
"ewo_CM": "Ewondo Cameroon",
"fa_AF": "Persian Afghanistan",
"fa_IR": "Persian Iran",
"ff_SN": "Fulah Senegal",
"fi_FI": "Finnish Finland",
"fil_PH": "Filipino Philippines",
"fo_FO": "Faroese Faroe Islands",
"fr_BE": "French Belgium",
"fr_BF": "French Burkina Faso",
"fr_BI": "French Burundi",
"fr_BJ": "French Benin",
"fr_BL": "French Saint Bartelemy",
"fr_CA": "French Canada",
"fr_CD": "French Congo Drc",
"fr_CF": "French Central African Republic",
"fr_CG": "French Congo Republic",
"fr_CH": "French Switzerland",
"fr_CI": "French Cote D Ivoire",
"fr_CM": "French Cameroon",
"fr_DJ": "French Djibouti",
"fr_DZ": "French Algeria",
"fr_FR": "French France",
"fr_GA": "French Gabon",
"fr_GF": "French French Guiana",
"fr_GN": "French Guinea",
"fr_GP": "French Guadeloupe",
"fr_GQ": "French Equatorial Guinea",
"fr_HT": "French Haiti",
"fr_KM": "French Comoros",
"fr_LU": "French Luxembourg",
"fr_MA": "French Morocco",
"fr_MC": "French Monaco",
"fr_MF": "French Saint Martin",
"fr_MG": "French Madagascar",
"fr_ML": "French Mali",
"fr_MQ": "French Martinique",
"fr_MR": "French Mauritania",
"fr_MU": "French Mauritius",
"fr_NC": "French New Caledonia",
"fr_NE": "French Niger",
"fr_PF": "French French Polynesia",
"fr_PM": "French Saint Pierre Miquelon",
"fr_RE": "French Reunion",
"fr_RW": "French Rwanda",
"fr_SC": "French Seychelles",
"fr_SN": "French Senegal",
"fr_SY": "French Syria",
"fr_TD": "French Chad",
"fr_TG": "French Togo",
"fr_TN": "French Tunisia",
"fr_VU": "French Vanuatu",
"fr_WF": "French Wallis Futuna",
"fr_YT": "French Mayotte",
"ga_IE": "Irish Ireland",
"gl_ES": "Galician Spain",
"gsw_CH": "Swiss German Switzerland",
"gsw_LI": "Swiss German Liechtenstein",
"gu_IN": "Gujarati India",
"guz_KE": "Gusii Kenya",
"gv_IM": "Manx Isle Of Man",
"ha_GH": "Hausa Latin Ghana",
"ha_NE": "Hausa Latin Niger",
"ha_NG": "Hausa Latin Nigeria",
"haw_US": "Hawaiian United States",
"hi_IN": "Hindi India",
"hr_BA": "Croatian Bosnia Herzegovina",
"hr_HR": "Croatian Croatia",
"hu_HU": "Hungarian Hungary",
"hy_AM": "Armenian Armenia",
"ig_NG": "Igbo Nigeria",
"ii_CN": "Sichuan Yi China",
"in_ID": "Indonesian Indonesia",
"is_IS": "Icelandic Iceland",
"it_CH": "Italian Switzerland",
"it_IT": "Italian Italy",
"it_SM": "Italian San Marino",
"iw_IL": "Hebrew Israel",
"ja_JP": "Japanese Japan",
"jgo_CM": "Ngomba Cameroon",
"jmc_TZ": "Machame Tanzania",
"ka_GE": "Georgian Georgia",
"kab_DZ": "Kabyle Algeria",
"kam_KE": "Kamba Kenya",
"kde_TZ": "Makonde Tanzania",
"kea_CV": "Kabuverdianu Cape Verde",
"khq_ML": "Koyra Chiini Mali",
"ki_KE": "Kikuyu Kenya",
"kk_KZ": "Kazakh Cyrillic Kazakhstan",
"kkj_CM": "Kako Cameroon",
"kl_GL": "Kalaallisut Greenland",
"kln_KE": "Kalenjin Kenya",
"km_KH": "Khmer Cambodia",
"kn_IN": "Kannada India",
"ko_KP": "Korean North Korea",
"ko_KR": "Korean South Korea",
"kok_IN": "Konkani India",
"ks_IN": "Kashmiri Arabic India",
"ksb_TZ": "Shambala Tanzania",
"ksf_CM": "Bafia Cameroon",
"kw_GB": "Cornish United Kingdom",
"ky_KG": "Kyrgyz Cyrillic Kyrgyzstan",
"lag_TZ": "Langi Tanzania",
"lg_UG": "Ganda Uganda",
"lkt_US": "Lakota United States",
"ln_AO": "Lingala Angola",
"ln_CD": "Lingala Congo Drc",
"ln_CF": "Lingala Central African Republic",
"ln_CG": "Lingala Congo Republic",
"lo_LA": "Lao Laos",
"lt_LT": "Lithuanian Lithuania",
"lu_CD": "Luba Katanga Congo Drc",
"luo_KE": "Luo Kenya",
"luy_KE": "Luyia Kenya",
"lv_LV": "Latvian Latvia",
"mas_KE": "Masai Kenya",
"mas_TZ": "Masai Tanzania",
"mer_KE": "Meru Kenya",
"mfe_MU": "Morisyen Mauritius",
"mg_MG": "Malagasy Madagascar",
"mgh_MZ": "Makhuwa Meetto Mozambique",
"mgo_CM": "Meta Cameroon",
"mk_MK": "Macedonian Macedonia Fyrom",
"ml_IN": "Malayalam India",
"mn_MN": "Mongolian Cyrillic Mongolia",
"mr_IN": "Marathi India",
"ms_BN": "Malay Latin Brunei",
"ms_MY": "Malay Latin Malaysia",
"ms_SG": "Malay Latin Singapore",
"mt_MT": "Maltese Malta",
"mua_CM": "Mundang Cameroon",
"my_MM": "Burmese Myanmar Burma",
"naq_NA": "Nama Namibia",
"nb_NO": "Norwegian Bokmal Norway",
"nb_SJ": "Norwegian Bokmal Svalbard Jan Mayen",
"nd_ZW": "North Ndebele Zimbabwe",
"ne_IN": "Nepali India",
"ne_NP": "Nepali Nepal",
"nl_AW": "Dutch Aruba",
"nl_BE": "Dutch Belgium",
"nl_BQ": "Dutch Caribbean Netherlands",
"nl_CW": "Dutch Curacao",
"nl_NL": "Dutch Netherlands",
"nl_SR": "Dutch Suriname",
"nl_SX": "Dutch Sint Maarten",
"nmg_CM": "Kwasio Cameroon",
"nn_NO": "Norwegian Nynorsk Norway",
"nnh_CM": "Ngiemboon Cameroon",
"nus_SD": "Nuer Sudan",
"nyn_UG": "Nyankole Uganda",
"om_ET": "Oromo Ethiopia",
"om_KE": "Oromo Kenya",
"or_IN": "Oriya India",
"pa_IN": "Punjabi Gurmukhi India",
"pa_PK": "Punjabi Arabic Pakistan",
"pl_PL": "Polish Poland",
"ps_AF": "Pashto Afghanistan",
"pt_AO": "Portuguese Angola",
"pt_BR": "Portuguese Brazil",
"pt_CV": "Portuguese Cape Verde",
"pt_GW": "Portuguese Guinea Bissau",
"pt_MO": "Portuguese Macau",
"pt_MZ": "Portuguese Mozambique",
"pt_PT": "Portuguese Portugal",
"pt_ST": "Portuguese Sao Tome Principe",
"pt_TL": "Portuguese Timor Leste",
"rm_CH": "Romansh Switzerland",
"rn_BI": "Rundi Burundi",
"ro_MD": "Romanian Moldova",
"ro_RO": "Romanian Romania",
"rof_TZ": "Rombo Tanzania",
"ru_BY": "Russian Belarus",
"ru_KG": "Russian Kyrgyzstan",
"ru_KZ": "Russian Kazakhstan",
"ru_MD": "Russian Moldova",
"ru_RU": "Russian Russia",
"ru_UA": "Russian Ukraine",
"rw_RW": "Kinyarwanda Rwanda",
"rwk_TZ": "Rwa Tanzania",
"saq_KE": "Samburu Kenya",
"sbp_TZ": "Sangu Tanzania",
"seh_MZ": "Sena Mozambique",
"ses_ML": "Koyraboro Senni Mali",
"sg_CF": "Sango Central African Republic",
"shi_MA": "Tachelhit Morocco (Tifinagh/Latin)",
"si_LK": "Sinhala Sri Lanka",
"sk_SK": "Slovak Slovakia",
"sl_SI": "Slovenian Slovenia",
"sn_ZW": "Shona Zimbabwe",
"so_DJ": "Somali Djibouti",
"so_ET": "Somali Ethiopia",
"so_KE": "Somali Kenya",
"so_SO": "Somali Somalia",
"sq_AL": "Albanian Albania",
"sq_MK": "Albanian Macedonia Fyrom",
"sq_XK": "Albanian Kosovo",
"sr_BA": "Serbian Bosnia Herzegovina (Cyrillic/Latin)",
"sr_ME": "Serbian Montenegro (Cyrillic/Latin)",
"sr_RS": "Serbian Serbia (Cyrillic/Latin)",
"sr_XK": "Serbian Kosovo (Cyrillic/Latin)",
"sv_AX": "Swedish Aland Islands",
"sv_FI": "Swedish Finland",
"sv_SE": "Swedish Sweden",
"sw_KE": "Swahili Kenya",
"sw_TZ": "Swahili Tanzania",
"sw_UG": "Swahili Uganda",
"swc_CD": "Congo Swahili Congo Drc",
"ta_IN": "Tamil India",
"ta_LK": "Tamil Sri Lanka",
"ta_MY": "Tamil Malaysia",
"ta_SG": "Tamil Singapore",
"te_IN": "Telugu India",
"teo_KE": "Teso Kenya",
"teo_UG": "Teso Uganda",
"th_TH": "Thai Thailand",
"ti_ER": "Tigrinya Eritrea",
"ti_ET": "Tigrinya Ethiopia",
"to_TO": "Tongan Tonga",
"tr_CY": "Turkish Cyprus",
"tr_TR": "Turkish Turkey",
"twq_NE": "Tasawaq Niger",
"tzm_MA": "Central Atlas Tamazight Latin Morocco",
"ug_CN": "Uyghur Arabic China",
"uk_UA": "Ukrainian Ukraine",
"ur_IN": "Urdu India",
"ur_PK": "Urdu Pakistan",
"uz_AF": "Uzbek Arabic Afghanistan",
"uz_UZ": "Uzbek Uzbekistan (Cyrillic/Latin)",
"vai_LR": "Vai Latin Liberia (Vai/Latin)",
"vi_VN": "Vietnamese Vietnam",
"vun_TZ": "Vunjo Tanzania",
"xog_UG": "Soga Uganda",
"yav_CM": "Yangben Cameroon",
"yo_BJ": "Yoruba Benin",
"yo_NG": "Yoruba Nigeria",
"zgh_MA": "Standard Moroccan Tamazight Morocco",
"zh_CN": "Chinese Simplified Han China",
"zh_HK": "Chinese Han Hong Kong (Simplified+Traditional)",
"zh_MO": "Chinese Han Macau (Simplified+Traditional)",
"zh_SG": "Chinese Simplified Han Singapore",
"zh_TW": "Chinese Traditional Han Taiwan",
"zu_ZA": "Zulu South Africa"
}

Why TYPO3 throws a missing service error after composer installation?

I have a TYPO3 V10 composer installation.
After a composer update I got this message in frontend:
(1/1) Symfony\Component\DependencyInjection\Exception\RuntimeException
Cannot autowire service
"TYPO3\CMS\Extensionmanager\Utility\InstallUtility": argument
"$lateBootService" of method "injectLateBootService()" references
class "TYPO3\CMS\Install\Service\LateBootService" but no such service
exists.
and in the install tool that message:
(1/1) #1519978105 TYPO3\CMS\Core\DependencyInjection\NotFoundException
Container entry "TYPO3\CMS\Install\Http\Application" is not available.
I have tried to remove the vendor, TYPO3 and extentions folder and did a fresh composer installation with:
composer install
composer dump-autoload -o
My composer.json is not special:
{ "name": "typo3/cms-base-distribution",
"description" : "Distribution V10",
"license": "GPL-2.0-or-later",
"config": {
"platform": {
"php": "7.2"
},
"sort-packages": true
},
"require": {
"cweagans/composer-patches": "^1.6",
"deployer/deployer": "^6.8",
"deployer/recipes": "^6.2",
"fluidtypo3/vhs": "^6.0",
"georgringer/news": "^8.3",
"gridelementsteam/gridelements": "^10",
"helhum/config-loader": "^0.12.2",
"helhum/typo3-console": "^6.3",
"in2code/powermail": "^8.1.1",
"jambagecom/static-info-tables-de": "^6.7",
"plan2net/webp": "^3.1",
"sgalinski/sg-cookie-optin": "^3.1",
"t3/dce": "^2.5.2",
"typo3/cms-about": "^10.4",
"typo3/cms-adminpanel": "^10.4",
"typo3/cms-backend": "^10.4",
"typo3/cms-belog": "^10.4",
"typo3/cms-beuser": "^10.4",
"typo3/cms-core": "^10.4",
"typo3/cms-dashboard": "^10.4",
"typo3/cms-extbase": "^10.4",
"typo3/cms-extensionmanager": "^10.4",
"typo3/cms-felogin": "^10.4",
"typo3/cms-filelist": "^10.4",
"typo3/cms-filemetadata": "^10.4",
"typo3/cms-fluid": "^10.4",
"typo3/cms-fluid-styled-content": "^10.4",
"typo3/cms-form": "^10.4",
"typo3/cms-frontend": "^10.4",
"typo3/cms-impexp": "^10.4",
"typo3/cms-indexed-search": "^10.4",
"typo3/cms-info": "^10.4",
"typo3/cms-install": "^10.4",
"typo3/cms-linkvalidator": "^10.4",
"typo3/cms-lowlevel": "^10.4",
"typo3/cms-opendocs": "^10.4",
"typo3/cms-recordlist": "^10.4",
"typo3/cms-recycler": "^10.4",
"typo3/cms-redirects": "^10.4",
"typo3/cms-reports": "^10.4",
"typo3/cms-rte-ckeditor": "^10.4",
"typo3/cms-scheduler": "^10.4",
"typo3/cms-seo": "^10.4",
"typo3/cms-setup": "^10.4",
"typo3/cms-sys-note": "^10.4",
"typo3/cms-t3editor": "^10.4",
"typo3/cms-tstemplate": "^10.4",
"typo3/cms-viewpage": "^10.4"
},
"autoload": {
"psr-4": {
"Ikiu\\TYPO3\\Distribution\\": "build/src",
"Ikiu\\Theme\\":"public/typo3conf/ext/theme/Classes"
}
},
"require-dev": {
"cweiske/php-sqllint": "^0.2.3",
"helmich/typo3-typoscript-lint": "^2.1",
"rector/rector": "^0.7.2"
},
"scripts":{
"typo3-cms-scripts": [
"typo3cms install:fixfolderstructure"
],
"post-autoload-dump": [
"#typo3-cms-scripts"
]
}
}
For unknown reason the install system extension did vanish from the typo3conf/PackageStates.php file.
Simply add the config for the install extension to the file.
'install' => [
'packagePath' => 'typo3/sysext/install/',
],

How to set VSCode debug console foreground color?

I've tried these, but none of them seem to work:
"workbench.colorCustomizations": {
"consoleView.foreground":"#000",
"debug.console.foreground": "#000",
"debugConsole.foreground" : "#000",
"debugConsole.infoForeground" : "#000",
"debugConsole.warningForeground" : "#000",
"debugConsole.errorForeground" : "#000",
"debugConsole.sourceForeground" : "#000",
}

Comparing metadata using Talend Data Integration

I am very new to Talend and trying to solve a requirement in my current project. I need to compare XSD and JSON metadata from two different sources and output a XLS file if these metadata match. Can you please give me some tips if you have worked on similar requirement?
Here is the XSD Sample -
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema elementFormDefault="qualified" targetNamespace="myNamespace/TroubleTicketCountResponse.xsd" version="214.0.00" xmlns="myNamespace/TroubleTicketCountResponse.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="TicketCountResponse" type="TicketCountResponseInfo"/>
<xs:complexType name="TicketCountResponseInfo">
<xs:annotation>
<xs:documentation>Retrieves Ticket counts</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element minOccurs="0" name="addressId">
<xs:annotation>
<xs:documentation>Location Id</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="30"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element minOccurs="0" name="organizationId" type="xs:int">
<xs:annotation>
<xs:documentation>Organization Identifier</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" name="assetId">
<xs:annotation>
<xs:documentation>CircuitId</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="20"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element minOccurs="0" name="assetKey">
<xs:annotation>
<xs:documentation>AssetId</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="30"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element minOccurs="0" name="accountOrganizationId" type="xs:string">
<xs:annotation>
<xs:documentation>accountOrganizationid</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:schema>
Here is the JSON schema sample -
"title": "CustomerTroubleTicketCount",
"description": "Retrieves Ticket counts",
"type": "object",
"properties": {
"addressId": {
"description": "replacement for Location Id",
"type": "string"
},
"organizationId": {
"description": "Organization Identifier",
"type": "number"
},
"assetId": {
"description": "Circuit Id",
"type": "string",
}
},
"assetKey": {
"description": "AssetId can be serial circuit/CLCI",
"type": "string",
}
},
"accountOrganizationId": {
"description": "accountOrganizationid",
"type": "string",
}
}
Thanks,
Souvik

How to get the user's country calling code in iOS?

I am developing an iOS app in which the user enters their mobile number. How do I get their country calling code? For example, if a user is in India, then +91 should be prefixed automatically. Is there an option that adds country codes automatically?
Import Statement :
#import<CoreTelephony/CTCarrier.h>
#import <CoreTelephony/CTTelephonyNetworkInfo.h>
you can get country code for the current Carrier using CoreTelephony framework:
CTTelephonyNetworkInfo *network_Info = [CTTelephonyNetworkInfo new];
CTCarrier *carrier = network_Info.subscriberCellularProvider;
NSLog(#"country code is: %#", carrier.mobileCountryCode);
//will return the actual country code
NSLog(#"ISO country code is: %#", carrier.isoCountryCode);
Apple Docs
with the use of NSLocale you can get the country name, code etc. Take a look at below code it will help you to do so.
NSLocale *currentLocale = [NSLocale currentLocale]; // get the current locale.
NSString *countryCode = [currentLocale objectForKey:NSLocaleCountryCode]; // get country code, e.g. ES (Spain), FR (France), etc.
for a countries dialing code you can visit this reference code.
Use this simple function
func getCountryCallingCode(countryRegionCode:String)->String{
let prefixCodes = ["AF": "93", "AE": "971", "AL": "355", "AN": "599", "AS":"1", "AD": "376", "AO": "244", "AI": "1", "AG":"1", "AR": "54","AM": "374", "AW": "297", "AU":"61", "AT": "43","AZ": "994", "BS": "1", "BH":"973", "BF": "226","BI": "257", "BD": "880", "BB": "1", "BY": "375", "BE":"32","BZ": "501", "BJ": "229", "BM": "1", "BT":"975", "BA": "387", "BW": "267", "BR": "55", "BG": "359", "BO": "591", "BL": "590", "BN": "673", "CC": "61", "CD":"243","CI": "225", "KH":"855", "CM": "237", "CA": "1", "CV": "238", "KY":"345", "CF":"236", "CH": "41", "CL": "56", "CN":"86","CX": "61", "CO": "57", "KM": "269", "CG":"242", "CK": "682", "CR": "506", "CU":"53", "CY":"537","CZ": "420", "DE": "49", "DK": "45", "DJ":"253", "DM": "1", "DO": "1", "DZ": "213", "EC": "593", "EG":"20", "ER": "291", "EE":"372","ES": "34", "ET": "251", "FM": "691", "FK": "500", "FO": "298", "FJ": "679", "FI":"358", "FR": "33", "GB":"44", "GF": "594", "GA":"241", "GS": "500", "GM":"220", "GE":"995","GH":"233", "GI": "350", "GQ": "240", "GR": "30", "GG": "44", "GL": "299", "GD":"1", "GP": "590", "GU": "1", "GT": "502", "GN":"224","GW": "245", "GY": "595", "HT": "509", "HR": "385", "HN":"504", "HU": "36", "HK": "852", "IR": "98", "IM": "44", "IL": "972", "IO":"246", "IS": "354", "IN": "91", "ID":"62", "IQ":"964", "IE": "353","IT":"39", "JM":"1", "JP": "81", "JO": "962", "JE":"44", "KP": "850", "KR": "82","KZ":"77", "KE": "254", "KI": "686", "KW": "965", "KG":"996","KN":"1", "LC": "1", "LV": "371", "LB": "961", "LK":"94", "LS": "266", "LR":"231", "LI": "423", "LT": "370", "LU": "352", "LA": "856", "LY":"218", "MO": "853", "MK": "389", "MG":"261", "MW": "265", "MY": "60","MV": "960", "ML":"223", "MT": "356", "MH": "692", "MQ": "596", "MR":"222", "MU": "230", "MX": "52","MC": "377", "MN": "976", "ME": "382", "MP": "1", "MS": "1", "MA":"212", "MM": "95", "MF": "590", "MD":"373", "MZ": "258", "NA":"264", "NR":"674", "NP":"977", "NL": "31","NC": "687", "NZ":"64", "NI": "505", "NE": "227", "NG": "234", "NU":"683", "NF": "672", "NO": "47","OM": "968", "PK": "92", "PM": "508", "PW": "680", "PF": "689", "PA": "507", "PG":"675", "PY": "595", "PE": "51", "PH": "63", "PL":"48", "PN": "872","PT": "351", "PR": "1","PS": "970", "QA": "974", "RO":"40", "RE":"262", "RS": "381", "RU": "7", "RW": "250", "SM": "378", "SA":"966", "SN": "221", "SC": "248", "SL":"232","SG": "65", "SK": "421", "SI": "386", "SB":"677", "SH": "290", "SD": "249", "SR": "597","SZ": "268", "SE":"46", "SV": "503", "ST": "239","SO": "252", "SJ": "47", "SY":"963", "TW": "886", "TZ": "255", "TL": "670", "TD": "235", "TJ": "992", "TH": "66", "TG":"228", "TK": "690", "TO": "676", "TT": "1", "TN":"216","TR": "90", "TM": "993", "TC": "1", "TV":"688", "UG": "256", "UA": "380", "US": "1", "UY": "598","UZ": "998", "VA":"379", "VE":"58", "VN": "84", "VG": "1", "VI": "1","VC":"1", "VU":"678", "WS": "685", "WF": "681", "YE": "967", "YT": "262","ZA": "27" , "ZM": "260", "ZW":"263"]
let countryDialingCode = prefixCodes[countryRegionCode]
return countryDialingCode!
}
And call as
let currentLocale = NSLocale.currentLocale()
let countryCode = currentLocale.objectForKey(NSLocaleCountryCode) as! String//get the set country name, code of your iphone
print("country code is \(countryCode)")
print(getCountryCallingCode(countryCode))
//change country region Settings>>General>>Language&Region>>Region
Swift
let networkInfo = CTTelephonyNetworkInfo()
if let carrier = networkInfo.subscriberCellularProvider {
print("country code is: " + carrier.mobileCountryCode!);
//will return the actual country code
print("ISO country code is: " + carrier.isoCountryCode!);
}
Swift 5
I combine answer from Oded and LC into a function.
func getCountryCode() -> String {
guard let carrier = CTTelephonyNetworkInfo().subscriberCellularProvider, let countryCode = carrier.isoCountryCode else { return "" }
let prefixCodes = ["AF": "93", "AE": "971", "AL": "355", "AN": "599", "AS":"1", "AD": "376", "AO": "244", "AI": "1", "AG":"1", "AR": "54","AM": "374", "AW": "297", "AU":"61", "AT": "43","AZ": "994", "BS": "1", "BH":"973", "BF": "226","BI": "257", "BD": "880", "BB": "1", "BY": "375", "BE":"32","BZ": "501", "BJ": "229", "BM": "1", "BT":"975", "BA": "387", "BW": "267", "BR": "55", "BG": "359", "BO": "591", "BL": "590", "BN": "673", "CC": "61", "CD":"243","CI": "225", "KH":"855", "CM": "237", "CA": "1", "CV": "238", "KY":"345", "CF":"236", "CH": "41", "CL": "56", "CN":"86","CX": "61", "CO": "57", "KM": "269", "CG":"242", "CK": "682", "CR": "506", "CU":"53", "CY":"537","CZ": "420", "DE": "49", "DK": "45", "DJ":"253", "DM": "1", "DO": "1", "DZ": "213", "EC": "593", "EG":"20", "ER": "291", "EE":"372","ES": "34", "ET": "251", "FM": "691", "FK": "500", "FO": "298", "FJ": "679", "FI":"358", "FR": "33", "GB":"44", "GF": "594", "GA":"241", "GS": "500", "GM":"220", "GE":"995","GH":"233", "GI": "350", "GQ": "240", "GR": "30", "GG": "44", "GL": "299", "GD":"1", "GP": "590", "GU": "1", "GT": "502", "GN":"224","GW": "245", "GY": "595", "HT": "509", "HR": "385", "HN":"504", "HU": "36", "HK": "852", "IR": "98", "IM": "44", "IL": "972", "IO":"246", "IS": "354", "IN": "91", "ID":"62", "IQ":"964", "IE": "353","IT":"39", "JM":"1", "JP": "81", "JO": "962", "JE":"44", "KP": "850", "KR": "82","KZ":"77", "KE": "254", "KI": "686", "KW": "965", "KG":"996","KN":"1", "LC": "1", "LV": "371", "LB": "961", "LK":"94", "LS": "266", "LR":"231", "LI": "423", "LT": "370", "LU": "352", "LA": "856", "LY":"218", "MO": "853", "MK": "389", "MG":"261", "MW": "265", "MY": "60","MV": "960", "ML":"223", "MT": "356", "MH": "692", "MQ": "596", "MR":"222", "MU": "230", "MX": "52","MC": "377", "MN": "976", "ME": "382", "MP": "1", "MS": "1", "MA":"212", "MM": "95", "MF": "590", "MD":"373", "MZ": "258", "NA":"264", "NR":"674", "NP":"977", "NL": "31","NC": "687", "NZ":"64", "NI": "505", "NE": "227", "NG": "234", "NU":"683", "NF": "672", "NO": "47","OM": "968", "PK": "92", "PM": "508", "PW": "680", "PF": "689", "PA": "507", "PG":"675", "PY": "595", "PE": "51", "PH": "63", "PL":"48", "PN": "872","PT": "351", "PR": "1","PS": "970", "QA": "974", "RO":"40", "RE":"262", "RS": "381", "RU": "7", "RW": "250", "SM": "378", "SA":"966", "SN": "221", "SC": "248", "SL":"232","SG": "65", "SK": "421", "SI": "386", "SB":"677", "SH": "290", "SD": "249", "SR": "597","SZ": "268", "SE":"46", "SV": "503", "ST": "239","SO": "252", "SJ": "47", "SY":"963", "TW": "886", "TZ": "255", "TL": "670", "TD": "235", "TJ": "992", "TH": "66", "TG":"228", "TK": "690", "TO": "676", "TT": "1", "TN":"216","TR": "90", "TM": "993", "TC": "1", "TV":"688", "UG": "256", "UA": "380", "US": "1", "UY": "598","UZ": "998", "VA":"379", "VE":"58", "VN": "84", "VG": "1", "VI": "1","VC":"1", "VU":"678", "WS": "685", "WF": "681", "YE": "967", "YT": "262","ZA": "27" , "ZM": "260", "ZW":"263"]
let countryDialingCode = prefixCodes[countryCode.uppercased()] ?? ""
return countryDialingCode
}
Make sure to import CoreTelephony at the top
import CoreTelephony
I think you need to use NSLocale for using Country code of the user.
You can follow this link to understand use of NSLocale class reference.
Also study this link for ISOCountryCode property.
Hope this may help you.
I came up with the following code, based on previous answers:
Swift
#if canImport(CoreTelephony)
import CoreTelephony
#endif
static func getRegionCodeFromSim() -> String? {
#if canImport(CoreTelephony)
let networkInfos = CTTelephonyNetworkInfo()
if #available(iOS 12, *) {
let carrier = networkInfos.serviceSubscriberCellularProviders?
.map { $0.1 }
.first { $0.isoCountryCode != nil }
return carrier?.isoCountryCode
}
return networkInfos.subscriberCellularProvider?.isoCountryCode
#else
return nil
#endif
}
static func getRegionCode() -> String? {
guard let regionCodeFromSim = Self.getRegionCodeFromSim() else {
return NSLocale.current.regionCode
}
return regionCodeFromSim
}
static func getCountryCode() -> String? {
guard let regionCode = Self.getRegionCode() else { return nil }
let prefixCodes = ["AF": "93", "AE": "971", "AL": "355", "AN": "599", "AS":"1", "AD": "376", "AO": "244", "AI": "1", "AG":"1", "AR": "54","AM": "374", "AW": "297", "AU":"61", "AT": "43","AZ": "994", "BS": "1", "BH":"973", "BF": "226","BI": "257", "BD": "880", "BB": "1", "BY": "375", "BE":"32","BZ": "501", "BJ": "229", "BM": "1", "BT":"975", "BA": "387", "BW": "267", "BR": "55", "BG": "359", "BO": "591", "BL": "590", "BN": "673", "CC": "61", "CD":"243","CI": "225", "KH":"855", "CM": "237", "CA": "1", "CV": "238", "KY":"345", "CF":"236", "CH": "41", "CL": "56", "CN":"86","CX": "61", "CO": "57", "KM": "269", "CG":"242", "CK": "682", "CR": "506", "CU":"53", "CY":"537","CZ": "420", "DE": "49", "DK": "45", "DJ":"253", "DM": "1", "DO": "1", "DZ": "213", "EC": "593", "EG":"20", "ER": "291", "EE":"372","ES": "34", "ET": "251", "FM": "691", "FK": "500", "FO": "298", "FJ": "679", "FI":"358", "FR": "33", "GB":"44", "GF": "594", "GA":"241", "GS": "500", "GM":"220", "GE":"995","GH":"233", "GI": "350", "GQ": "240", "GR": "30", "GG": "44", "GL": "299", "GD":"1", "GP": "590", "GU": "1", "GT": "502", "GN":"224","GW": "245", "GY": "595", "HT": "509", "HR": "385", "HN":"504", "HU": "36", "HK": "852", "IR": "98", "IM": "44", "IL": "972", "IO":"246", "IS": "354", "IN": "91", "ID":"62", "IQ":"964", "IE": "353","IT":"39", "JM":"1", "JP": "81", "JO": "962", "JE":"44", "KP": "850", "KR": "82","KZ":"77", "KE": "254", "KI": "686", "KW": "965", "KG":"996","KN":"1", "LC": "1", "LV": "371", "LB": "961", "LK":"94", "LS": "266", "LR":"231", "LI": "423", "LT": "370", "LU": "352", "LA": "856", "LY":"218", "MO": "853", "MK": "389", "MG":"261", "MW": "265", "MY": "60","MV": "960", "ML":"223", "MT": "356", "MH": "692", "MQ": "596", "MR":"222", "MU": "230", "MX": "52","MC": "377", "MN": "976", "ME": "382", "MP": "1", "MS": "1", "MA":"212", "MM": "95", "MF": "590", "MD":"373", "MZ": "258", "NA":"264", "NR":"674", "NP":"977", "NL": "31","NC": "687", "NZ":"64", "NI": "505", "NE": "227", "NG": "234", "NU":"683", "NF": "672", "NO": "47","OM": "968", "PK": "92", "PM": "508", "PW": "680", "PF": "689", "PA": "507", "PG":"675", "PY": "595", "PE": "51", "PH": "63", "PL":"48", "PN": "872","PT": "351", "PR": "1","PS": "970", "QA": "974", "RO":"40", "RE":"262", "RS": "381", "RU": "7", "RW": "250", "SM": "378", "SA":"966", "SN": "221", "SC": "248", "SL":"232","SG": "65", "SK": "421", "SI": "386", "SB":"677", "SH": "290", "SD": "249", "SR": "597","SZ": "268", "SE":"46", "SV": "503", "ST": "239","SO": "252", "SJ": "47", "SY":"963", "TW": "886", "TZ": "255", "TL": "670", "TD": "235", "TJ": "992", "TH": "66", "TG":"228", "TK": "690", "TO": "676", "TT": "1", "TN":"216","TR": "90", "TM": "993", "TC": "1", "TV":"688", "UG": "256", "UA": "380", "US": "1", "UY": "598","UZ": "998", "VA":"379", "VE":"58", "VN": "84", "VG": "1", "VI": "1","VC":"1", "VU":"678", "WS": "685", "WF": "681", "YE": "967", "YT": "262","ZA": "27" , "ZM": "260", "ZW":"263"]
return prefixCodes[regionCode.uppercased()]
}
It tries to fetch the country code from the SIM cards (with multi-sim & non-sim devices support), if available, and fallbacks to the device's locale otherwise.
The prefixCodes could be loaded from a PLIST or JSON to help with readability.
If you want to prefixed calling country code automatically
then you need to get user's country code pragmatically and Drag & drop src Folder in your code
Its looks like this:
if let countryCode = (Locale.current as NSLocale).object(forKey: .countryCode) as? String {
print(countryCode)
let strCode = Countries.countryFromCountryCode(countryCode: countryCode)
btnPhoneCode.setTitle("+\(strCode.phoneExtension)", for: .normal)
}
It works for me, Hope will help you too. :)
NSLocale *currentLocale = [NSLocale currentLocale]; // get the current locale.
NSString *countryCode = [currentLocale objectForKey:NSLocaleCountryCode];
// get country code, e.g. ES (Spain), FR (France), etc.
NSLog(#"country code is:%#",countryCode);
NSString*lower=[countryCode lowercaseString];
NSString *path = [[NSBundle mainBundle] pathForResource:#"DiallingCodes" ofType:#"plist"];
NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:path];
NSMutableDictionary *_dictCountry=[[NSMutableDictionary alloc]init];
NSMutableArray *_CodeArray=[[NSMutableArray alloc]init];
[_CodeArray addObject:dict];
_dictCountry = [_CodeArray objectAtIndex:0];
NSString*Country_code=[NSString stringWithFormat:#"+%#",[_dictCountry objectForKey:lower]];
contactTextField.text=Country_code;
You can request to this url.
For get CountryCode or ip, region_name, city, long, lat
NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:#"http://freegeoip.net/json/"]];
__block NSDictionary *json;
[NSURLConnection sendAsynchronousRequest:request
queue:[NSOperationQueue mainQueue]
completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
json = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
NSLog(#"Countrycode: %#", json[#"country_code"]);
}];
Here the Objective C code
#import<CoreTelephony/CTCarrier.h>
#import <CoreTelephony/CTTelephonyNetworkInfo.h>
- (void)viewDidLoad{
CTTelephonyNetworkInfo *network_Info = [CTTelephonyNetworkInfo new];
CTCarrier *carrier = network_Info.subscriberCellularProvider;
NSLog(#"country code is: %#", carrier.mobileCountryCode);
NSLog(#"ISO country code is: %#", carrier.mobileNetworkCode);
NSLog(#"diling code == %#",[self getCountryCode:carrier.isoCountryCode]);
}
- (NSString *)getCountryCode:(NSString *)countryISOCode{
NSDictionary * code = #{#"AF": #"93", #"AE": #"971", #"AL": #"355", #"AN": #"599", #"AS":#"1", #"AD": #"376", #"AO": #"244", #"AI": #"1", #"AG":#"1", #"AR": #"54",#"AM": #"374", #"AW": #"297", #"AU":#"61", #"AT": #"43",#"AZ": #"994", #"BS": #"1", #"BH":#"973", #"BF": #"226",#"BI": #"257", #"BD": #"880", #"BB": #"1", #"BY": #"375", #"BE":#"32",#"BZ": #"501", #"BJ": #"229", #"BM": #"1", #"BT":#"975", #"BA": #"387", #"BW": #"267", #"BR": #"55", #"BG": #"359", #"BO": #"591", #"BL": #"590", #"BN": #"673", #"CC": #"61", #"CD":#"243",#"CI": #"225", #"KH":#"855", #"CM": #"237", #"CA": #"1", #"CV": #"238", #"KY":#"345", #"CF":#"236", #"CH": #"41", #"CL": #"56", #"CN":#"86",#"CX": #"61", #"CO": #"57", #"KM": #"269", #"CG":#"242", #"CK": #"682", #"CR": #"506", #"CU":#"53", #"CY":#"537",#"CZ": #"420", #"DE": #"49", #"DK": #"45", #"DJ":#"253", #"DM": #"1", #"DO": #"1", #"DZ": #"213", #"EC": #"593", #"EG":#"20", #"ER": #"291", #"EE":#"372",#"ES": #"34", #"ET": #"251", #"FM": #"691", #"FK": #"500", #"FO": #"298", #"FJ": #"679", #"FI":#"358", #"FR": #"33", #"GB":#"44", #"GF": #"594", #"GA":#"241", #"GS": #"500", #"GM":#"220", #"GE":#"995",#"GH":#"233", #"GI": #"350", #"GQ": #"240", #"GR": #"30", #"GG": #"44", #"GL": #"299", #"GD":#"1", #"GP": #"590", #"GU": #"1", #"GT": #"502", #"GN":#"224",#"GW": #"245", #"GY": #"595", #"HT": #"509", #"HR": #"385", #"HN":#"504", #"HU": #"36", #"HK": #"852", #"IR": #"98", #"IM": #"44", #"IL": #"972", #"IO":#"246", #"IS": #"354", #"IN": #"91", #"ID":#"62", #"IQ":#"964", #"IE": #"353",#"IT":#"39", #"JM":#"1", #"JP": #"81", #"JO": #"962", #"JE":#"44", #"KP": #"850", #"KR": #"82",#"KZ":#"77", #"KE": #"254", #"KI": #"686", #"KW": #"965", #"KG":#"996",#"KN":#"1", #"LC": #"1", #"LV": #"371", #"LB": #"961", #"LK":#"94", #"LS": #"266", #"LR":#"231", #"LI": #"423", #"LT": #"370", #"LU": #"352", #"LA": #"856", #"LY":#"218", #"MO": #"853", #"MK": #"389", #"MG":#"261", #"MW": #"265", #"MY": #"60",#"MV": #"960", #"ML":#"223", #"MT": #"356", #"MH": #"692", #"MQ": #"596", #"MR":#"222", #"MU": #"230", #"MX": #"52",#"MC": #"377", #"MN": #"976", #"ME": #"382", #"MP": #"1", #"MS": #"1", #"MA":#"212", #"MM": #"95", #"MF": #"590", #"MD":#"373", #"MZ": #"258", #"NA":#"264", #"NR":#"674", #"NP":#"977", #"NL": #"31",#"NC": #"687", #"NZ":#"64", #"NI": #"505", #"NE": #"227", #"NG": #"234", #"NU":#"683", #"NF": #"672", #"NO": #"47",#"OM": #"968", #"PK": #"92", #"PM": #"508", #"PW": #"680", #"PF": #"689", #"PA": #"507", #"PG":#"675", #"PY": #"595", #"PE": #"51", #"PH": #"63", #"PL":#"48", #"PN": #"872",#"PT": #"351", #"PR": #"1",#"PS": #"970", #"QA": #"974", #"RO":#"40", #"RE":#"262", #"RS": #"381", #"RU": #"7", #"RW": #"250", #"SM": #"378", #"SA":#"966", #"SN": #"221", #"SC": #"248", #"SL":#"232",#"SG": #"65", #"SK": #"421", #"SI": #"386", #"SB":#"677", #"SH": #"290", #"SD": #"249", #"SR": #"597",#"SZ": #"268", #"SE":#"46", #"SV": #"503", #"ST": #"239",#"SO": #"252", #"SJ": #"47", #"SY":#"963", #"TW": #"886", #"TZ": #"255", #"TL": #"670", #"TD": #"235", #"TJ": #"992", #"TH": #"66", #"TG":#"228", #"TK": #"690", #"TO": #"676", #"TT": #"1", #"TN":#"216",#"TR": #"90", #"TM": #"993", #"TC": #"1", #"TV":#"688", #"UG": #"256", #"UA": #"380", #"US": #"1", #"UY": #"598",#"UZ": #"998", #"VA":#"379", #"VE":#"58", #"VN": #"84", #"VG": #"1", #"VI": #"1",#"VC":#"1", #"VU":#"678", #"WS": #"685", #"WF": #"681", #"YE": #"967", #"YT": #"262",#"ZA": #"27" , #"ZM": #"260", #"ZW":#"263"};
return [NSString stringWithFormat:#"+%#", [code objectForKey:[countryISOCode uppercaseString]]];
}
Swift 5 Support and using optionals here is my solution:
static func GetCountryCallingCode(countryRegionCode:String) -> String? {
let prefixCodes = ["AF": "93", "AE": "971", "AL": "355", "AN": "599", "AS":"1", "AD": "376", "AO": "244", "AI": "1", "AG":"1", "AR": "54","AM": "374", "AW": "297", "AU":"61", "AT": "43","AZ": "994", "BS": "1", "BH":"973", "BF": "226","BI": "257", "BD": "880", "BB": "1", "BY": "375", "BE":"32","BZ": "501", "BJ": "229", "BM": "1", "BT":"975", "BA": "387", "BW": "267", "BR": "55", "BG": "359", "BO": "591", "BL": "590", "BN": "673", "CC": "61", "CD":"243","CI": "225", "KH":"855", "CM": "237", "CA": "1", "CV": "238", "KY":"345", "CF":"236", "CH": "41", "CL": "56", "CN":"86","CX": "61", "CO": "57", "KM": "269", "CG":"242", "CK": "682", "CR": "506", "CU":"53", "CY":"537","CZ": "420", "DE": "49", "DK": "45", "DJ":"253", "DM": "1", "DO": "1", "DZ": "213", "EC": "593", "EG":"20", "ER": "291", "EE":"372","ES": "34", "ET": "251", "FM": "691", "FK": "500", "FO": "298", "FJ": "679", "FI":"358", "FR": "33", "GB":"44", "GF": "594", "GA":"241", "GS": "500", "GM":"220", "GE":"995","GH":"233", "GI": "350", "GQ": "240", "GR": "30", "GG": "44", "GL": "299", "GD":"1", "GP": "590", "GU": "1", "GT": "502", "GN":"224","GW": "245", "GY": "595", "HT": "509", "HR": "385", "HN":"504", "HU": "36", "HK": "852", "IR": "98", "IM": "44", "IL": "972", "IO":"246", "IS": "354", "IN": "91", "ID":"62", "IQ":"964", "IE": "353","IT":"39", "JM":"1", "JP": "81", "JO": "962", "JE":"44", "KP": "850", "KR": "82","KZ":"77", "KE": "254", "KI": "686", "KW": "965", "KG":"996","KN":"1", "LC": "1", "LV": "371", "LB": "961", "LK":"94", "LS": "266", "LR":"231", "LI": "423", "LT": "370", "LU": "352", "LA": "856", "LY":"218", "MO": "853", "MK": "389", "MG":"261", "MW": "265", "MY": "60","MV": "960", "ML":"223", "MT": "356", "MH": "692", "MQ": "596", "MR":"222", "MU": "230", "MX": "52","MC": "377", "MN": "976", "ME": "382", "MP": "1", "MS": "1", "MA":"212", "MM": "95", "MF": "590", "MD":"373", "MZ": "258", "NA":"264", "NR":"674", "NP":"977", "NL": "31","NC": "687", "NZ":"64", "NI": "505", "NE": "227", "NG": "234", "NU":"683", "NF": "672", "NO": "47","OM": "968", "PK": "92", "PM": "508", "PW": "680", "PF": "689", "PA": "507", "PG":"675", "PY": "595", "PE": "51", "PH": "63", "PL":"48", "PN": "872","PT": "351", "PR": "1","PS": "970", "QA": "974", "RO":"40", "RE":"262", "RS": "381", "RU": "7", "RW": "250", "SM": "378", "SA":"966", "SN": "221", "SC": "248", "SL":"232","SG": "65", "SK": "421", "SI": "386", "SB":"677", "SH": "290", "SD": "249", "SR": "597","SZ": "268", "SE":"46", "SV": "503", "ST": "239","SO": "252", "SJ": "47", "SY":"963", "TW": "886", "TZ": "255", "TL": "670", "TD": "235", "TJ": "992", "TH": "66", "TG":"228", "TK": "690", "TO": "676", "TT": "1", "TN":"216","TR": "90", "TM": "993", "TC": "1", "TV":"688", "UG": "256", "UA": "380", "US": "1", "UY": "598","UZ": "998", "VA":"379", "VE":"58", "VN": "84", "VG": "1", "VI": "1","VC":"1", "VU":"678", "WS": "685", "WF": "681", "YE": "967", "YT": "262","ZA": "27" , "ZM": "260", "ZW":"263"]
let countryDialingCode = prefixCodes[countryRegionCode]
return countryDialingCode
}
guard let regionCode = NSLocale.current.regionCode,
let callingCode = GetCountryCallingCode(countryRegionCode: regionCode )
else { return }
print("Region: \(regionCode) Country calling code is \(callingCode)")
import CoreTelephony
/// Method to get the iso calling code
///
/// - Returns: String
public static func getCallingCodePrefix() -> String {
let networkInfo = CTTelephonyNetworkInfo()
let phoneNumberKit = PhoneNumberKit()
if #available(iOS 12.0, *) {
if let carrier = networkInfo.serviceSubscriberCellularProviders?.map({ $0.1 }).first(where: { $0.isoCountryCode != nil }), let isoCode = carrier.isoCountryCode?.uppercased(), let prefixCode = phoneNumberKit.countryCode(for: isoCode) {
return "+" + String(prefixCode)
}
} else {
// Fallback on earlier versions
if let carrier = networkInfo.subscriberCellularProvider, let isoCode = carrier.isoCountryCode?.uppercased(), let prefixCode = phoneNumberKit.countryCode(for: isoCode) {
return "+" + String(prefixCode)
}
}
return "+"
}
Use this code to get the user's country in iOS:
func countryName(from countryCode: String) -> String {
if let name = (Locale.current as NSLocale).displayName(forKey: .countryCode, value: countryCode) {
return name
} else {
return countryCode
}
}
//Locale.current.regionCode this is used for Get user current country region code
countryName(from: Locale.current.regionCode ?? "")