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

Return missing resources from Base implementation #171

Open
wants to merge 2 commits 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
2 changes: 1 addition & 1 deletion Localize-Swift.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "Localize-Swift"
s.version = "3.2.0"
s.version = "3.2.0.1"
s.summary = "Swift-friendly localization and i18n syntax with in-app language switching."
s.description = <<-DESC
A simple framework that improves localization and i18n in Swift apps with cleaner syntax and in-app language switching.
Expand Down
2 changes: 1 addition & 1 deletion Localize_Swift/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>3.2.0</string>
<string>3.2.0.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
2 changes: 1 addition & 1 deletion Localize_SwiftTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>3.2.0</string>
<string>3.2.0.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
16 changes: 12 additions & 4 deletions Sources/String+LocalizedBundleTableName.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,18 @@ public extension String {
func localized(using tableName: String?, in bundle: Bundle?) -> String {
let bundle: Bundle = bundle ?? .main
if let path = bundle.path(forResource: Localize.currentLanguage(), ofType: "lproj"),
let bundle = Bundle(path: path) {
return bundle.localizedString(forKey: self, value: nil, table: tableName)
}
else if let path = bundle.path(forResource: LCLBaseBundle, ofType: "lproj"),

let currentLanguageBundle = Bundle(path: path) {
let localizedString = currentLanguageBundle.localizedString(forKey: self, value: nil, table: tableName)

if localizedString == self,
let basePath = bundle.path(forResource: LCLBaseBundle, ofType: "lproj"),
let bundle = Bundle(path: basePath) {
return bundle.localizedString(forKey: self, value: nil, table: tableName)
} else {
return localizedString
}
} else if let path = bundle.path(forResource: LCLBaseBundle, ofType: "lproj"),
let bundle = Bundle(path: path) {
return bundle.localizedString(forKey: self, value: nil, table: tableName)
}
Expand Down