From 37f07ad23744c1fd70f9b06225fce9ba9c67af65 Mon Sep 17 00:00:00 2001 From: alegos27 Date: Fri, 17 Feb 2023 17:07:22 +0100 Subject: [PATCH 1/2] Added support for Italian language --- lib/src/country_localizations.dart | 17 +- lib/src/res/strings/it.dart | 250 +++++++++++++++++++++++++++++ 2 files changed, 259 insertions(+), 8 deletions(-) create mode 100644 lib/src/res/strings/it.dart diff --git a/lib/src/country_localizations.dart b/lib/src/country_localizations.dart index 96d8e07..126fcb9 100644 --- a/lib/src/country_localizations.dart +++ b/lib/src/country_localizations.dart @@ -9,8 +9,12 @@ import 'res/strings/et.dart'; import 'res/strings/fr.dart'; import 'res/strings/gr.dart'; import 'res/strings/hr.dart'; +import 'res/strings/it.dart'; import 'res/strings/ku.dart'; +import 'res/strings/lt.dart'; +import 'res/strings/lv.dart'; import 'res/strings/nb.dart'; +import 'res/strings/nl.dart'; import 'res/strings/nn.dart'; import 'res/strings/np.dart'; import 'res/strings/pl.dart'; @@ -19,9 +23,6 @@ import 'res/strings/ru.dart'; import 'res/strings/tr.dart'; import 'res/strings/tw.dart'; import 'res/strings/uk.dart'; -import 'res/strings/lv.dart'; -import 'res/strings/lt.dart'; -import 'res/strings/nl.dart'; class CountryLocalizations { final Locale locale; @@ -49,8 +50,7 @@ class CountryLocalizations { /// A [LocalizationsDelegate] that uses [_CountryLocalizationsDelegate.load] /// to create an instance of this class. - static const LocalizationsDelegate delegate = - _CountryLocalizationsDelegate(); + static const LocalizationsDelegate delegate = _CountryLocalizationsDelegate(); /// The localized country name for the given country code. String? countryName({required String countryCode}) { @@ -102,7 +102,8 @@ class CountryLocalizations { return lt[countryCode]; case 'nl': return nl[countryCode]; - + case 'it': + return it[countryCode]; case 'en': default: return en[countryCode]; @@ -110,8 +111,7 @@ class CountryLocalizations { } } -class _CountryLocalizationsDelegate - extends LocalizationsDelegate { +class _CountryLocalizationsDelegate extends LocalizationsDelegate { const _CountryLocalizationsDelegate(); @override @@ -139,6 +139,7 @@ class _CountryLocalizationsDelegate 'lt', 'lv', 'nl', + 'it', ].contains(locale.languageCode); } diff --git a/lib/src/res/strings/it.dart b/lib/src/res/strings/it.dart new file mode 100644 index 0000000..17f64fb --- /dev/null +++ b/lib/src/res/strings/it.dart @@ -0,0 +1,250 @@ +Map it = { + "AF": "Afghanistan", + "AX": "Isole Aland", + "AL": "Albania", + "DZ": "Algeria", + "AS": "Samoa americane", + "AD": "Andorra", + "AO": "Angola", + "AI": "Anguilla", + "AG": "Antigua e Barbuda", + "AR": "Argentina", + "AM": "Armenia", + "AW": "Aruba", + "AC": "Isola di Ascensione", + "AU": "Australia", + "AT": "Austria", + "AZ": "Azerbaigian", + "BS": "Bahamas", + "BH": "Bahrein", + "BD": "Bangladesh", + "BB": "Barbados", + "BY": "Bielorussia", + "BE": "Belgio", + "BZ": "Belize", + "BJ": "Benin", + "BM": "Bermuda", + "BT": "Bhutan", + "BO": "Bolivia", + "BA": "Bosnia ed Erzegovina", + "BW": "Botswana", + "BR": "Brasile", + "IO": "Territorio britannico dell'oceano Indiano", + "VG": "Isole Vergini britanniche", + "BN": "Brunei", + "BG": "Bulgaria", + "BF": "Burkina Faso", + "BI": "Burundi", + "KH": "Cambogia", + "CM": "Camerun", + "CA": "Canada", + "CV": "Capo Verde", + "BQ": "Paesi Bassi caraibici", + "KY": "Isole Cayman", + "CF": "Repubblica Centrafricana", + "TD": "Ciad", + "CL": "Cile", + "CN": "Cina", + "CX": "Isola di Natale", + "CC": "Isole Cocos [Keeling]", + "CO": "Colombia", + "KM": "Comore", + "CD": "Repubblica Democratica del Congo", + "CG": "Congo", + "CK": "Isole Cook", + "CR": "Costa Rica", + "CI": "Costa d'Avorio", + "HR": "Croazia", + "CU": "Cuba", + "CW": "Curaçao", + "CY": "Cipro", + "CZ": "Repubblica Ceca", + "DK": "Danimarca", + "DJ": "Gibuti", + "DM": "Dominica", + "DO": "Repubblica Dominicana", + "TL": "Timor Est", + "EC": "Ecuador", + "EG": "Egitto", + "SV": "El Salvador", + "GQ": "Guinea Equatoriale", + "ER": "Eritrea", + "EE": "Estonia", + "ET": "Etiopia", + "FK": "Isole Falkland [Malvine]", + "FO": "Isole Faroe", + "FJ": "Figi", + "FI": "Finlandia", + "FR": "Francia", + "GF": "Guyana francese", + "PF": "Polinesia francese", + "GA": "Gabon", + "GM": "Gambia", + "GE": "Georgia", + "DE": "Germania", + "GH": "Ghana", + "GI": "Gibilterra", + "GR": "Grecia", + "GL": "Groenlandia", + "GD": "Grenada", + "GP": "Guadalupa", + "GU": "Guam", + "GT": "Guatemala", + "GG": "Guernsey", + "GN": "Guinea Conakry", + "GW": "Guinea-Bissau", + "GY": "Guyana", + "HT": "Haiti", + "HM": "Isole Heard e McDonald", + "HN": "Honduras", + "HK": "Hong Kong", + "HU": "Ungheria", + "IS": "Islanda", + "IN": "India", + "ID": "Indonesia", + "IR": "Iran", + "IQ": "Iraq", + "IE": "Irlanda", + "IM": "Isola di Man", + "IL": "Israele", + "IT": "Italia", + "JM": "Giamaica", + "JP": "Giappone", + "JE": "Jersey", + "JO": "Giordania", + "KZ": "Kazakistan", + "KE": "Kenya", + "KI": "Kiribati", + "XK": "Kosovo", + "KW": "Kuwait", + "KG": "Kirghizistan", + "LA": "Laos", + "LV": "Lettonia", + "LB": "Libano", + "LS": "Lesotho", + "LR": "Liberia", + "LY": "Libia", + "LI": "Liechtenstein", + "LT": "Lituania", + "LU": "Lussemburgo", + "MO": "Macao", + "MK": "Macedonia del Nord", + "MG": "Madagascar", + "MW": "Malawi", + "MY": "Malesia", + "MV": "Maldive", + "ML": "Mali", + "MT": "Malta", + "MH": "Isole Marshall", + "MQ": "Martinica", + "MR": "Mauritania", + "MU": "Mauritius", + "YT": "Mayotte", + "MX": "Messico", + "FM": "Micronesia", + "MD": "Moldavia", + "MC": "Monaco", + "MN": "Mongolia", + "ME": "Montenegro", + "MS": "Montserrat", + "MA": "Marocco", + "MZ": "Mozambico", + "MM": "Myanmar", + "NA": "Namibia", + "NR": "Nauru", + "NP": "Nepal", + "NL": "Paesi Bassi", + "NC": "Nuova Caledonia", + "NZ": "Nuova Zelanda", + "NI": "Nicaragua", + "NE": "Niger", + "NG": "Nigeria", + "NU": "Niue", + "NF": "Isola Norfolk", + "KP": "Corea del Nord", + "MP": "Isole Marianne Settentrionali", + "NO": "Norvegia", + "OM": "Oman", + "PK": "Pakistan", + "PW": "Palau", + "PS": "Territori Palestinesi", + "PA": "Panama", + "PG": "Papua Nuova Guinea", + "PY": "Paraguay", + "PE": "Perù", + "PH": "Filippine", + "PL": "Polonia", + "PT": "Portogallo", + "PR": "Portorico", + "QA": "Qatar", + "RE": "Réunion", + "RO": "Romania", + "RU": "Russia", + "RW": "Ruanda", + "BL": "Saint Barthélemy", + "SH": "Sant'Elena", + "KN": "Saint Kitts e Nevis", + "LC": "Saint Lucia", + "MF": "Saint Martin", + "PM": "Saint Pierre e Miquelon", + "VC": "Saint Vincent e Grenadine", + "WS": "Samoa", + "SM": "San Marino", + "ST": "São Tomé e Príncipe", + "SA": "Arabia Saudita", + "SN": "Senegal", + "RS": "Serbia", + "SC": "Seychelles", + "SL": "Sierra Leone", + "SG": "Singapore", + "SX": "Sint Maarten", + "SK": "Slovacchia", + "SI": "Slovenia", + "SB": "Isole Salomone", + "SO": "Somalia", + "ZA": "Sud Africa", + "GS": "Georgia del Sud e Isole Sandwich Meridionali", + "KR": "Corea del Sud", + "SS": "Sud Sudan", + "ES": "Spagna", + "LK": "Sri Lanka", + "SD": "Sudan", + "SR": "Suriname", + "SJ": "Svalbard e Jan Mayen", + "SZ": "Eswatini", + "SE": "Svezia", + "CH": "Svizzera", + "SY": "Siria", + "TW": "Taiwan", + "TJ": "Tagikistan", + "TZ": "Tanzania", + "TH": "Thailandia", + "TG": "Togo", + "TK": "Tokelau", + "TO": "Tonga", + "TT": "Trinidad e Tobago", + "TN": "Tunisia", + "TR": "Turchia", + "TM": "Turkmenistan", + "TC": "Isole Turks e Caicos", + "TV": "Tuvalu", + "VI": "Isole Vergini americane", + "UG": "Uganda", + "UA": "Ucraina", + "AE": "Emirati Arabi Uniti", + "GB": "Regno Unito", + "US": "Stati Uniti", + "UY": "Uruguay", + "UZ": "Uzbekistan", + "VU": "Vanuatu", + "VA": "Città del Vaticano", + "VE": "Venezuela", + "VN": "Vietnam", + "WF": "Wallis e Futuna", + "WW": "Mondo", + "EH": "Sahara Occidentale", + "YE": "Yemen", + "ZM": "Zambia", + "ZW": "Zimbabwe", + "search": "Cerca", +}; From df28421f4d1f83fb69bbf5022462b030ade6d912 Mon Sep 17 00:00:00 2001 From: alegos27 Date: Fri, 17 Feb 2023 17:28:28 +0100 Subject: [PATCH 2/2] Added support for Italian language in example --- example/lib/main.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/example/lib/main.dart b/example/lib/main.dart index 5fc4555..7758990 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -35,6 +35,7 @@ class MyApp extends StatelessWidget { const Locale('lt'), const Locale('ku'), const Locale('nl'), + const Locale('it'), const Locale.fromSubtags( languageCode: 'zh', scriptCode: 'Hans'), // Generic Simplified Chinese 'zh_Hans'