Open ghost opened 4 years ago
Oh, interesting. I tested it on a phone set to swedish and there the localization worked.
Could you check where "Done" comes from? Is it because it fails to initialize the bundle Bundle(identifier: "com.apple.UIKit")? or is it localizedString(forKey: "Done", value: "Done", table: "") that returns "Done"?
@mikaoj
Thank you for your quick reply. I prepare following debug code for this issue.
https://github.com/bonzeboy/BSImagePicker/tree/debug/i8n cd9ccaca18aa88c5a3013b08d143b6c3a628c9d4
I added following code in init of ImagePickerController.
print("1")
print(Bundle(identifier: "com.apple.UIKit"))
print("2")
print(Bundle(identifier: "com.apple.UIKit")?.localizedString(forKey: "Done", value: "Done", table: ""))
print("3")
print(Bundle(identifier: "com.apple.UIKit")?.localizedString(forKey: "Done", value: "Done", table: "") ?? "Done")
Reproduce environment: Xcode: Version 11.4(11E146) iOS: iPhone 8(17E255, version 13.4) simulator in the Xcode
(check1) condition: change iPhone Language to Japanese result: 1 Optional(NSBundle </Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/UIKit.framework> (loaded)) 2 Optional("Done") 3 Done
I expect that "Done" button is displayed as "完了", but it is displayed as "Done".
(check2) condition: change iPhone Language to Svenska result: 1 Optional(NSBundle </Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/UIKit.framework> (loaded)) 2 Optional("Done") 3 Done
I don't know swedish well (sorry...), but I think "Done" is not expected is it?
Yeah it isn't working for me anymore either. As for a swedish lesson, 'Done' should be 'Klar'. :)
I have the same problem for german localization. Obviously UIKit localization got moved to somewhere else.
Try this in Playground:
let bundle = Bundle(identifier: "com.apple.UIKit")!
bundle.localizedString(forKey: "Done", value: "<failed>", table: nil) // "<failed>"
bundle.localizedString(forKey: "Save", value: "<failed>", table: nil) // "<failed>"
bundle.localizations // ["English"]
Tested with Xcode 11.4.1 (16137)
I've done a temporary workaround in 3.1.7 where there is a property named doneButtonTitle that you can set on the image picker.
hi @mikaoj this bug seems to be fixed in https://github.com/mikaoj/BSImagePicker/commit/bea10a522477e193958dce3de42241f8fed2ab9c
Any news about releasing new version?
I use BSImagePicker in Japanese environment. The cancel button is localized well, but done button not seems to be localized.
Following code may not be work well. Sources/Controller/ImagePickerController.swift
fileprivate let localizedDone = Bundle(identifier: "com.apple.UIKit")?.localizedString(forKey: "Done", value: "Done", table: "") ?? "Done"