Latest 1.1.1
Homepage https://github.com/jonathantribouharet/jt-translator-ios
License MIT
Platforms ios 8.0, requires ARC
Authors

Version
License
Platform

JTTranslator is an easy to way to manage your translations on iOS without building a new version of your app, which allow you to update your translations after having released on the AppStore.

It’s work with Translator, a platform for manage your translations on iOS and Android.

Installation

With CocoaPods, add this line to your Podfile.

pod 'JTTranslator', '~> 1.0'

Usage

You have to initialize JTTranslator with your API KEY to download your translations.
The start method will automatically load the last downloaded versions of your translations and try to update them.

In your AppDelegate, just add:

import JTTranslator

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        JTTranslator.start(apiKey: "YOUR_API_KEY")
    }

}

The easiest way is to replace every call to NSLocalizedString by a global method which I call tr. This method try to get the translations from JTTranslator and the translation if is not found, it will fallback on NSLocalizedString.

If you want to do like me, you have to create this global method:

func tr (_ key: String) -> String {
    return JTTranslator.tr(key: key) ?? NSLocalizedString(key, comment: "")
}

For example, in this case if you want to manage the translations for a UILabel, you will have to do something like:

let label = UILabel()
label.text = tr("the_translation_key_you_choose")

You can also force to update the translations by calling JTTranslator.update().

Author

License

JTTranslator is released under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "JTTranslator",
    "version": "1.1.1",
    "summary": "Remotely manage your translations on iOS",
    "homepage": "https://github.com/jonathantribouharet/jt-translator-ios",
    "license": {
        "type": "MIT"
    },
    "authors": {
        "Jonathan Tribouharet": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/jonathantribouharet/jt-translator-ios.git",
        "tag": "1.1.1"
    },
    "source_files": "Source/*.swift",
    "requires_arc": true
}

Pin It on Pinterest

Share This