• Stars
    star
    459
  • Rank 95,377 (Top 2 %)
  • Language
    Swift
  • License
    MIT License
  • Created over 8 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Localize your views directly in Interface Builder with IBLocalizable

IBLocalizable

Localize your views easily in Interface Builder with IBLocalizable.

codecov.io Language CocoaPods Compatible Awesome GitHub license

With IBLocalizable, you can localize your views in Interface Builder easily. Simply set the new Localizable String property that shows up in Interface builder to the value that you added in your Localizable .string file. Most views can be localized this way without a single line of code.

Installation

Add .Package(url: "https://github.com/PiXeL16/IBLocalizable.git",majorVersion: 1) to your Package.swift

Add pod 'IBLocalizable' to your Podfile.

Add github "PiXeL16/IBLocalizable" to your Cartfile.

Manual Installation

  • Please note, installation via CocoaPods or Carthage is much simpler and recommended.

Download and drop /IBLocalizable in your project.

Supported Views

  • UILabel
  • UIButton
  • UINavigationItem (Navigation titles)
  • UIBarItem (BarButton, TabBarItem, etc)
  • UITextField
  • UITextView
  • UISearchBar

Supporting custom views

Custom views can be supported easily. Just create an extension and implement the Localizable Protocol.

If your custom view extends from UIView you only need to extend your custom view and implement the localizableProperty.

For example: lets say that I have a custom view that contains several UILabel and a UIImageView. I will like to localize one of the UILabel.

import UIKit
extension MyCustomView {

    public override var localizableProperty: String?{

        get{
            return self.label.text
        }
        set{
            self.label.text = newValue
        }
    }
}

Thats it! πŸ˜„.

Usage

After the package its installed simply open your Storyboard or Interface Builder. All of the supported views will show a new Localizable String property.

interfaceBuilder

Since everything is extension based, IBLocalizable should play nice with other libraries or pods that you are using.

Build Performance

Since IBLocalizable only uses IBInspectable and never IBDesignable, your incremental builds will continue to work. (http://www.openradar.me/20690594)

Sample Project

In the Xcode Project you can find a sample project of a simple Login view controller. All of this is automatically localizable in English and Spanish by just using IBLocalizable.

English

english

Spanish

spanish

To do

  • Support more views (TableView Cells, etc)
  • Improve sample project.

Author

Chris Jimenez - http://code.chrisjimenez.net, @chrisjimeneznat

🍺 Donate

If you want to buy me a beer, you can donate to my coin addresses below:

BTC

1BeGBew4CBdLgUSmvoyiU1LrM99GpkXgkj

ETH

0xa59a3793E3Cb5f3B1AdE6887783D225EDf67192d

LTC

Ld6FB3Tqjf6B8iz9Gn9sMr7BnowAjSUXaV

License

IBLocalizable is released under the MIT license. See LICENSE for details.

More Repositories

1

RevealingSplashView

A Splash view that animates and reveals its content, inspired by Twitter splash
Swift
1,249
star
2

PasswordTextField

A custom TextField with a switchable icon which shows or hides the password and enforce good password policies
Swift
310
star
3

SnakeClassic

A snake engine written in SpriteKit for all Apple devices.
Swift
73
star
4

CountItApp

Count It, Never lose the count again
Swift
66
star
5

VideoBackgroundViewController

A View Controller that shows a video in the background, like Spotify
Swift
41
star
6

SwiftTMDB

A sample movie app that I build to play with Swift, Alamofire, Moya, RxViewModel, RxSwift, etc
Swift
29
star
7

SwiftMailgun

SwiftMailgun provides simple alternative when you need to send an email with your iOS app using MailGun
Swift
21
star
8

SendToMe

Share content to your email with a single tap
Swift
18
star
9

buddybuild-dashboard

Present your most important BuddyBuild builds in a TV
JavaScript
11
star
10

SwiftMandrill

SwiftMandrill provides simple alternative when you need to send an email with your iOS app.
Swift
11
star
11

appstore-rating-dashboard

Display and keep in check your App Store ratings and reviews with this dashboard
JavaScript
7
star
12

SwiftDelayer

Simple GCD delayer wrapper written in Swift
Swift
6
star
13

hubot-insults

Tastefully, insult your colleagues with Hubot
CoffeeScript
3
star
14

InterviewProgrammingQuestionSwift

Some popular interview programming questions solved in Swift
Swift
2
star
15

hubot-reactions

Hubot shows awesome reactions GIFs to compliment your teammates
CoffeeScript
2
star
16

CuentaleASubwayFreeCookie

You want a free Cookie Mothafuka?
1
star
17

MealPlanExchanges

Repository for the Meal Plan Exchanges project
Swift
1
star
18

soincalculator

RPN Calculator Source for SOIN U iOS course
Objective-C
1
star
19

ParseUtilsJS

Just a small example of JS scripts that do stuff in a Parse.com instance. For example, migrate all users from a DB to Parse
JavaScript
1
star