Latest 0.8
Homepage https://github.com/MoathOthman/MOLH
License MIT
Platforms ios 9.0, requires ARC
Authors

Localization helper for iOS apps mainly focusing on the LTR/RTL issue

Install

Add pod 'MOLH' to your podfile. (check https://cocoapods.org/ for more info about cocoapods)

How To Use

import MOLH

Start

When you start the app

MOLH.shared.activate(true)

or

MOLH.shared.activate(false) to not use swizzling and use subclassing from MOLH* UI classes.

To reset the language

MOLH.setLanguageTo(MOLHLanguage.currentAppleLanguage() == “en” ? “ar” : “en”)
MOLH.reset()

Set default

Before .activate set

MOLHLanguage.setDefaultLanguage("ar")

using without swizzling (prefered)

you can choose to not use swizzling MOLH.shared.activate(false) , in that case you subclass MOLH-UI Subclasses , like MOLHTextField , this will give you more controlability as you can by-pass the tag requirement by using forceSwitchingRegardlessOfTag and set it to true.

Images

To make sure an image is flipped when switching to RTL or to LTR, you can use flipIfNeeded() function on image or UIImage().imageFlippedForRightToLeftLayoutDirection()

Fonts

Its better to have the app fonts in one place in your app, e.g. a FontManager. and there you can decide which font to use based on the chosen language, this would be the eaiser way.

Other Frameworks and bundles

Some controls such as ActionSheetDatePicker have locale property so you can set them appropriately e.g.

actionSheetDatePicker?.locale = Locale(identifier: MOLHLanguage.currentLocaleIdentifier())

you may check this post.

Author

Latest podspec

{
    "name": "MOLH",
    "version": "0.8",
    "summary": "Localization helper for iOS apps mainly focusing on the LTR/RTL issue Edit",
    "description": "Localization helper for iOS apps mainly focusing on the LTR/RTL issue Edit",
    "homepage": "https://github.com/MoathOthman/MOLH",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "moath othman": "[email protected]"
    },
    "social_media_url": "http://twitter.com/dark_torch",
    "platforms": {
        "ios": "9.0"
    },
    "source": {
        "git": "https://github.com/MoathOthman/MOLH.git",
        "tag": "v0.8"
    },
    "source_files": "MOLH/*.swift",
    "requires_arc": true,
    "swift_version": "4.2"
}

Pin It on Pinterest

Share This