Skip to content

Commit b8ca146

Browse files
committed
Localise strings
1 parent a940334 commit b8ca146

File tree

3 files changed

+20
-10
lines changed

3 files changed

+20
-10
lines changed

WorldFacts/WorldFacts.xcodeproj/project.pbxproj

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
/* Begin PBXBuildFile section */
1010
532CADEB158D1286002BEDC8 /* README in Resources */ = {isa = PBXBuildFile; fileRef = 532CADEA158D1286002BEDC8 /* README */; };
1111
532CADF5158D19D1002BEDC8 /* UYLCountryViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 532CADF4158D19D1002BEDC8 /* UYLCountryViewController.m */; };
12-
538A7989157E567F0007B8A5 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 538A7987157E567F0007B8A5 /* InfoPlist.strings */; };
1312
538A798B157E567F0007B8A5 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 538A798A157E567F0007B8A5 /* main.m */; };
1413
538A798F157E567F0007B8A5 /* UYLAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 538A798E157E567F0007B8A5 /* UYLAppDelegate.m */; };
1514
538A7992157E567F0007B8A5 /* WorldFacts.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 538A7990157E567F0007B8A5 /* WorldFacts.xcdatamodeld */; };
@@ -18,6 +17,7 @@
1817
5391E1CD1A38F80700218F41 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5391E1CC1A38F80700218F41 /* LaunchScreen.xib */; };
1918
53A87BE7157FA30A000DBAC9 /* Country+Extensions.m in Sources */ = {isa = PBXBuildFile; fileRef = 53A87BE6157FA30A000DBAC9 /* Country+Extensions.m */; };
2019
53A87BF1157FAD42000DBAC9 /* Country.m in Sources */ = {isa = PBXBuildFile; fileRef = 53A87BF0157FAD42000DBAC9 /* Country.m */; };
20+
53B691731A3A5AE500DDFBE2 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 53B691751A3A5AE500DDFBE2 /* Localizable.strings */; };
2121
53E7826D1A3658590075A619 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 53E7826C1A3658590075A619 /* Images.xcassets */; };
2222
53E782701A365AE60075A619 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 53E782721A365AE60075A619 /* Main.storyboard */; };
2323
53EDC9911A37AF03005CDB68 /* CountryCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 53EDC9901A37AF03005CDB68 /* CountryCell.m */; };
@@ -41,9 +41,9 @@
4141
53A87BE6157FA30A000DBAC9 /* Country+Extensions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "Country+Extensions.m"; sourceTree = "<group>"; };
4242
53A87BEF157FAD42000DBAC9 /* Country.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Country.h; sourceTree = "<group>"; };
4343
53A87BF0157FAD42000DBAC9 /* Country.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Country.m; sourceTree = "<group>"; };
44+
53B691741A3A5AE500DDFBE2 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
4445
53E7826C1A3658590075A619 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
4546
53E782731A365AF30075A619 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
46-
53E782741A365B120075A619 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Base; path = Base.lproj/InfoPlist.strings; sourceTree = "<group>"; };
4747
53EDC98F1A37AF03005CDB68 /* CountryCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CountryCell.h; sourceTree = "<group>"; };
4848
53EDC9901A37AF03005CDB68 /* CountryCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CountryCell.m; sourceTree = "<group>"; };
4949
/* End PBXFileReference section */
@@ -104,8 +104,8 @@
104104
children = (
105105
538A79B1157E80D40007B8A5 /* countries.plist */,
106106
538A7986157E567F0007B8A5 /* WorldFacts-Info.plist */,
107-
538A7987157E567F0007B8A5 /* InfoPlist.strings */,
108107
538A798A157E567F0007B8A5 /* main.m */,
108+
53B691751A3A5AE500DDFBE2 /* Localizable.strings */,
109109
);
110110
name = "Supporting Files";
111111
sourceTree = "<group>";
@@ -196,9 +196,9 @@
196196
isa = PBXResourcesBuildPhase;
197197
buildActionMask = 2147483647;
198198
files = (
199-
538A7989157E567F0007B8A5 /* InfoPlist.strings in Resources */,
200199
538A79B2157E80D40007B8A5 /* countries.plist in Resources */,
201200
53E7826D1A3658590075A619 /* Images.xcassets in Resources */,
201+
53B691731A3A5AE500DDFBE2 /* Localizable.strings in Resources */,
202202
53E782701A365AE60075A619 /* Main.storyboard in Resources */,
203203
5391E1CD1A38F80700218F41 /* LaunchScreen.xib in Resources */,
204204
532CADEB158D1286002BEDC8 /* README in Resources */,
@@ -226,12 +226,12 @@
226226
/* End PBXSourcesBuildPhase section */
227227

228228
/* Begin PBXVariantGroup section */
229-
538A7987157E567F0007B8A5 /* InfoPlist.strings */ = {
229+
53B691751A3A5AE500DDFBE2 /* Localizable.strings */ = {
230230
isa = PBXVariantGroup;
231231
children = (
232-
53E782741A365B120075A619 /* Base */,
232+
53B691741A3A5AE500DDFBE2 /* en */,
233233
);
234-
name = InfoPlist.strings;
234+
name = Localizable.strings;
235235
sourceTree = "<group>";
236236
};
237237
53E782721A365AE60075A619 /* Main.storyboard */ = {

WorldFacts/WorldFacts/UYLCountryTableViewController.m

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ @implementation UYLCountryTableViewController
6464
- (void)viewDidLoad
6565
{
6666
[super viewDidLoad];
67-
self.title = NSLocalizedString(@"World", @"World");
67+
self.title = NSLocalizedString(@"WorldTableViewTitle", @"World");
6868

6969
[[NSNotificationCenter defaultCenter] addObserver:self
7070
selector:@selector(didChangePreferredContentSize:)
@@ -78,7 +78,8 @@ - (void)viewDidLoad
7878
self.searchController.dimsBackgroundDuringPresentation = NO;
7979

8080
// Configure the search bar with scope buttons and add it to the table view header
81-
self.searchController.searchBar.scopeButtonTitles = @[@"Country", @"Capital"];
81+
self.searchController.searchBar.scopeButtonTitles = @[NSLocalizedString(@"ScopeButtonCountry",@"Country"),
82+
NSLocalizedString(@"ScopeButtonCapital",@"Capital")];
8283
self.searchController.searchBar.delegate = self;
8384

8485
self.tableView.tableHeaderView = self.searchController.searchBar;
@@ -206,7 +207,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
206207
cell.capitalLabel.text = country.capital;
207208

208209
NSString *population = [self.decimalFormatter stringFromNumber:country.population];
209-
cell.populationLabel.text = [NSString stringWithFormat:NSLocalizedString(@"Pop: %@", @"Pop:"), population];
210+
cell.populationLabel.text = [NSString stringWithFormat:@"%@ %@", NSLocalizedString(@"PopulationShortLabel", @"Pop:"), population];
210211

211212
cell.countryLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleHeadline];
212213
cell.capitalLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleSubheadline];
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/*
2+
Localizable.strings
3+
WorldFacts
4+
*/
5+
6+
"WorldTableViewTitle" = "World";
7+
"ScopeButtonCountry" = "Country";
8+
"ScopeButtonCapital" = "Capital";
9+
"PopulationShortLabel" = "Pop:";

0 commit comments

Comments
 (0)