Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First stab at localization and adding French locale #56

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions RedditOs.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@
9F4812CC264FC8DB007A719D /* QuickSearchFullResultsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F4812CB264FC8DB007A719D /* QuickSearchFullResultsView.swift */; };
9F7E75E42654102700390010 /* AVKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9F7E75E32654102700390010 /* AVKit.framework */; };
9F8EE49126510BCF00BDE4AC /* MarkdownUI in Frameworks */ = {isa = PBXBuildFile; productRef = 9F8EE49026510BCF00BDE4AC /* MarkdownUI */; };
DBF4737628418A0A0067D8CC /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = DBF4737428418A0A0067D8CC /* InfoPlist.strings */; };
DBF4737928418A0A0067D8CC /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = DBF4737728418A0A0067D8CC /* Localizable.strings */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand Down Expand Up @@ -139,6 +141,9 @@
9F4537872652ED550026C19B /* QuickSearchPostsResultView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QuickSearchPostsResultView.swift; sourceTree = "<group>"; };
9F4812CB264FC8DB007A719D /* QuickSearchFullResultsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QuickSearchFullResultsView.swift; sourceTree = "<group>"; };
9F7E75E32654102700390010 /* AVKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVKit.framework; path = System/Library/Frameworks/AVKit.framework; sourceTree = SDKROOT; };
DBBA8E9228419264007202FF /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
DBF4737528418A0A0067D8CC /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/InfoPlist.strings; sourceTree = "<group>"; };
DBF4737828418A0A0067D8CC /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/Localizable.strings; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -316,6 +321,8 @@
6970A0AC24B7494C00B11031 /* Shared */,
69EACF2024B7298C00303A16 /* Features */,
69EACF0B24B63D5900303A16 /* Info.plist */,
DBF4737728418A0A0067D8CC /* Localizable.strings */,
DBF4737428418A0A0067D8CC /* InfoPlist.strings */,
69EACF0624B63D5900303A16 /* Assets.xcassets */,
69EACF0C24B63D5900303A16 /* RedditOs.entitlements */,
69EACF0824B63D5900303A16 /* Preview Content */,
Expand Down Expand Up @@ -459,6 +466,7 @@
knownRegions = (
en,
Base,
fr,
);
mainGroup = 69EACEF624B63D5800303A16;
packageReferences = (
Expand All @@ -480,6 +488,8 @@
buildActionMask = 2147483647;
files = (
69EACF0A24B63D5900303A16 /* Preview Assets.xcassets in Resources */,
DBF4737928418A0A0067D8CC /* Localizable.strings in Resources */,
DBF4737628418A0A0067D8CC /* InfoPlist.strings in Resources */,
69EACF0724B63D5900303A16 /* Assets.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -553,6 +563,26 @@
};
/* End PBXSourcesBuildPhase section */

/* Begin PBXVariantGroup section */
DBF4737428418A0A0067D8CC /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
DBF4737528418A0A0067D8CC /* fr */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
DBF4737728418A0A0067D8CC /* Localizable.strings */ = {
isa = PBXVariantGroup;
children = (
DBF4737828418A0A0067D8CC /* fr */,
DBBA8E9228419264007202FF /* en */,
);
name = Localizable.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */

/* Begin XCBuildConfiguration section */
69EACF0D24B63D5900303A16 /* Debug */ = {
isa = XCBuildConfiguration;
Expand Down Expand Up @@ -611,6 +641,7 @@
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Debug;
Expand Down Expand Up @@ -665,6 +696,7 @@
MTL_FAST_MATH = YES;
SDKROOT = macosx;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OPTIMIZATION_LEVEL = "-O";
};
name = Release;
Expand Down
2 changes: 2 additions & 0 deletions RedditOs.xcodeproj/xcshareddata/xcschemes/RedditOs.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = "fr"
region = "FR"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
3 changes: 2 additions & 1 deletion RedditOs/Features/Search/Quick/QuickSearchBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ struct QuickSearchBar: View {
let onCancel: () -> Void

var body: some View {
SearchBarView(placeholder: "Search anything",
SearchBarView(placeholder: NSLocalizedString("Search anything",
comment: "placeholder for search"),
searchText: $searchState.searchText) { editing in
if showSuggestionPopover {
isPopoverPresented = editing
Expand Down
10 changes: 7 additions & 3 deletions RedditOs/Features/Search/Quick/QuickSearchResultsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ struct QuickSearchResultsView: View {
}
}

private func makeTitle(_ title: String) -> some View {
private func makeTitle(_ title: LocalizedStringKey) -> some View {
Text(title)
.font(.headline)
.fontWeight(.bold)
Expand All @@ -54,13 +54,17 @@ struct QuickSearchResultsView: View {
private func makeQuickAccess() -> some View {
ResultContainerView {
QuickSearchResultRow(icon: nil,
name: "Posts with '\(searchState.searchText)'")
name: String.localizedStringWithFormat(NSLocalizedString("Posts with %@",
comment: "label showing search text"),
searchState.searchText))
.onTapGesture {
uiState.searchRoute = .searchPostsResult
}

QuickSearchResultRow(icon: nil,
name: "Go to r/\(searchState.searchText)")
name: String.localizedStringWithFormat(NSLocalizedString("Go to r/%@",
comment: "Navigates to a given subreddit"),
searchState.searchText))
.onTapGesture {
uiState.searchRoute = .subreddit(subreddit: searchState.searchText)
}
Expand Down
17 changes: 11 additions & 6 deletions RedditOs/Features/Sidebar/SidebarItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,22 @@ enum SidebarItem: String, CaseIterable, Identifiable, Equatable {
func title() -> String {
switch self {
case .home:
return "Home"
return NSLocalizedString("Home",
comment: "Sidebar item - navigates back to the Home screen")
case .account:
return "Account"
return NSLocalizedString("Account",
comment: "Sidebar item - navigates to the Account screen")
case .favorites:
return "Favorites"
return NSLocalizedString("Favorites",
comment: "Sidebar item - navigates to the Favorites screen")
case .recentlyVisited:
return "Recently Visited"
return NSLocalizedString("Recently Visited",
comment: "Sidebar item - navigates to Recently Visited screen")
case .subscription:
return "Subscriptions"
return NSLocalizedString("Subscriptions",
comment: "Sidebar item - navigates to the Subscriptions screen")
case .multi:
return "Multireddits"
return "Multireddits" // VERBATIM, no localization
}
}
}
2 changes: 1 addition & 1 deletion RedditOs/Shared/LoadingRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import SwiftUI

struct LoadingRow: View {
let text: String?
let text: LocalizedStringKey?

var body: some View {
HStack {
Expand Down
53 changes: 53 additions & 0 deletions RedditOs/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/* No comment provided by engineer. */
"Reply" = "Reply";

/* No comment provided by engineer. */
"Share" = "Share";

/* No comment provided by engineer. */
"Save" = "Save";

/* No comment provided by engineer. */
"Report" = "Report";

/* No comment provided by engineer. */
"Saved" = "Saved";

/* No comment provided by engineer. */
"Overview" = "Overview";

/* No comment provided by engineer. */
"Awards" = "Awards";

/* No comment provided by engineer. */
"Profile" = "Profile";

/* No comment provided by engineer. */
"Inbox" = "Inbox";

/* No comment provided by engineer. */
"Posts" = "Posts";

/* No comment provided by engineer. */
"Comments" = "Comments";

/* When search fails for a given search string */
"No matching subscriptions for %@" = "No matching subscriptions for %@";

/* A count of the number of comments */
"%d comments" = "%d comments";

/* Home Sidebar: navigates to posts that are 'hot' or popular */
"Hot" = "Hot";

/* Home Sidebar: navigates to newest posts */
"New" = "New";

/* Home Sidebar: navigates to best posts */
"Best" = "Best";

/* Home Sidebar: navigates to top posts */
"Top" = "Top";

/* Home Sidebar: navigates to rising posts */
"Rising" = "Rising";
3 changes: 3 additions & 0 deletions RedditOs/fr.lproj/InfoPlist.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/* Bundle name */
"CFBundleName" = "Curiosité";

Loading