GithubHelp home page GithubHelp logo

ahmedibnadam / molh Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ahmedk92/molh

0.0 1.0 0.0 89 KB

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

License: MIT License

Swift 97.18% Ruby 2.82%

molh's Introduction

MOLH

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

molh's People

Contributors

dark2torch avatar moathothman avatar ahmedk92 avatar deya-eldeen avatar diyaa-hamza avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.