mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 06:13:38 +00:00
fix language locale loading
This commit is contained in:
@@ -75,9 +75,9 @@ class SafariExtensionViewController: SFSafariExtensionViewController, WKScriptMe
|
|||||||
UserDefaults.standard.removeObject(forKey: m!.data!)
|
UserDefaults.standard.removeObject(forKey: m!.data!)
|
||||||
replyMessage(message: m!)
|
replyMessage(message: m!)
|
||||||
} else if command == "getLocaleStrings" {
|
} else if command == "getLocaleStrings" {
|
||||||
let language = m!.data
|
let language = m!.data ?? "en"
|
||||||
let bundleURL = Bundle.main.resourceURL!.absoluteURL
|
let bundleURL = Bundle.main.resourceURL!.absoluteURL
|
||||||
let messagesUrl = bundleURL.appendingPathComponent("app/_locales/en/messages.json")
|
let messagesUrl = bundleURL.appendingPathComponent("app/_locales/\(language)/messages.json")
|
||||||
do {
|
do {
|
||||||
let json = try String(contentsOf: messagesUrl, encoding: .utf8)
|
let json = try String(contentsOf: messagesUrl, encoding: .utf8)
|
||||||
webView.evaluateJavaScript("window.bitwardenLocaleStrings = \(json);", completionHandler: nil)
|
webView.evaluateJavaScript("window.bitwardenLocaleStrings = \(json);", completionHandler: nil)
|
||||||
|
|||||||
Reference in New Issue
Block a user