Latest0.0.1
Homepagehttps://github.com/garyworks/LanguageKit
LicenseMIT
Platformsios 8.0
Authors

CI Status
Version
License
Platform

LanguageKit is an iOS library for easy switch between different language. It use a CSV file for easy editing and sharing strings.

Work-in-progress, may not work as expected.

Features

  • Strings file based on CSV
  • Programmatically or Storyboard
  • Auto update when switch between UIViewControllers

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

LanguageKit is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'LanguageKit'

How it works

Prepare strings file

You need a string file in CSV format, like the one below.
A example had included in the example project. (Localizable.csv)

Keyen-USzh-Hantzh-Hansja-JP
language.nameEnglish繁體中文简体中文日本語
buttonButton按鍵按键ボタン
Language key

The locale name (en-US/zh-Hant) does not really matter, just for your own reference. You can have anything including two different versions of en-US.

Word key

It is recommended to use a key for each string, however it’s also possible to translate between strings.

Setup with strings file

In your AppDelegate:

    LanguageKit.shared.setup(filename: "Localizable.csv")   //or your own strings file
    LanguageKit.shared.setLanguage(language: "en-US")       //setup language

Get a localized string

To use it:

    "button".localized

Switch language

    LanguageKit.shared.setLanguage(language: "ja-JP")

LanguageKit will lookup the string you provided and return the translated version.

Auto translate a string from Storyboard/XIB

If you are using UIViewController or UITableViewController, or inherit from them. a custom IBOutlet – languageComponent is created for you. Just link controls with it and you are good to go.

Supported UIControl:

  • UILabel
  • UIButton
  • UISearchBar (Placeholder)
  • UITextField (Placeholder)
  • UISegmentControl

Author

Gary Law, [email protected], @garyworks

License

LanguageKit is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "LanguageKit",
    "version": "0.0.1",
    "summary": "LanguageKit is an iOS library for easy switch between different language. It use a CSV file for easy editing and sharing strings.",
    "description": "TODO: Add long description of the pod here.",
    "homepage": "https://github.com/garyworks/LanguageKit",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Gary Law": "[email protected]"
    },
    "source": {
        "git": "https://github.com/garyworks/LanguageKit.git",
        "tag": "0.0.1"
    },
    "social_media_url": "https://twitter.com/garyworks",
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "LanguageKit/Classes/**/*",
    "swift_version": "4.0"
}

Pin It on Pinterest

Share This