Skip to content

Commit 03c0d4b

Browse files
authored
Merge pull request #237 from IFTTT/bugfix/translation_fallback
Translation fallback
2 parents 4d9f9ea + cbc9aaf commit 03c0d4b

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

IFTTT SDK/LocalizedStrings.swift

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,16 @@ extension String {
2828
value: "",
2929
comment: "")
3030
}
31-
else {
31+
else if let languageCode = locale.languageCode,
32+
let languageTableFallbackPath = bundle.path(forResource: "Localizable_\(languageCode)", ofType: "strings"),
33+
FileManager.default.fileExists(atPath: languageTableFallbackPath) {
3234
#if DEBUG
33-
print("The key \(self) wasn't found in a strings file with name \(table) in the the bundle. Will fallback to the Localizable.strings file. Try reinstalling the SDK and then perform a clean/rebuild")
35+
print("The key \(self) wasn't found in a strings file with name \(table) in the the bundle. Will try to fallback to Localizable_\(languageCode).strings file. Try reinstalling the SDK and then perform a clean/rebuild")
36+
#endif
37+
return NSLocalizedString(self, tableName: "Localizable_\(languageCode)", bundle: bundle, value: "", comment: "")
38+
} else {
39+
#if DEBUG
40+
print("The key \(self) wasn't found in a strings file with name \(table) in the the bundle. Will try to fallback to Localizable.strings file. Try reinstalling the SDK and then perform a clean/rebuild")
3441
#endif
3542
return NSLocalizedString(self, bundle: bundle, value: "", comment: "")
3643
}

IFTTTConnectSDK.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |spec|
22
spec.name = "IFTTTConnectSDK"
3-
spec.version = "2.4.0"
3+
spec.version = "2.4.1"
44
spec.summary = "Allows your users to activate programmable IFTTT Connections directly in your app."
55
spec.description = <<-DESC
66
- Easily authenticate your services to IFTTT through the Connect Button

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,6 @@ Text translation is supported for the following languages:
379379
* German (de)
380380
* Spanish (es)
381381
* Spanish - Latin America and Caribbean region (es-419)
382-
* Spanish - United States (es-US)
383382
* Finnish (fi)
384383
* French (fr)
385384
* French - Canada (fr-CA)

0 commit comments

Comments
 (0)