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, val additionalAddressLine: String? = null,
var postalCode: String?, var postalCode: String?,
val city: String, val city: String,
val country: Country = Country.DE, val country: Country = Country.Germany,
val vatId: String? = null, val vatId: String? = null,

View File

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

View File

@ -1,5 +1,6 @@
package net.codinux.invoicing.parser package net.codinux.invoicing.parser
import net.codinux.i18n.Region
import net.codinux.invoicing.model.codes.InvoiceTypeUseFor import net.codinux.invoicing.model.codes.InvoiceTypeUseFor
import net.codinux.invoicing.parser.genericode.CodeList import net.codinux.invoicing.parser.genericode.CodeList
import net.codinux.invoicing.parser.model.CodeListType import net.codinux.invoicing.parser.model.CodeListType
@ -11,6 +12,8 @@ import java.util.Currency
class CodeGenerator { class CodeGenerator {
companion object { companion object {
private val i18nRegionsByCode = Region.entries.associateBy { it.code }
private val i18nCurrenciesByCode = net.codinux.i18n.Currency.entries.associateBy { it.alpha3Code } 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.openxmlformats-officedocument.spreadsheetml.sheet") return "ExcelSpreadsheet"
else if (firstColumn == "application/vnd.oasis.opendocument.spreadsheet") return "OpenDocumentSpreadsheet" 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 == "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 else row[0] // default case: the code is in the first column
val name = (column?.toString() ?: "").replace(' ', '_').replace('/', '_').replace('.', '_').replace(',', '_') val name = (column?.toString() ?: "").replace(' ', '_').replace('/', '_').replace('.', '_').replace(',', '_')