Add localizations to UI tests target (#118)

This commit is contained in:
ismailgulek
2022-06-29 18:32:14 +03:00
committed by GitHub
parent dbee1924eb
commit 7bd4763662
11 changed files with 116 additions and 83 deletions
+3 -1
View File
@@ -5406,7 +5406,7 @@ extension ElementL10n {
}
private static func trIn(_ language: String, _ table: String, _ key: String, _ args: CVarArg...) -> String {
guard let bundle = Bundle.lprojBundle(for: language) else {
guard let bundle = Bundle(for: BundleToken.self).lprojBundle(for: language) else {
// no translations for the desired language
return key
}
@@ -5415,3 +5415,5 @@ extension ElementL10n {
}
}
private final class BundleToken {}
+3 -17
View File
@@ -10,25 +10,11 @@ import Foundation
public extension Bundle {
/// Returns the real app bundle.
/// Can also be used in app extensions.
static let app: Bundle = {
let bundle = main
if bundle.bundleURL.pathExtension == "appex" {
// Peel off two directory levels - MY_APP.app/PlugIns/MY_APP_EXTENSION.appex
let url = bundle.bundleURL.deletingLastPathComponent().deletingLastPathComponent()
if let otherBundle = Bundle(url: url) {
return otherBundle
}
}
return bundle
}()
/// Get an lproj language bundle from the main app bundle.
/// Get an lproj language bundle from the receiver bundle.
/// - Parameter language: The language to try to load.
/// - Returns: The lproj bundle if found otherwise nil.
@objc static func lprojBundle(for language: String) -> Bundle? {
guard let lprojURL = Bundle.app.url(forResource: language, withExtension: "lproj") else { return nil }
func lprojBundle(for language: String) -> Bundle? {
guard let lprojURL = url(forResource: language, withExtension: "lproj") else { return nil }
return Bundle(url: lprojURL)
}
@@ -97,6 +97,7 @@ struct SplashScreen: View {
Text(ElementL10n.loginSplashSubmit)
}
.buttonStyle(.elementAction(.xLarge))
.accessibilityIdentifier("getStartedButton")
}
.padding(.horizontal, 16)
.readableFrame()