Skip to content

TBMXibLocalizer helps you to localise your xib files and is compatible with genstrings.

License

Notifications You must be signed in to change notification settings

trbtm/TBMXibLocalizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TBMXibLocalizer

TBMXibLocalizer helps you to localise your xib files and is compatible with genstrings.

Adding to your Project

If your are using CocoaPods simply add the following to your Podfile

pod 'TBMXibLocalizer'

else add all .h and .m files you find the Classes folder to your project.

Getting started

For each xib file that you want to localise you should create a class that inherties from TBMXibLocalizer. You can define the IBOutlets in an private extension that is in your implementation file.

@interface MainMenuLocalizer ()

@property (strong) IBOutlet id aButton;

@end

@implementation MainMenuLocalizer

TBMXibLocalizeControl(aButton, NSLocalizedString(@"Hi I'm a button!", @""))

@end

TBMXibDefineControl defines a control or rather an IBOutlet.

Since Xcode 6 Interface Builder is not able to read preprocessor macros or classes only defined in an implementation file correctly. If you used TBMXibDefineControl do not touch that code, it still works.

TBMXibLocalizeControl creates a method that calls -localizeControl:string:. The methods by defined by TBMXibLocalizeControl a prefixed and dynamically called using run time features in -awakeFromNib.

In your xib file you have to create an object with the appropriate sublass of TBMXibLocalizer and connect the IBOulets with the controls in the xib file.

Warning

  • Make sure that genstrings is able to read your subclasses of TBMXibLocalizer.
  • Make sure that all controls i.e. buttons are wide enough for all versions of the localized string if not using autolayout

Supported classes

  • NSWindow
  • NSButton
  • NSTextField
  • NSTabViewItem
  • NSTableColumn
  • NSMenuItem
  • NSToolbarItem

To support TBMXibLocalizer the class simply has to implement the TBMLocalizableControl protocol.

Deployment

Supports 10.7+

License

MIT

About

TBMXibLocalizer helps you to localise your xib files and is compatible with genstrings.

Resources

License

Stars

Watchers

Forks

Packages

No packages published