Skip to content

Files

Latest commit

Abdelrahman EldesokyAbdelrahman Eldesoky
Abdelrahman Eldesoky
and
Abdelrahman Eldesoky
Jun 2, 2019
27b0eb8 · Jun 2, 2019

History

History
executable file
·
151 lines (113 loc) · 3.55 KB

README.md

File metadata and controls

executable file
·
151 lines (113 loc) · 3.55 KB

EasyLocalization

CI Status Version License Platform

Example

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

Requirements

  • xcode 9.x
  • swift 3.x
  • swift 4.0

Installation

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

    pod 'EasyLocalization', '~> 0.1.1.beta.1'

Usage

#now rtl direction is supported

#Make dictionary for every language with

var arabicDic = [
    "test navigation title":"تجربة عنوان",
    "test button":"تجربة زر",
    "test label":"تجربة نص",
    "test textfield":"تجربة حقل نصي",
    "lorem" : "لوريم إيبسوم هو ببساطة نص شكلي بمعنى أن الغاية هي الشكل وليس المحتوى ويُستخدم في صناعات المطابع ودور النشر"
]

var englishDic = [
    "test navigation title":"test navigation title",
    "test button":"test button",
    "test label":"test label",
    "test textfield":"test textfield",
    "lorem" : "Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
]

#In AppDelegate.swift, just import EasyLocalization framework and make configration.

EasyLocalization.config(
                        locale: .en,
                        languageDictionary: [
                            .ar : /* set your arbic dictionary for example "arabicDic" */,
                            .en : /* set your english dictionary for example "englishDic" */,
                        ]
                    )
                    
 

#Change your language

EasyLocalization.setLanguage(.ar)

#Get your language

EasyLocalization.getLanguage()

#usage in controllers

title = "test navigation title".locale

#usage in storyboard

UIButton title

alt text

UILabel text

alt text

textfield placeholder

alt text

textview text

alt text

UINavigationItem title

alt text

list of languages keys

[
    .en,
    .fr,
    .de,
    .zhHans,
    .zhHant,
    .ja,
    .es,
    .es419,
    .it,
    .nl,
    .ko,
    .ptBR,
    .ptPT,
    .da,
    .fi,
    .nb,
    .sv,
    .ru,
    .pl,
    .tr,
    .ar,
    .th,
    .cs,
    .hu,
    .ca,
    .hr,
    .el,
    .he,
    .ro,
    .sk,
    .uk,
    .id,
    .ms,
    .vi,
    .hi
]

Author

abdelrahman eldesoky, [email protected]

License

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