Use Locale for country names too

I hadn't thought it before!
This commit is contained in:
Davide De Rosa 2019-04-13 18:53:08 +02:00
parent d64df68f8f
commit fd9a165817
3 changed files with 1 additions and 289 deletions

View File

@ -78,7 +78,6 @@
0E57F64620C83FC7008323CF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0E57F64420C83FC7008323CF /* LaunchScreen.storyboard */; }; 0E57F64620C83FC7008323CF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0E57F64420C83FC7008323CF /* LaunchScreen.storyboard */; };
0E58BD9322404EF1006FB157 /* Intents.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = 0E58BD9122404EF1006FB157 /* Intents.intentdefinition */; }; 0E58BD9322404EF1006FB157 /* Intents.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = 0E58BD9122404EF1006FB157 /* Intents.intentdefinition */; };
0E58BF65224152F9006FB157 /* Intents.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = 0E58BD9122404EF1006FB157 /* Intents.intentdefinition */; settings = {ATTRIBUTES = (no_codegen, ); }; }; 0E58BF65224152F9006FB157 /* Intents.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = 0E58BD9122404EF1006FB157 /* Intents.intentdefinition */; settings = {ATTRIBUTES = (no_codegen, ); }; };
0E58BF68224305A8006FB157 /* Countries.strings in Resources */ = {isa = PBXBuildFile; fileRef = 0E58BF6A224305A8006FB157 /* Countries.strings */; };
0E66A270225FE25800F9C779 /* PoolModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E66A26F225FE25800F9C779 /* PoolModel.swift */; }; 0E66A270225FE25800F9C779 /* PoolModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E66A26F225FE25800F9C779 /* PoolModel.swift */; };
0E66A272225FE5FB00F9C779 /* InfrastructureCache.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E66A271225FE5FB00F9C779 /* InfrastructureCache.swift */; }; 0E66A272225FE5FB00F9C779 /* InfrastructureCache.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E66A271225FE5FB00F9C779 /* InfrastructureCache.swift */; };
0E6BE13F20CFBAB300A6DD36 /* DebugLogViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E6BE13E20CFBAB300A6DD36 /* DebugLogViewController.swift */; }; 0E6BE13F20CFBAB300A6DD36 /* DebugLogViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E6BE13E20CFBAB300A6DD36 /* DebugLogViewController.swift */; };
@ -215,7 +214,6 @@
0E57F63D20C83FC5008323CF /* ServiceViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServiceViewController.swift; sourceTree = "<group>"; }; 0E57F63D20C83FC5008323CF /* ServiceViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServiceViewController.swift; sourceTree = "<group>"; };
0E57F64220C83FC7008323CF /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; 0E57F64220C83FC7008323CF /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
0E57F64720C83FC7008323CF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 0E57F64720C83FC7008323CF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
0E58BF69224305A8006FB157 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Countries.strings; sourceTree = "<group>"; };
0E5E5DDE215119AF00E318A3 /* VPNStatus.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VPNStatus.swift; sourceTree = "<group>"; }; 0E5E5DDE215119AF00E318A3 /* VPNStatus.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VPNStatus.swift; sourceTree = "<group>"; };
0E5E5DE1215119DD00E318A3 /* VPNConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VPNConfiguration.swift; sourceTree = "<group>"; }; 0E5E5DE1215119DD00E318A3 /* VPNConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VPNConfiguration.swift; sourceTree = "<group>"; };
0E5E5DE421511C5F00E318A3 /* GracefulVPN.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GracefulVPN.swift; sourceTree = "<group>"; }; 0E5E5DE421511C5F00E318A3 /* GracefulVPN.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GracefulVPN.swift; sourceTree = "<group>"; };
@ -535,7 +533,6 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
0E0EABC721DF853C0069DAE7 /* Web */, 0E0EABC721DF853C0069DAE7 /* Web */,
0E58BF6A224305A8006FB157 /* Countries.strings */,
0E58BD9122404EF1006FB157 /* Intents.intentdefinition */, 0E58BD9122404EF1006FB157 /* Intents.intentdefinition */,
0E05C5DF20D198B9006EE732 /* Localizable.strings */, 0E05C5DF20D198B9006EE732 /* Localizable.strings */,
); );
@ -817,7 +814,6 @@
isa = PBXResourcesBuildPhase; isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
0E58BF68224305A8006FB157 /* Countries.strings in Resources */,
0E3152DD223FA06100F61841 /* Localizable.strings in Resources */, 0E3152DD223FA06100F61841 /* Localizable.strings in Resources */,
0E3152DE223FA06400F61841 /* Web in Resources */, 0E3152DE223FA06400F61841 /* Web in Resources */,
); );
@ -1194,14 +1190,6 @@
name = Intents.intentdefinition; name = Intents.intentdefinition;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
0E58BF6A224305A8006FB157 /* Countries.strings */ = {
isa = PBXVariantGroup;
children = (
0E58BF69224305A8006FB157 /* en */,
);
name = Countries.strings;
sourceTree = "<group>";
};
0ED38ADC213F44D00004D387 /* Organizer.storyboard */ = { 0ED38ADC213F44D00004D387 /* Organizer.storyboard */ = {
isa = PBXVariantGroup; isa = PBXVariantGroup;
children = ( children = (

View File

@ -1,275 +0,0 @@
//
// Countries.strings
// Passepartout
//
// Created by Davide De Rosa on 3/21/19.
// Copyright (c) 2019 Davide De Rosa. All rights reserved.
//
// https://github.com/passepartoutvpn
//
// This file is part of Passepartout.
//
// Passepartout is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Passepartout is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
//
"BD" = "Bangladesh";
"BE" = "Belgium";
"BF" = "Burkina Faso";
"BG" = "Bulgaria";
"BA" = "Bosnia and Herzegovina";
"BB" = "Barbados";
"WF" = "Wallis and Futuna";
"BL" = "Saint Barthelemy";
"BM" = "Bermuda";
"BN" = "Brunei";
"BO" = "Bolivia";
"BH" = "Bahrain";
"BI" = "Burundi";
"BJ" = "Benin";
"BT" = "Bhutan";
"JM" = "Jamaica";
"BV" = "Bouvet Island";
"BW" = "Botswana";
"WS" = "Samoa";
"BQ" = "Bonaire, Saint Eustatius and Saba ";
"BR" = "Brazil";
"BS" = "Bahamas";
"JE" = "Jersey";
"BY" = "Belarus";
"BZ" = "Belize";
"RU" = "Russia";
"RW" = "Rwanda";
"RS" = "Serbia";
"TL" = "East Timor";
"RE" = "Reunion";
"TM" = "Turkmenistan";
"TJ" = "Tajikistan";
"RO" = "Romania";
"TK" = "Tokelau";
"GW" = "Guinea-Bissau";
"GU" = "Guam";
"GT" = "Guatemala";
"GS" = "South Georgia and the South Sandwich Islands";
"GR" = "Greece";
"GQ" = "Equatorial Guinea";
"GP" = "Guadeloupe";
"JP" = "Japan";
"GY" = "Guyana";
"GG" = "Guernsey";
"GF" = "French Guiana";
"GE" = "Georgia";
"GD" = "Grenada";
"GB" = "United Kingdom";
"GA" = "Gabon";
"SV" = "El Salvador";
"GN" = "Guinea";
"GM" = "Gambia";
"GL" = "Greenland";
"GI" = "Gibraltar";
"GH" = "Ghana";
"OM" = "Oman";
"TN" = "Tunisia";
"JO" = "Jordan";
"HR" = "Croatia";
"HT" = "Haiti";
"HU" = "Hungary";
"HK" = "Hong Kong";
"HN" = "Honduras";
"HM" = "Heard Island and McDonald Islands";
"VE" = "Venezuela";
"PR" = "Puerto Rico";
"PS" = "Palestinian Territory";
"PW" = "Palau";
"PT" = "Portugal";
"SJ" = "Svalbard and Jan Mayen";
"PY" = "Paraguay";
"IQ" = "Iraq";
"PA" = "Panama";
"PF" = "French Polynesia";
"PG" = "Papua New Guinea";
"PE" = "Peru";
"PK" = "Pakistan";
"PH" = "Philippines";
"PN" = "Pitcairn";
"PL" = "Poland";
"PM" = "Saint Pierre and Miquelon";
"ZM" = "Zambia";
"EH" = "Western Sahara";
"EE" = "Estonia";
"EG" = "Egypt";
"ZA" = "South Africa";
"EC" = "Ecuador";
"IT" = "Italy";
"VN" = "Vietnam";
"SB" = "Solomon Islands";
"ET" = "Ethiopia";
"SO" = "Somalia";
"ZW" = "Zimbabwe";
"SA" = "Saudi Arabia";
"ES" = "Spain";
"ER" = "Eritrea";
"ME" = "Montenegro";
"MD" = "Moldova";
"MG" = "Madagascar";
"MF" = "Saint Martin";
"MA" = "Morocco";
"MC" = "Monaco";
"UZ" = "Uzbekistan";
"MM" = "Myanmar";
"ML" = "Mali";
"MO" = "Macao";
"MN" = "Mongolia";
"MH" = "Marshall Islands";
"MK" = "Macedonia";
"MU" = "Mauritius";
"MT" = "Malta";
"MW" = "Malawi";
"MV" = "Maldives";
"MQ" = "Martinique";
"MP" = "Northern Mariana Islands";
"MS" = "Montserrat";
"MR" = "Mauritania";
"IM" = "Isle of Man";
"UG" = "Uganda";
"TZ" = "Tanzania";
"MY" = "Malaysia";
"MX" = "Mexico";
"IL" = "Israel";
"FR" = "France";
"IO" = "British Indian Ocean Territory";
"SH" = "Saint Helena";
"FI" = "Finland";
"FJ" = "Fiji";
"FK" = "Falkland Islands";
"FM" = "Micronesia";
"FO" = "Faroe Islands";
"NI" = "Nicaragua";
"NL" = "Netherlands";
"NO" = "Norway";
"NA" = "Namibia";
"VU" = "Vanuatu";
"NC" = "New Caledonia";
"NE" = "Niger";
"NF" = "Norfolk Island";
"NG" = "Nigeria";
"NZ" = "New Zealand";
"NP" = "Nepal";
"NR" = "Nauru";
"NU" = "Niue";
"CK" = "Cook Islands";
"XK" = "Kosovo";
"CI" = "Ivory Coast";
"CH" = "Switzerland";
"CO" = "Colombia";
"CN" = "China";
"CM" = "Cameroon";
"CL" = "Chile";
"CC" = "Cocos Islands";
"CA" = "Canada";
"CG" = "Republic of the Congo";
"CF" = "Central African Republic";
"CD" = "Democratic Republic of the Congo";
"CZ" = "Czech Republic";
"CY" = "Cyprus";
"CX" = "Christmas Island";
"CR" = "Costa Rica";
"CW" = "Curacao";
"CV" = "Cape Verde";
"CU" = "Cuba";
"SZ" = "Swaziland";
"SY" = "Syria";
"SX" = "Sint Maarten";
"KG" = "Kyrgyzstan";
"KE" = "Kenya";
"SS" = "South Sudan";
"SR" = "Suriname";
"KI" = "Kiribati";
"KH" = "Cambodia";
"KN" = "Saint Kitts and Nevis";
"KM" = "Comoros";
"ST" = "Sao Tome and Principe";
"SK" = "Slovakia";
"KR" = "South Korea";
"SI" = "Slovenia";
"KP" = "North Korea";
"KW" = "Kuwait";
"SN" = "Senegal";
"SM" = "San Marino";
"SL" = "Sierra Leone";
"SC" = "Seychelles";
"KZ" = "Kazakhstan";
"KY" = "Cayman Islands";
"SG" = "Singapore";
"SE" = "Sweden";
"SD" = "Sudan";
"DO" = "Dominican Republic";
"DM" = "Dominica";
"DJ" = "Djibouti";
"DK" = "Denmark";
"VG" = "British Virgin Islands";
"DE" = "Germany";
"YE" = "Yemen";
"DZ" = "Algeria";
"US" = "United States";
"UY" = "Uruguay";
"YT" = "Mayotte";
"UM" = "United States Minor Outlying Islands";
"LB" = "Lebanon";
"LC" = "Saint Lucia";
"LA" = "Laos";
"TV" = "Tuvalu";
"TW" = "Taiwan";
"TT" = "Trinidad and Tobago";
"TR" = "Turkey";
"LK" = "Sri Lanka";
"LI" = "Liechtenstein";
"LV" = "Latvia";
"TO" = "Tonga";
"LT" = "Lithuania";
"LU" = "Luxembourg";
"LR" = "Liberia";
"LS" = "Lesotho";
"TH" = "Thailand";
"TF" = "French Southern Territories";
"TG" = "Togo";
"TD" = "Chad";
"TC" = "Turks and Caicos Islands";
"LY" = "Libya";
"VA" = "Vatican";
"VC" = "Saint Vincent and the Grenadines";
"AE" = "United Arab Emirates";
"AD" = "Andorra";
"AG" = "Antigua and Barbuda";
"AF" = "Afghanistan";
"AI" = "Anguilla";
"VI" = "U.S. Virgin Islands";
"IS" = "Iceland";
"IR" = "Iran";
"AM" = "Armenia";
"AL" = "Albania";
"AO" = "Angola";
"AQ" = "Antarctica";
"AS" = "American Samoa";
"AR" = "Argentina";
"AU" = "Australia";
"AT" = "Austria";
"AW" = "Aruba";
"IN" = "India";
"AX" = "Aland Islands";
"AZ" = "Azerbaijan";
"IE" = "Ireland";
"ID" = "Indonesia";
"UA" = "Ukraine";
"QA" = "Qatar";
"MZ" = "Mozambique";

View File

@ -134,8 +134,7 @@ public class Utils {
} }
public static func localizedCountry(_ code: String) -> String { public static func localizedCountry(_ code: String) -> String {
let format = NSLocalizedString(code.uppercased(), tableName: "Countries", bundle: Bundle(for: Utils.self), comment: "") return Locale.current.localizedString(forRegionCode: code) ?? code
return String(format: format, locale: Locale.current)
} }
public static func localizedLanguage(_ code: String) -> String? { public static func localizedLanguage(_ code: String) -> String? {