Fixing name for the few currencies not known to k-i18n Currency

This commit is contained in:
dankito 2024-12-12 22:19:51 +01:00
parent af7260db70
commit cef6565053
2 changed files with 18 additions and 12 deletions

View File

@ -6,7 +6,7 @@ enum class Currency(val alpha3Code: String, val currencySymbol: String?, val eng
Lek("ALL", "ALL", "Lek", setOf("ALBANIA"), false), Lek("ALL", "ALL", "Lek", setOf("ALBANIA"), false),
ArmenianDram("AMD", "AMD", "Armenian Dram", setOf("ARMENIA"), false), ArmenianDram("AMD", "AMD", "Armenian Dram", setOf("ARMENIA"), false),
NetherlandsAntilleanGuilder("ANG", "ANG", "Netherlands Antillean Guilder", setOf("CURAÇAO", "SINT MAARTEN (DUTCH PART)"), false), NetherlandsAntilleanGuilder("ANG", "ANG", "Netherlands Antillean Guilder", setOf("CURAÇAO", "SINT MAARTEN (DUTCH PART)"), false),
AOA("AOA", "AOA", "Kwanza", setOf("ANGOLA"), false), Kwanza("AOA", "AOA", "Kwanza", setOf("ANGOLA"), false),
ArgentinePeso("ARS", "ARS", "Argentine Peso", setOf("ARGENTINA"), false), ArgentinePeso("ARS", "ARS", "Argentine Peso", setOf("ARGENTINA"), false),
AustralianDollar("AUD", "A$", "Australian Dollar", setOf("AUSTRALIA", "CHRISTMAS ISLAND", "COCOS (KEELING) ISLANDS (THE)", "HEARD ISLAND AND McDONALD ISLANDS", "KIRIBATI", "NAURU", "NORFOLK ISLAND", "TUVALU"), false), AustralianDollar("AUD", "A$", "Australian Dollar", setOf("AUSTRALIA", "CHRISTMAS ISLAND", "COCOS (KEELING) ISLANDS (THE)", "HEARD ISLAND AND McDONALD ISLANDS", "KIRIBATI", "NAURU", "NORFOLK ISLAND", "TUVALU"), false),
ArubanFlorin("AWG", "AWG", "Aruban Florin", setOf("ARUBA"), false), ArubanFlorin("AWG", "AWG", "Aruban Florin", setOf("ARUBA"), false),
@ -25,7 +25,7 @@ enum class Currency(val alpha3Code: String, val currencySymbol: String?, val eng
BahamianDollar("BSD", "BSD", "Bahamian Dollar", setOf("BAHAMAS (THE)"), false), BahamianDollar("BSD", "BSD", "Bahamian Dollar", setOf("BAHAMAS (THE)"), false),
Ngultrum("BTN", "BTN", "Ngultrum", setOf("BHUTAN"), false), Ngultrum("BTN", "BTN", "Ngultrum", setOf("BHUTAN"), false),
Pula("BWP", "BWP", "Pula", setOf("BOTSWANA"), false), Pula("BWP", "BWP", "Pula", setOf("BOTSWANA"), false),
BYN("BYN", "BYN", "Belarusian Ruble", setOf("BELARUS"), false), BelarusianRuble("BYN", "BYN", "Belarusian Ruble", setOf("BELARUS"), false),
BelizeDollar("BZD", "BZD", "Belize Dollar", setOf("BELIZE"), false), BelizeDollar("BZD", "BZD", "Belize Dollar", setOf("BELIZE"), false),
CanadianDollar("CAD", "CA$", "Canadian Dollar", setOf("CANADA"), false), CanadianDollar("CAD", "CA$", "Canadian Dollar", setOf("CANADA"), false),
CongoleseFranc("CDF", "CDF", "Congolese Franc", setOf("CONGO (THE DEMOCRATIC REPUBLIC OF THE)"), false), CongoleseFranc("CDF", "CDF", "Congolese Franc", setOf("CONGO (THE DEMOCRATIC REPUBLIC OF THE)"), false),
@ -86,7 +86,7 @@ enum class Currency(val alpha3Code: String, val currencySymbol: String?, val eng
LebanesePound("LBP", "LBP", "Lebanese Pound", setOf("LEBANON"), false), LebanesePound("LBP", "LBP", "Lebanese Pound", setOf("LEBANON"), false),
SriLankaRupee("LKR", "LKR", "Sri Lanka Rupee", setOf("SRI LANKA"), false), SriLankaRupee("LKR", "LKR", "Sri Lanka Rupee", setOf("SRI LANKA"), false),
LiberianDollar("LRD", "LRD", "Liberian Dollar", setOf("LIBERIA"), false), LiberianDollar("LRD", "LRD", "Liberian Dollar", setOf("LIBERIA"), false),
LSL("LSL", "LSL", "Loti", setOf("LESOTHO"), false), Loti("LSL", "LSL", "Loti", setOf("LESOTHO"), false),
LibyanDinar("LYD", "LYD", "Libyan Dinar", setOf("LIBYA"), false), LibyanDinar("LYD", "LYD", "Libyan Dinar", setOf("LIBYA"), false),
MoroccanDirham("MAD", "MAD", "Moroccan Dirham", setOf("MOROCCO", "WESTERN SAHARA"), false), MoroccanDirham("MAD", "MAD", "Moroccan Dirham", setOf("MOROCCO", "WESTERN SAHARA"), false),
MoldovanLeu("MDL", "MDL", "Moldovan Leu", setOf("MOLDOVA (THE REPUBLIC OF)"), false), MoldovanLeu("MDL", "MDL", "Moldovan Leu", setOf("MOLDOVA (THE REPUBLIC OF)"), false),
@ -99,7 +99,7 @@ enum class Currency(val alpha3Code: String, val currencySymbol: String?, val eng
MauritiusRupee("MUR", "MUR", "Mauritius Rupee", setOf("MAURITIUS"), false), MauritiusRupee("MUR", "MUR", "Mauritius Rupee", setOf("MAURITIUS"), false),
Rufiyaa("MVR", "MVR", "Rufiyaa", setOf("MALDIVES"), false), Rufiyaa("MVR", "MVR", "Rufiyaa", setOf("MALDIVES"), false),
MalawiKwacha("MWK", "MWK", "Malawi Kwacha", setOf("MALAWI"), false), MalawiKwacha("MWK", "MWK", "Malawi Kwacha", setOf("MALAWI"), false),
MXN("MXN", "MX$", "Mexican Peso", setOf("MEXICO"), false), MexicanPeso("MXN", "MX$", "Mexican Peso", setOf("MEXICO"), false),
MexicanUnidadDeInversionUDI("MXV", "MXV", "Mexican Unidad de Inversion (UDI)", setOf("MEXICO"), false), MexicanUnidadDeInversionUDI("MXV", "MXV", "Mexican Unidad de Inversion (UDI)", setOf("MEXICO"), false),
MalaysianRinggit("MYR", "MYR", "Malaysian Ringgit", setOf("MALAYSIA"), false), MalaysianRinggit("MYR", "MYR", "Malaysian Ringgit", setOf("MALAYSIA"), false),
MozambiqueMetical("MZN", "MZN", "Mozambique Metical", setOf("MOZAMBIQUE"), false), MozambiqueMetical("MZN", "MZN", "Mozambique Metical", setOf("MOZAMBIQUE"), false),
@ -111,25 +111,25 @@ enum class Currency(val alpha3Code: String, val currencySymbol: String?, val eng
NewZealandDollar("NZD", "NZ$", "New Zealand Dollar", setOf("COOK ISLANDS (THE)", "NEW ZEALAND", "NIUE", "PITCAIRN", "TOKELAU"), false), NewZealandDollar("NZD", "NZ$", "New Zealand Dollar", setOf("COOK ISLANDS (THE)", "NEW ZEALAND", "NIUE", "PITCAIRN", "TOKELAU"), false),
RialOmani("OMR", "OMR", "Rial Omani", setOf("OMAN"), false), RialOmani("OMR", "OMR", "Rial Omani", setOf("OMAN"), false),
Balboa("PAB", "PAB", "Balboa", setOf("PANAMA"), false), Balboa("PAB", "PAB", "Balboa", setOf("PANAMA"), false),
PEN("PEN", "PEN", "Sol", setOf("PERU"), false), Sol("PEN", "PEN", "Sol", setOf("PERU"), false),
Kina("PGK", "PGK", "Kina", setOf("PAPUA NEW GUINEA"), false), Kina("PGK", "PGK", "Kina", setOf("PAPUA NEW GUINEA"), false),
PhilippinePeso("PHP", "", "Philippine Peso", setOf("PHILIPPINES (THE)"), false), PhilippinePeso("PHP", "", "Philippine Peso", setOf("PHILIPPINES (THE)"), false),
PakistanRupee("PKR", "PKR", "Pakistan Rupee", setOf("PAKISTAN"), false), PakistanRupee("PKR", "PKR", "Pakistan Rupee", setOf("PAKISTAN"), false),
PLN("PLN", "PLN", "Zloty", setOf("POLAND"), true), Zloty("PLN", "PLN", "Zloty", setOf("POLAND"), true),
Guarani("PYG", "PYG", "Guarani", setOf("PARAGUAY"), false), Guarani("PYG", "PYG", "Guarani", setOf("PARAGUAY"), false),
QatariRial("QAR", "QAR", "Qatari Rial", setOf("QATAR"), false), QatariRial("QAR", "QAR", "Qatari Rial", setOf("QATAR"), false),
RomanianLeu("RON", "RON", "Romanian Leu", setOf("ROMANIA"), false), RomanianLeu("RON", "RON", "Romanian Leu", setOf("ROMANIA"), false),
SerbianDinar("RSD", "RSD", "Serbian Dinar", setOf("SERBIA"), false), SerbianDinar("RSD", "RSD", "Serbian Dinar", setOf("SERBIA"), false),
RUB("RUB", "RUB", "Russian Ruble", setOf("RUSSIAN FEDERATION (THE)"), false), RussianRuble("RUB", "RUB", "Russian Ruble", setOf("RUSSIAN FEDERATION (THE)"), false),
RwandaFranc("RWF", "RWF", "Rwanda Franc", setOf("RWANDA"), false), RwandaFranc("RWF", "RWF", "Rwanda Franc", setOf("RWANDA"), false),
SaudiRiyal("SAR", "SAR", "Saudi Riyal", setOf("SAUDI ARABIA"), false), SaudiRiyal("SAR", "SAR", "Saudi Riyal", setOf("SAUDI ARABIA"), false),
SolomonIslandsDollar("SBD", "SBD", "Solomon Islands Dollar", setOf("SOLOMON ISLANDS"), false), SolomonIslandsDollar("SBD", "SBD", "Solomon Islands Dollar", setOf("SOLOMON ISLANDS"), false),
SeychellesRupee("SCR", "SCR", "Seychelles Rupee", setOf("SEYCHELLES"), false), SeychellesRupee("SCR", "SCR", "Seychelles Rupee", setOf("SEYCHELLES"), false),
SDG("SDG", "SDG", "Sudanese Pound", setOf("SUDAN (THE)"), false), SudanesePound("SDG", "SDG", "Sudanese Pound", setOf("SUDAN (THE)"), false),
SwedishKrona("SEK", "SEK", "Swedish Krona", setOf("SWEDEN"), true), SwedishKrona("SEK", "SEK", "Swedish Krona", setOf("SWEDEN"), true),
SingaporeDollar("SGD", "SGD", "Singapore Dollar", setOf("SINGAPORE"), false), SingaporeDollar("SGD", "SGD", "Singapore Dollar", setOf("SINGAPORE"), false),
SaintHelenaPound("SHP", "SHP", "Saint Helena Pound", setOf("SAINT HELENA, ASCENSION AND TRISTAN DA CUNHA"), false), SaintHelenaPound("SHP", "SHP", "Saint Helena Pound", setOf("SAINT HELENA, ASCENSION AND TRISTAN DA CUNHA"), false),
SLE("SLE", "SLE", "Sierra Leone (new valuation 2022)", setOf("SIERRA LEONE (new valuation 2022)"), false), SierraLeone_NewValuation2022("SLE", "SLE", "Sierra Leone (new valuation 2022)", setOf("SIERRA LEONE (new valuation 2022)"), false),
SomaliShilling("SOS", "SOS", "Somali Shilling", setOf("SOMALIA"), false), SomaliShilling("SOS", "SOS", "Somali Shilling", setOf("SOMALIA"), false),
SurinamDollar("SRD", "SRD", "Surinam Dollar", setOf("SURINAME"), false), SurinamDollar("SRD", "SRD", "Surinam Dollar", setOf("SURINAME"), false),
SouthSudanesePound("SSP", "SSP", "South Sudanese Pound", setOf("SOUTH SUDAN"), false), SouthSudanesePound("SSP", "SSP", "South Sudanese Pound", setOf("SOUTH SUDAN"), false),
@ -154,7 +154,7 @@ enum class Currency(val alpha3Code: String, val currencySymbol: String?, val eng
PesoUruguayo("UYU", "UYU", "Peso Uruguayo", setOf("URUGUAY"), false), PesoUruguayo("UYU", "UYU", "Peso Uruguayo", setOf("URUGUAY"), false),
UnidadPrevisional("UYW", null, "Unidad Previsional", setOf("URUGUAY"), false), UnidadPrevisional("UYW", null, "Unidad Previsional", setOf("URUGUAY"), false),
UzbekistanSum("UZS", "UZS", "Uzbekistan Sum", setOf("UZBEKISTAN"), false), UzbekistanSum("UZS", "UZS", "Uzbekistan Sum", setOf("UZBEKISTAN"), false),
VED("VED", "VED", "Bolívar Soberano, new valuation", emptySet(), false), BolivarSoberano_NewValuation("VED", "VED", "Bolívar Soberano, new valuation", emptySet(), false),
BolivarSoberano("VES", "VES", "Bolívar Soberano", setOf("VENEZUELA (BOLIVARIAN REPUBLIC OF)"), false), BolivarSoberano("VES", "VES", "Bolívar Soberano", setOf("VENEZUELA (BOLIVARIAN REPUBLIC OF)"), false),
Dong("VND", "", "Dong", setOf("VIET NAM"), false), Dong("VND", "", "Dong", setOf("VIET NAM"), false),
Vatu("VUV", "VUV", "Vatu", setOf("VANUATU"), false), Vatu("VUV", "VUV", "Vatu", setOf("VANUATU"), false),
@ -180,5 +180,5 @@ enum class Currency(val alpha3Code: String, val currencySymbol: String?, val eng
Rand("ZAR", "ZAR", "Rand", setOf("LESOTHO", "NAMIBIA", "SOUTH AFRICA"), false), Rand("ZAR", "ZAR", "Rand", setOf("LESOTHO", "NAMIBIA", "SOUTH AFRICA"), false),
ZambianKwacha("ZMW", "ZMW", "Zambian Kwacha", setOf("ZAMBIA"), false), ZambianKwacha("ZMW", "ZMW", "Zambian Kwacha", setOf("ZAMBIA"), false),
ZimbabweGold("ZWG", null, "Zimbabwe Gold", emptySet(), false), ZimbabweGold("ZWG", null, "Zimbabwe Gold", emptySet(), false),
ZWL("ZWL", "ZWL", "Zimbabwe Dollar", setOf("ZIMBABWE"), false), ZimbabweDollar("ZWL", "ZWL", "Zimbabwe Dollar", setOf("ZIMBABWE"), false),
} }

View File

@ -194,7 +194,7 @@ 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 ?: row[2] // as fallback use currency's English name from Zugferd list val column = 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 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
@ -208,4 +208,10 @@ class CodeGenerator {
else name else name
} }
private fun fixCurrencyName(currencyName: Any?): String = when (currencyName) {
"Sierra Leone (new valuation 2022)" -> "SierraLeone_NewValuation2022"
"Bolívar Soberano, new valuation" -> "BolivarSoberano_NewValuation"
else -> currencyName.toString().replace(" ", "")
}
} }