Using now region names from k-i18n as Country name

This commit is contained in:
dankito 2024-12-12 22:32:27 +01:00
parent d923dcb3f0
commit 428d4040e6
3 changed files with 255 additions and 252 deletions

View File

@ -12,7 +12,7 @@ class Party(
val additionalAddressLine: String? = null,
var postalCode: String?,
val city: String,
val country: Country = Country.DE,
val country: Country = Country.Germany,
val vatId: String? = null,

View File

@ -1,255 +1,255 @@
package net.codinux.invoicing.model.codes
enum class Country(val alpha2Code: String, val alpha3Code: String?, val englishName: String) {
AF("AF", "AFG", "Afghanistan"),
AX("AX", "ALA", "Åland Islands"),
AL("AL", "ALB", "Albania"),
DZ("DZ", "DZA", "Algeria"),
AS("AS", "ASM", "American Samoa"),
AD("AD", "AND", "Andorra"),
AO("AO", "AGO", "Angola"),
AI("AI", "AIA", "Anguilla"),
AQ("AQ", "ATA", "Antarctica"),
AG("AG", "ATG", "Antigua and Barbuda"),
AR("AR", "ARG", "Argentina"),
AM("AM", "ARM", "Armenia"),
AW("AW", "ABW", "Aruba"),
AU("AU", "AUS", "Australia"),
AT("AT", "AUT", "Austria"),
AZ("AZ", "AZE", "Azerbaijan"),
BS("BS", "BHS", "Bahamas (the)"),
BH("BH", "BHR", "Bahrain"),
BD("BD", "BGD", "Bangladesh"),
BB("BB", "BRB", "Barbados"),
BY("BY", "BLR", "Belarus"),
BE("BE", "BEL", "Belgium"),
BZ("BZ", "BLZ", "Belize"),
BJ("BJ", "BEN", "Benin"),
BM("BM", "BMU", "Bermuda"),
BT("BT", "BTN", "Bhutan"),
BO("BO", "BOL", "Bolivia (Plurinational State of)"),
BQ("BQ", "BES", "Bonaire, Sint Eustatius and Saba"),
BA("BA", "BIH", "Bosnia and Herzegovina"),
BW("BW", "BWA", "Botswana"),
BV("BV", "BVT", "Bouvet Island"),
BR("BR", "BRA", "Brazil"),
IO("IO", "IOT", "British Indian Ocean Territory (the)"),
BN("BN", "BRN", "Brunei Darussalam"),
BG("BG", "BGR", "Bulgaria"),
BF("BF", "BFA", "Burkina Faso"),
BI("BI", "BDI", "Burundi"),
CV("CV", "CPV", "Cabo Verde"),
KH("KH", "KHM", "Cambodia"),
CM("CM", "CMR", "Cameroon"),
CA("CA", "CAN", "Canada"),
KY("KY", "CYM", "Cayman Islands (the)"),
CF("CF", "CAF", "Central African Republic (the)"),
TD("TD", "TCD", "Chad"),
CL("CL", "CHL", "Chile"),
CN("CN", "CHN", "China"),
CX("CX", "CXR", "Christmas Island"),
CC("CC", "CCK", "Cocos (Keeling) Islands (the)"),
CO("CO", "COL", "Colombia"),
KM("KM", "COM", "Comoros (the)"),
CD("CD", "COD", "Congo (the Democratic Republic of the)"),
CG("CG", "COG", "Congo (the)"),
CK("CK", "COK", "Cook Islands (the)"),
CR("CR", "CRI", "Costa Rica"),
CI("CI", "CIV", "Côte d'Ivoire"),
HR("HR", "HRV", "Croatia"),
CU("CU", "CUB", "Cuba"),
CW("CW", "CUW", "Curaçao"),
CY("CY", "CYP", "Cyprus"),
CZ("CZ", "CZE", "Czechia"),
DK("DK", "DNK", "Denmark"),
DJ("DJ", "DJI", "Djibouti"),
DM("DM", "DMA", "Dominica"),
DO("DO", "DOM", "Dominican Republic (the)"),
EC("EC", "ECU", "Ecuador"),
EG("EG", "EGY", "Egypt"),
SV("SV", "SLV", "El Salvador"),
GQ("GQ", "GNQ", "Equatorial Guinea"),
ER("ER", "ERI", "Eritrea"),
EE("EE", "EST", "Estonia"),
SZ("SZ", "SWZ", "Eswatini"),
ET("ET", "ETH", "Ethiopia"),
FK("FK", "FLK", "Falkland Islands (the) [Malvinas]"),
FO("FO", "FRO", "Faroe Islands (the)"),
FJ("FJ", "FJI", "Fiji"),
FI("FI", "FIN", "Finland"),
FR("FR", "FRA", "France"),
GF("GF", "GUF", "French Guiana"),
PF("PF", "PYF", "French Polynesia"),
TF("TF", "ATF", "French Southern Territories (the)"),
GA("GA", "GAB", "Gabon"),
GM("GM", "GMB", "Gambia (the)"),
GE("GE", "GEO", "Georgia"),
DE("DE", "DEU", "Germany"),
GH("GH", "GHA", "Ghana"),
GI("GI", "GIB", "Gibraltar"),
GR("GR", "GRC", "Greece"),
GL("GL", "GRL", "Greenland"),
GD("GD", "GRD", "Grenada"),
GP("GP", "GLP", "Guadeloupe"),
GU("GU", "GUM", "Guam"),
GT("GT", "GTM", "Guatemala"),
GG("GG", "GGY", "Guernsey"),
GN("GN", "GIN", "Guinea"),
GW("GW", "GNB", "Guinea-Bissau"),
GY("GY", "GUY", "Guyana"),
HT("HT", "HTI", "Haiti"),
HM("HM", "HMD", "Heard Island and McDonald Islands"),
VA("VA", "VAT", "Holy See (the)"),
HN("HN", "HND", "Honduras"),
HK("HK", "HKG", "Hong Kong"),
HU("HU", "HUN", "Hungary"),
IS("IS", "ISL", "Iceland"),
IN("IN", "IND", "India"),
ID("ID", "IDN", "Indonesia"),
IR("IR", "IRN", "Iran (Islamic Republic of)"),
IQ("IQ", "IRQ", "Iraq"),
IE("IE", "IRL", "Ireland"),
IM("IM", "IMN", "Isle of Man"),
IL("IL", "ISR", "Israel"),
IT("IT", "ITA", "Italy"),
JM("JM", "JAM", "Jamaica"),
JP("JP", "JPN", "Japan"),
JE("JE", "JEY", "Jersey"),
JO("JO", "JOR", "Jordan"),
KZ("KZ", "KAZ", "Kazakhstan"),
KE("KE", "KEN", "Kenya"),
KI("KI", "KIR", "Kiribati"),
KP("KP", "PRK", "Korea (the Democratic People's Republic of)"),
KR("KR", "KOR", "Korea (the Republic of)"),
KW("KW", "KWT", "Kuwait"),
KG("KG", "KGZ", "Kyrgyzstan"),
LA("LA", "LAO", "Lao People's Democratic Republic (the)"),
LV("LV", "LVA", "Latvia"),
LB("LB", "LBN", "Lebanon"),
LS("LS", "LSO", "Lesotho"),
LR("LR", "LBR", "Liberia"),
LY("LY", "LBY", "Libya"),
LI("LI", "LIE", "Liechtenstein"),
LT("LT", "LTU", "Lithuania"),
LU("LU", "LUX", "Luxembourg"),
MO("MO", "MAC", "Macao"),
MG("MG", "MDG", "Madagascar"),
MW("MW", "MWI", "Malawi"),
MY("MY", "MYS", "Malaysia"),
MV("MV", "MDV", "Maldives"),
ML("ML", "MLI", "Mali"),
MT("MT", "MLT", "Malta"),
MH("MH", "MHL", "Marshall Islands (the)"),
MQ("MQ", "MTQ", "Martinique"),
MR("MR", "MRT", "Mauritania"),
MU("MU", "MUS", "Mauritius"),
YT("YT", "MYT", "Mayotte"),
MX("MX", "MEX", "Mexico"),
FM("FM", "FSM", "Micronesia (Federated States of)"),
MD("MD", "MDA", "Moldova (the Republic of)"),
MC("MC", "MCO", "Monaco"),
MN("MN", "MNG", "Mongolia"),
ME("ME", "MNE", "Montenegro"),
MS("MS", "MSR", "Montserrat"),
MA("MA", "MAR", "Morocco"),
MZ("MZ", "MOZ", "Mozambique"),
MM("MM", "MMR", "Myanmar"),
NA("NA", "NAM", "Namibia"),
NR("NR", "NRU", "Nauru"),
NP("NP", "NPL", "Nepal"),
NL("NL", "NLD", "Netherlands (the)"),
NC("NC", "NCL", "New Caledonia"),
NZ("NZ", "NZL", "New Zealand"),
NI("NI", "NIC", "Nicaragua"),
NE("NE", "NER", "Niger (the)"),
NG("NG", "NGA", "Nigeria"),
NU("NU", "NIU", "Niue"),
NF("NF", "NFK", "Norfolk Island"),
MK("MK", "MKD", "North Macedonia"),
MP("MP", "MNP", "Northern Mariana Islands (the)"),
NO("NO", "NOR", "Norway"),
OM("OM", "OMN", "Oman"),
PK("PK", "PAK", "Pakistan"),
PW("PW", "PLW", "Palau"),
PS("PS", "PSE", "Palestine, State of"),
PA("PA", "PAN", "Panama"),
PG("PG", "PNG", "Papua New Guinea"),
PY("PY", "PRY", "Paraguay"),
PE("PE", "PER", "Peru"),
PH("PH", "PHL", "Philippines (the)"),
PN("PN", "PCN", "Pitcairn"),
PL("PL", "POL", "Poland"),
PT("PT", "PRT", "Portugal"),
PR("PR", "PRI", "Puerto Rico"),
QA("QA", "QAT", "Qatar"),
RE("RE", "REU", "Réunion"),
RO("RO", "ROU", "Romania"),
RU("RU", "RUS", "Russian Federation (the)"),
RW("RW", "RWA", "Rwanda"),
BL("BL", "BLM", "Saint Barthélemy"),
SH("SH", "SHN", "Saint Helena, Ascension and Tristan da Cunha"),
KN("KN", "KNA", "Saint Kitts and Nevis"),
LC("LC", "LCA", "Saint Lucia"),
MF("MF", "MAF", "Saint Martin (French part)"),
PM("PM", "SPM", "Saint Pierre and Miquelon"),
VC("VC", "VCT", "Saint Vincent and the Grenadines"),
WS("WS", "WSM", "Samoa"),
SM("SM", "SMR", "San Marino"),
ST("ST", "STP", "Sao Tome and Principe"),
SA("SA", "SAU", "Saudi Arabia"),
SN("SN", "SEN", "Senegal"),
RS("RS", "SRB", "Serbia"),
SC("SC", "SYC", "Seychelles"),
SL("SL", "SLE", "Sierra Leone"),
SG("SG", "SGP", "Singapore"),
SX("SX", "SXM", "Sint Maarten (Dutch part)"),
SK("SK", "SVK", "Slovakia"),
SI("SI", "SVN", "Slovenia"),
SB("SB", "SLB", "Solomon Islands"),
SO("SO", "SOM", "Somalia"),
ZA("ZA", "ZAF", "South Africa"),
GS("GS", "SGS", "South Georgia and the South Sandwich Islands"),
SS("SS", "SSD", "South Sudan"),
ES("ES", "ESP", "Spain"),
LK("LK", "LKA", "Sri Lanka"),
SD("SD", "SDN", "Sudan (the)"),
SR("SR", "SUR", "Suriname"),
SJ("SJ", "SJM", "Svalbard and Jan Mayen"),
SE("SE", "SWE", "Sweden"),
CH("CH", "CHE", "Switzerland"),
SY("SY", "SYR", "Syrian Arab Republic (the)"),
TW("TW", "TWN", "Taiwan (Province of China)"),
TJ("TJ", "TJK", "Tajikistan"),
TZ("TZ", "TZA", "Tanzania, the United Republic of"),
TH("TH", "THA", "Thailand"),
TL("TL", "TLS", "Timor-Leste"),
TG("TG", "TGO", "Togo"),
TK("TK", "TKL", "Tokelau"),
TO("TO", "TON", "Tonga"),
TT("TT", "TTO", "Trinidad and Tobago"),
TN("TN", "TUN", "Tunisia"),
TR("TR", "TUR", "Türkiye"),
TM("TM", "TKM", "Turkmenistan"),
TC("TC", "TCA", "Turks and Caicos Islands (the)"),
TV("TV", "TUV", "Tuvalu"),
UG("UG", "UGA", "Uganda"),
UA("UA", "UKR", "Ukraine"),
AE("AE", "ARE", "United Arab Emirates (the)"),
GB("GB", "GBR", "United Kingdom of Great Britain and Northern Ireland (the)"),
UM("UM", "UMI", "United States Minor Outlying Islands (the)"),
US("US", "USA", "United States of America (the)"),
UY("UY", "URY", "Uruguay"),
UZ("UZ", "UZB", "Uzbekistan"),
VU("VU", "VUT", "Vanuatu"),
VE("VE", "VEN", "Venezuela (Bolivarian Republic of)"),
VN("VN", "VNM", "Viet Nam"),
VG("VG", "VGB", "Virgin Islands (British)"),
VI("VI", "VIR", "Virgin Islands (U.S.)"),
WF("WF", "WLF", "Wallis and Futuna"),
EH("EH", "ESH", "Western Sahara*"),
YE("YE", "YEM", "Yemen"),
ZM("ZM", "ZMB", "Zambia"),
ZW("ZW", "ZWE", "Zimbabwe"),
Afghanistan("AF", "AFG", "Afghanistan"),
AlandIslands("AX", "ALA", "Åland Islands"),
Albania("AL", "ALB", "Albania"),
Algeria("DZ", "DZA", "Algeria"),
AmericanSamoa("AS", "ASM", "American Samoa"),
Andorra("AD", "AND", "Andorra"),
Angola("AO", "AGO", "Angola"),
Anguilla("AI", "AIA", "Anguilla"),
Antarctica("AQ", "ATA", "Antarctica"),
AntiguaAndBarbuda("AG", "ATG", "Antigua and Barbuda"),
Argentina("AR", "ARG", "Argentina"),
Armenia("AM", "ARM", "Armenia"),
Aruba("AW", "ABW", "Aruba"),
Australia("AU", "AUS", "Australia"),
Austria("AT", "AUT", "Austria"),
Azerbaijan("AZ", "AZE", "Azerbaijan"),
Bahamas("BS", "BHS", "Bahamas (the)"),
Bahrain("BH", "BHR", "Bahrain"),
Bangladesh("BD", "BGD", "Bangladesh"),
Barbados("BB", "BRB", "Barbados"),
Belarus("BY", "BLR", "Belarus"),
Belgium("BE", "BEL", "Belgium"),
Belize("BZ", "BLZ", "Belize"),
Benin("BJ", "BEN", "Benin"),
Bermuda("BM", "BMU", "Bermuda"),
Bhutan("BT", "BTN", "Bhutan"),
Bolivia("BO", "BOL", "Bolivia (Plurinational State of)"),
CaribbeanNetherlands("BQ", "BES", "Bonaire, Sint Eustatius and Saba"),
BosniaAndHerzegovina("BA", "BIH", "Bosnia and Herzegovina"),
Botswana("BW", "BWA", "Botswana"),
BouvetIsland("BV", "BVT", "Bouvet Island"),
Brazil("BR", "BRA", "Brazil"),
BritishIndianOceanTerritory("IO", "IOT", "British Indian Ocean Territory (the)"),
Brunei("BN", "BRN", "Brunei Darussalam"),
Bulgaria("BG", "BGR", "Bulgaria"),
BurkinaFaso("BF", "BFA", "Burkina Faso"),
Burundi("BI", "BDI", "Burundi"),
CapeVerde("CV", "CPV", "Cabo Verde"),
Cambodia("KH", "KHM", "Cambodia"),
Cameroon("CM", "CMR", "Cameroon"),
Canada("CA", "CAN", "Canada"),
CaymanIslands("KY", "CYM", "Cayman Islands (the)"),
CentralAfricanRepublic("CF", "CAF", "Central African Republic (the)"),
Chad("TD", "TCD", "Chad"),
Chile("CL", "CHL", "Chile"),
China("CN", "CHN", "China"),
ChristmasIsland("CX", "CXR", "Christmas Island"),
CocosKeelingIslands("CC", "CCK", "Cocos (Keeling) Islands (the)"),
Colombia("CO", "COL", "Colombia"),
Comoros("KM", "COM", "Comoros (the)"),
CongoDemocraticRepublic("CD", "COD", "Congo (the Democratic Republic of the)"),
Congo("CG", "COG", "Congo (the)"),
CookIslands("CK", "COK", "Cook Islands (the)"),
CostaRica("CR", "CRI", "Costa Rica"),
CoteDIvoire("CI", "CIV", "Côte d'Ivoire"),
Croatia("HR", "HRV", "Croatia"),
Cuba("CU", "CUB", "Cuba"),
Curacao("CW", "CUW", "Curaçao"),
Cyprus("CY", "CYP", "Cyprus"),
Czechia("CZ", "CZE", "Czechia"),
Denmark("DK", "DNK", "Denmark"),
Djibouti("DJ", "DJI", "Djibouti"),
Dominica("DM", "DMA", "Dominica"),
DominicanRepublic("DO", "DOM", "Dominican Republic (the)"),
Ecuador("EC", "ECU", "Ecuador"),
Egypt("EG", "EGY", "Egypt"),
ElSalvador("SV", "SLV", "El Salvador"),
EquatorialGuinea("GQ", "GNQ", "Equatorial Guinea"),
Eritrea("ER", "ERI", "Eritrea"),
Estonia("EE", "EST", "Estonia"),
Eswatini("SZ", "SWZ", "Eswatini"),
Ethiopia("ET", "ETH", "Ethiopia"),
FalklandIslands("FK", "FLK", "Falkland Islands (the) [Malvinas]"),
FaroeIslands("FO", "FRO", "Faroe Islands (the)"),
Fiji("FJ", "FJI", "Fiji"),
Finland("FI", "FIN", "Finland"),
France("FR", "FRA", "France"),
FrenchGuiana("GF", "GUF", "French Guiana"),
FrenchPolynesia("PF", "PYF", "French Polynesia"),
FrenchSouthernTerritories("TF", "ATF", "French Southern Territories (the)"),
Gabon("GA", "GAB", "Gabon"),
Gambia("GM", "GMB", "Gambia (the)"),
Georgia("GE", "GEO", "Georgia"),
Germany("DE", "DEU", "Germany"),
Ghana("GH", "GHA", "Ghana"),
Gibraltar("GI", "GIB", "Gibraltar"),
Greece("GR", "GRC", "Greece"),
Greenland("GL", "GRL", "Greenland"),
Grenada("GD", "GRD", "Grenada"),
Guadeloupe("GP", "GLP", "Guadeloupe"),
Guam("GU", "GUM", "Guam"),
Guatemala("GT", "GTM", "Guatemala"),
Guernsey("GG", "GGY", "Guernsey"),
Guinea("GN", "GIN", "Guinea"),
GuineaBissau("GW", "GNB", "Guinea-Bissau"),
Guyana("GY", "GUY", "Guyana"),
Haiti("HT", "HTI", "Haiti"),
HeardAndMcDonaldIslands("HM", "HMD", "Heard Island and McDonald Islands"),
VaticanCity("VA", "VAT", "Holy See (the)"),
Honduras("HN", "HND", "Honduras"),
HongKong("HK", "HKG", "Hong Kong"),
Hungary("HU", "HUN", "Hungary"),
Iceland("IS", "ISL", "Iceland"),
India("IN", "IND", "India"),
Indonesia("ID", "IDN", "Indonesia"),
Iran("IR", "IRN", "Iran (Islamic Republic of)"),
Iraq("IQ", "IRQ", "Iraq"),
Ireland("IE", "IRL", "Ireland"),
IsleOfMan("IM", "IMN", "Isle of Man"),
Israel("IL", "ISR", "Israel"),
Italy("IT", "ITA", "Italy"),
Jamaica("JM", "JAM", "Jamaica"),
Japan("JP", "JPN", "Japan"),
Jersey("JE", "JEY", "Jersey"),
Jordan("JO", "JOR", "Jordan"),
Kazakhstan("KZ", "KAZ", "Kazakhstan"),
Kenya("KE", "KEN", "Kenya"),
Kiribati("KI", "KIR", "Kiribati"),
NorthKorea("KP", "PRK", "Korea (the Democratic People's Republic of)"),
SouthKorea("KR", "KOR", "Korea (the Republic of)"),
Kuwait("KW", "KWT", "Kuwait"),
Kyrgyzstan("KG", "KGZ", "Kyrgyzstan"),
Laos("LA", "LAO", "Lao People's Democratic Republic (the)"),
Latvia("LV", "LVA", "Latvia"),
Lebanon("LB", "LBN", "Lebanon"),
Lesotho("LS", "LSO", "Lesotho"),
Liberia("LR", "LBR", "Liberia"),
Libya("LY", "LBY", "Libya"),
Liechtenstein("LI", "LIE", "Liechtenstein"),
Lithuania("LT", "LTU", "Lithuania"),
Luxembourg("LU", "LUX", "Luxembourg"),
Macao("MO", "MAC", "Macao"),
Madagascar("MG", "MDG", "Madagascar"),
Malawi("MW", "MWI", "Malawi"),
Malaysia("MY", "MYS", "Malaysia"),
Maldives("MV", "MDV", "Maldives"),
Mali("ML", "MLI", "Mali"),
Malta("MT", "MLT", "Malta"),
MarshallIslands("MH", "MHL", "Marshall Islands (the)"),
Martinique("MQ", "MTQ", "Martinique"),
Mauritania("MR", "MRT", "Mauritania"),
Mauritius("MU", "MUS", "Mauritius"),
Mayotte("YT", "MYT", "Mayotte"),
Mexico("MX", "MEX", "Mexico"),
Micronesia("FM", "FSM", "Micronesia (Federated States of)"),
Moldova("MD", "MDA", "Moldova (the Republic of)"),
Monaco("MC", "MCO", "Monaco"),
Mongolia("MN", "MNG", "Mongolia"),
Montenegro("ME", "MNE", "Montenegro"),
Montserrat("MS", "MSR", "Montserrat"),
Morocco("MA", "MAR", "Morocco"),
Mozambique("MZ", "MOZ", "Mozambique"),
MyanmarBurma("MM", "MMR", "Myanmar"),
Namibia("NA", "NAM", "Namibia"),
Nauru("NR", "NRU", "Nauru"),
Nepal("NP", "NPL", "Nepal"),
Netherlands("NL", "NLD", "Netherlands (the)"),
NewCaledonia("NC", "NCL", "New Caledonia"),
NewZealand("NZ", "NZL", "New Zealand"),
Nicaragua("NI", "NIC", "Nicaragua"),
Niger("NE", "NER", "Niger (the)"),
Nigeria("NG", "NGA", "Nigeria"),
Niue("NU", "NIU", "Niue"),
NorfolkIsland("NF", "NFK", "Norfolk Island"),
NorthMacedonia("MK", "MKD", "North Macedonia"),
NorthernMarianaIslands("MP", "MNP", "Northern Mariana Islands (the)"),
Norway("NO", "NOR", "Norway"),
Oman("OM", "OMN", "Oman"),
Pakistan("PK", "PAK", "Pakistan"),
Palau("PW", "PLW", "Palau"),
Palestine("PS", "PSE", "Palestine, State of"),
Panama("PA", "PAN", "Panama"),
PapuaNewGuinea("PG", "PNG", "Papua New Guinea"),
Paraguay("PY", "PRY", "Paraguay"),
Peru("PE", "PER", "Peru"),
Philippines("PH", "PHL", "Philippines (the)"),
PitcairnIslands("PN", "PCN", "Pitcairn"),
Poland("PL", "POL", "Poland"),
Portugal("PT", "PRT", "Portugal"),
PuertoRico("PR", "PRI", "Puerto Rico"),
Qatar("QA", "QAT", "Qatar"),
Reunion("RE", "REU", "Réunion"),
Romania("RO", "ROU", "Romania"),
Russia("RU", "RUS", "Russian Federation (the)"),
Rwanda("RW", "RWA", "Rwanda"),
SaintBarthelemy("BL", "BLM", "Saint Barthélemy"),
SaintHelena("SH", "SHN", "Saint Helena, Ascension and Tristan da Cunha"),
SaintKittsAndNevis("KN", "KNA", "Saint Kitts and Nevis"),
SaintLucia("LC", "LCA", "Saint Lucia"),
SaintMartin("MF", "MAF", "Saint Martin (French part)"),
SaintPierreAndMiquelon("PM", "SPM", "Saint Pierre and Miquelon"),
SaintVincentAndGrenadines("VC", "VCT", "Saint Vincent and the Grenadines"),
Samoa("WS", "WSM", "Samoa"),
SanMarino("SM", "SMR", "San Marino"),
SaoTomeAndPrincipe("ST", "STP", "Sao Tome and Principe"),
SaudiArabia("SA", "SAU", "Saudi Arabia"),
Senegal("SN", "SEN", "Senegal"),
Serbia("RS", "SRB", "Serbia"),
Seychelles("SC", "SYC", "Seychelles"),
SierraLeone("SL", "SLE", "Sierra Leone"),
Singapore("SG", "SGP", "Singapore"),
SintMaarten("SX", "SXM", "Sint Maarten (Dutch part)"),
Slovakia("SK", "SVK", "Slovakia"),
Slovenia("SI", "SVN", "Slovenia"),
SolomonIslands("SB", "SLB", "Solomon Islands"),
Somalia("SO", "SOM", "Somalia"),
SouthAfrica("ZA", "ZAF", "South Africa"),
SouthGeorgiaAndSouthSandwichIslands("GS", "SGS", "South Georgia and the South Sandwich Islands"),
SouthSudan("SS", "SSD", "South Sudan"),
Spain("ES", "ESP", "Spain"),
SriLanka("LK", "LKA", "Sri Lanka"),
Sudan("SD", "SDN", "Sudan (the)"),
Suriname("SR", "SUR", "Suriname"),
SvalbardAndJanMayen("SJ", "SJM", "Svalbard and Jan Mayen"),
Sweden("SE", "SWE", "Sweden"),
Switzerland("CH", "CHE", "Switzerland"),
Syria("SY", "SYR", "Syrian Arab Republic (the)"),
Taiwan("TW", "TWN", "Taiwan (Province of China)"),
Tajikistan("TJ", "TJK", "Tajikistan"),
Tanzania("TZ", "TZA", "Tanzania, the United Republic of"),
Thailand("TH", "THA", "Thailand"),
TimorLeste("TL", "TLS", "Timor-Leste"),
Togo("TG", "TGO", "Togo"),
Tokelau("TK", "TKL", "Tokelau"),
Tonga("TO", "TON", "Tonga"),
TrinidadAndTobago("TT", "TTO", "Trinidad and Tobago"),
Tunisia("TN", "TUN", "Tunisia"),
Turkiye("TR", "TUR", "Türkiye"),
Turkmenistan("TM", "TKM", "Turkmenistan"),
TurksAndCaicosIslands("TC", "TCA", "Turks and Caicos Islands (the)"),
Tuvalu("TV", "TUV", "Tuvalu"),
Uganda("UG", "UGA", "Uganda"),
Ukraine("UA", "UKR", "Ukraine"),
UnitedArabEmirates("AE", "ARE", "United Arab Emirates (the)"),
UnitedKingdom("GB", "GBR", "United Kingdom of Great Britain and Northern Ireland (the)"),
USOutlyingIslands("UM", "UMI", "United States Minor Outlying Islands (the)"),
UnitedStates("US", "USA", "United States of America (the)"),
Uruguay("UY", "URY", "Uruguay"),
Uzbekistan("UZ", "UZB", "Uzbekistan"),
Vanuatu("VU", "VUT", "Vanuatu"),
Venezuela("VE", "VEN", "Venezuela (Bolivarian Republic of)"),
Vietnam("VN", "VNM", "Viet Nam"),
BritishVirginIslands("VG", "VGB", "Virgin Islands (British)"),
USVirginIslands("VI", "VIR", "Virgin Islands (U.S.)"),
WallisAndFutuna("WF", "WLF", "Wallis and Futuna"),
WesternSahara("EH", "ESH", "Western Sahara*"),
Yemen("YE", "YEM", "Yemen"),
Zambia("ZM", "ZMB", "Zambia"),
Zimbabwe("ZW", "ZWE", "Zimbabwe"),
_1A("1A", null, "Kosovo"),
XI("XI", null, "United Kingdom (Northern Ireland)"),
}

View File

@ -1,5 +1,6 @@
package net.codinux.invoicing.parser
import net.codinux.i18n.Region
import net.codinux.invoicing.model.codes.InvoiceTypeUseFor
import net.codinux.invoicing.parser.genericode.CodeList
import net.codinux.invoicing.parser.model.CodeListType
@ -11,6 +12,8 @@ import java.util.Currency
class CodeGenerator {
companion object {
private val i18nRegionsByCode = Region.entries.associateBy { it.code }
private val i18nCurrenciesByCode = net.codinux.i18n.Currency.entries.associateBy { it.alpha3Code }
}
@ -194,9 +197,9 @@ class CodeGenerator {
else if (firstColumn == "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") return "ExcelSpreadsheet"
else if (firstColumn == "application/vnd.oasis.opendocument.spreadsheet") return "OpenDocumentSpreadsheet"
val column = if (type == CodeListType.IsoCurrencyCodes) i18nCurrenciesByCode[firstColumn]?.name ?: fixCurrencyName(row[2]) // as fallback use currency's English name from Zugferd list
val column = if (type == CodeListType.IsoCountryCodes) i18nRegionsByCode[firstColumn]?.name ?: firstColumn
else if (type == CodeListType.IsoCurrencyCodes) i18nCurrenciesByCode[firstColumn]?.name ?: fixCurrencyName(row[2]) // as fallback use currency's English name from Zugferd list
else if (columns.first().name == "Scheme ID") row[1] // ISO 6523 Scheme Identifier codes
else if (columns.first().name == "English Name") row[1] // Country codes
else row[0] // default case: the code is in the first column
val name = (column?.toString() ?: "").replace(' ', '_').replace('/', '_').replace('.', '_').replace(',', '_')