UIBarButtonSystemItem is localized

How can I make UIBarbuttonItem localizable?

My implementation:

UIBarButtonItem * cancelButton = [[UIBarButtonItem alloc] 
                                             initWithBarButtonSystemItem: UIBarButtonSystemItemDone
                                             target: self
                                             action: @selector (cancel)];

Initially, I thought it was automatic, because it looks easy, but it seems not.

EDIT1: Apple's official dox says cancel, do, change, keep buttons localized, but not sure how to do it.

+5
source share
4 answers

, , , .

UIKit , , [[NSBundle mainBundle] preferredLocalizations]. , , , . , , "" > "" > "" > "", . (UIKit , Settings.app, , ), .

, . , , . , sk.lproj, . , , , , .

, , *.lproj . , , [[NSBundle mainBundle] preferredLocalizations]. , , . , , , , Settings.app.

, :

  • : , , ;
  • : , ( ) ;
  • : , Xcode, " ..." ( , " " ), "sk", "" . UIKit , , , Settings.app.

, - project/build/built. , , .

+4

Bump, , Vanya / CFBundleDevelopmentRegion Info.plist. , , , . sk - violà.

+4

, , , , . , UISwitch, 0/1 ON/OFF. ?

, , , . .

+1

Swift:

let doneButton = UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(doneButtonTapped(button:)))

The system default language is used for the text "Finish".

0
source

All Articles