Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

Commit

Permalink
French Localization Fix for Choose Your Country
Browse files Browse the repository at this point in the history
  • Loading branch information
georgenyame authored Aug 6, 2021
1 parent fd17d97 commit b9589f3
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 5 deletions.
3 changes: 2 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import PackageDescription

let package = Package(
name: "PhoneNumberKit",
defaultLocalization: "en",
platforms: [
.iOS(.v9), .macOS(.v10_10), .tvOS(.v9), .watchOS(.v2)
],
Expand All @@ -20,7 +21,7 @@ let package = Package(
"Info.plist",
"Bundle+Resources.swift"],
resources: [
.process("Resources/PhoneNumberMetadata.json")
.process("Resources")
]),
.testTarget(name: "PhoneNumberKitTests",
dependencies: ["PhoneNumberKit"],
Expand Down
20 changes: 20 additions & 0 deletions PhoneNumberKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
objects = {

/* Begin PBXBuildFile section */
0F2FB36B26BDA3E2000EEE23 /* Localizable.strings in Sources */ = {isa = PBXBuildFile; fileRef = 0F64F15726BD93C200598B72 /* Localizable.strings */; };
0F64F15526BD93C200598B72 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 0F64F15726BD93C200598B72 /* Localizable.strings */; };
11C2EF391D62BC3200052D44 /* NSRegularExpression+Swift.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11C2EF381D62BC3200052D44 /* NSRegularExpression+Swift.swift */; };
1B0651171E2AD698006AE849 /* PhoneNumberFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1B0651161E2AD698006AE849 /* PhoneNumberFormatter.swift */; };
1B1A4DD723007580006AE849 /* PhoneNumberFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1B0651161E2AD698006AE849 /* PhoneNumberFormatter.swift */; };
Expand Down Expand Up @@ -94,6 +96,8 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
0F64F15626BD93C200598B72 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
0F64F15826BD93DB00598B72 /* fr-CA */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "fr-CA"; path = "fr-CA.lproj/Localizable.strings"; sourceTree = "<group>"; };
11C2EF381D62BC3200052D44 /* NSRegularExpression+Swift.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSRegularExpression+Swift.swift"; sourceTree = "<group>"; };
1B0651161E2AD698006AE849 /* PhoneNumberFormatter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PhoneNumberFormatter.swift; sourceTree = "<group>"; };
3417BD6A2210AC4900477EE7 /* MetadataParsing.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MetadataParsing.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -252,6 +256,7 @@
isa = PBXGroup;
children = (
3435CC951BBFF66F003F953B /* PhoneNumberMetadata.json */,
0F64F15726BD93C200598B72 /* Localizable.strings */,
);
path = Resources;
sourceTree = "<group>";
Expand Down Expand Up @@ -422,6 +427,7 @@
hasScannedForEncodings = 0;
knownRegions = (
en,
"fr-CA",
Base,
);
mainGroup = 3424185A1BB6E5A000EE70E7;
Expand All @@ -444,6 +450,7 @@
buildActionMask = 2147483647;
files = (
34CA34522380307300788D7D /* PhoneNumberMetadata.json in Resources */,
0F64F15526BD93C200598B72 /* Localizable.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -486,6 +493,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
0F2FB36B26BDA3E2000EEE23 /* Localizable.strings in Sources */,
11C2EF391D62BC3200052D44 /* NSRegularExpression+Swift.swift in Sources */,
34F26FBE2517DCB700B6AF4D /* Bundle+Resources.swift in Sources */,
342418821BB70F5200EE70E7 /* PhoneNumberParser.swift in Sources */,
Expand Down Expand Up @@ -589,6 +597,18 @@
};
/* End PBXTargetDependency section */

/* Begin PBXVariantGroup section */
0F64F15726BD93C200598B72 /* Localizable.strings */ = {
isa = PBXVariantGroup;
children = (
0F64F15626BD93C200598B72 /* en */,
0F64F15826BD93DB00598B72 /* fr-CA */,
);
name = Localizable.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */

/* Begin XCBuildConfiguration section */
342418761BB6E5A000EE70E7 /* Debug */ = {
isa = XCBuildConfiguration;
Expand Down
11 changes: 11 additions & 0 deletions PhoneNumberKit/Resources/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
Localizable.strings
PhoneNumberKit

Created by George Nyame on 2021-08-06.
Copyright © 2021 Roy Marmelstein. All rights reserved.
*/

"CHOOSE_YOUR_COUNTRY" = "Choose your country";
"CURRENT" = "Current";
"COMMON" = "Common";
11 changes: 11 additions & 0 deletions PhoneNumberKit/Resources/fr-CA.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
Localizable.strings
PhoneNumberKit

Created by George Nyame on 2021-08-06.
Copyright © 2021 Roy Marmelstein. All rights reserved.
*/

"CHOOSE_YOUR_COUNTRY" = "Choisissez votre pays";
"CURRENT" = "Actuel";
"COMMON" = "Courant";
8 changes: 4 additions & 4 deletions PhoneNumberKit/UI/CountryCodePickerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public class CountryCodePickerViewController: UITableViewController {
}

func commonInit() {
self.title = NSLocalizedString("PhoneNumberKit.CountryCodePicker.Title", value: "Choose your country", comment: "Title of CountryCodePicker ViewController")
self.title = NSLocalizedString("CHOOSE_YOUR_COUNTRY", bundle: .module, comment: "Title of CountryCodePicker ViewController")

tableView.register(Cell.self, forCellReuseIdentifier: Cell.reuseIdentifier)
searchController.searchResultsUpdater = self
Expand Down Expand Up @@ -154,11 +154,11 @@ public class CountryCodePickerViewController: UITableViewController {
if isFiltering {
return nil
} else if section == 0, hasCurrent {
return NSLocalizedString("PhoneNumberKit.CountryCodePicker.Current", value: "Current", comment: "Name of \"Current\" section")
return NSLocalizedString("CURRENT", bundle: .module, comment: "Section Title of Current Section")
} else if section == 0, !hasCurrent, hasCommon {
return NSLocalizedString("PhoneNumberKit.CountryCodePicker.Common", value: "Common", comment: "Name of \"Common\" section")
return NSLocalizedString("COMMON", bundle: .module, comment: "Section Title of Common Section")
} else if section == 1, hasCurrent, hasCommon {
return NSLocalizedString("PhoneNumberKit.CountryCodePicker.Common", value: "Common", comment: "Name of \"Common\" section")
return NSLocalizedString("COMMON", bundle: .module, comment: "Section Title of Common Section")
}
return countries[section].first?.name.first.map(String.init)
}
Expand Down

0 comments on commit b9589f3

Please sign in to comment.