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

App Language preference #468

Merged
merged 12 commits into from
Mar 24, 2024
Prev Previous commit
Next Next commit
optimize code
  • Loading branch information
choykarl committed Mar 23, 2024
commit aa4bd2871ef80e70fbdd61ec404b4b7694b972a6
10 changes: 3 additions & 7 deletions Easydict/NewApp/LanguagePreference/I18nHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,9 @@ class I18nHelper: NSObject {
static let shared = I18nHelper()

var localizedBundle: Bundle {
let res = localizeCode
let path = Bundle.main.path(forResource: res, ofType: "lproj")
let bundle: Bundle
if let path = path {
bundle = Bundle(path: path) ?? .main
} else {
bundle = .main
guard let path = Bundle.main.path(forResource: localizeCode, ofType: "lproj"),
let bundle = Bundle(path: path) else {
return .main
}
return bundle
}
Expand Down