AALocalizationKit

AALocalizationKit is really helpful to maintain multiple languages in the application with their custom language fonts and an ability to change the language within your application!

Demo

Demonstration

AALocalizationKit is easily configured framework to configure multiple languages in the iOS application.

Demo

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

Requirements

  • iOS 10.0+
  • Xcode 11.0+
  • Swift 5+

Installation

AALocalizationKit can be installed using CocoaPods, Carthage, or manually.

CocoaPods

AALocalizationKit is available through CocoaPods. To install CocoaPods, run:

$ gem install cocoapods

Then create a Podfile with the following contents:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!

target '<Your Target Name>' do
pod 'AALocalizationKit'
end

Finally, run the following command to install it:

$ pod install

Carthage

To install Carthage, run (using Homebrew):

$ brew update
$ brew install carthage

Then add the following line to your Cartfile:

github "EngrAhsanAli/AALocalizationKit" "master"

Then import the library in all files where you use it:

import AALocalizationKit

Manual Installation

If you prefer not to use either of the above mentioned dependency managers, you can integrate AALocalizationKit into your project manually by adding the files contained in the Classes folder to your project.

Getting Started


Just need to configure the supporting languages for Localization within your the iOS application in you AppDelegate didFinishLaunchingWithOptions method.

Following is the example to configure this with following languages support.

Usage:


func configureAALK() {
    let languageFont: [AALanguage : [UIFont.Weight : String]] = [
        .ar : [.regular: "Jomhuria"],
        
        .zhHans : [.regular: "Chibrush"],
        
        .fr : [.regular: "MuchaFrenchCapitals"],
        
        .de : [.regular: "LemonadeStand"],
        
        .en : [.regular: "Roboto-Regular",
               .medium: "Roboto-Medium",
               .bold: "Roboto-Bold"],
        
        .ja : [.regular: "NotoSerifJP-Regular",
               .medium: "NotoSerifJP-Medium",
               .bold: "NotoSerifJP-Bold"]
    ]
            
    AALK.configuration.languageFont = languageFont
    AALK.configuration.defaultFont = "Roboto"
}

Now just update the language in your view controller

let languageNames = AALK.bundleLanguageNames // get all bundle languages
let lang = AALK.languages[index] // where index is the language index for specific langauge
AALK.currentLanguage = lang // Set the language within your application

/// NOW YOU JUST NEED TO RECALL YOUR VIEW OR VIEW CONTROLLER TO SEE THE CHANGES

GitHub