• Stars
    star
    389
  • Rank 107,133 (Top 3 %)
  • Language
    Swift
  • License
    MIT License
  • Created about 7 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Language manager to handle changing app language without restarting the app. It supports iOS and tvOS.


A Language manager to handle changing app language without restarting the app.


ScreenShots

LanguageManager-SwiftUI

For SwiftUI please visit the LanguageManager-SwiftUI

Usage

Youtube: iOS - Support multiple languages (Localization).
Watch the video

First of all, remember to add the Localizable.strings to your project, after adding the Localizable.strings file, select it then go to file inspector and below localization press localize, after that go to PROJECT > Localisation then add the languages you want to support (Arabic for example), dialog will appear to ask you which resource file you want to localize, select just the Localizable.strings file.
Β 
Now, go to your storyboard and add UILable and add text to it, for example "Hello !", then go to your Localizable.strings file expand it, you will find Localizable strings file for English and Arabic, for English, add this line with the string you used in the UILabel inside the storyboard
"Hello !" = "Hello !";
and for Arabic file :
"Hello !" = "Ω…Ψ±Ψ­Ψ¨Ψ§ !";


After that in the `didFinishLaunchingWithOptions` method inside the `AppDelegate.swift` file, set your default language that your app will run first time
LanguageManager.shared.defaultLanguage = .en // you can use .deviceLanguage to keep the device default language.

If you want to change the language use the setLanguage(language:) method by passing to it the new language

  @IBAction func changeLanguage(_ sender: UIButton) {

    let selectedLanguage: Languages = sender.tag == 1 ? .en : .ar

    // change the language
    LanguageManager.shared.setLanguage(language: selectedLanguage)
    { title -> UIViewController in
      let storyboard = UIStoryboard(name: "Main", bundle: nil)
      // the view controller that you want to show after changing the language
      return storyboard.instantiateInitialViewController()!
    } animation: { view in
      // do custom animation
      view.transform = CGAffineTransform(scaleX: 2, y: 2)
      view.alpha = 0
    }
  }

If you have an image and you want to change the direction of the image depending on the language, you can use image direction property, the property can be one of the following values:

-fixed: if the image must not change the direction depending on the language, you need to set the value as 0.

-leftToRight: if the image must change the direction depending on the language and the image is left to right image then you need to set the value as 1.

-rightToLeft: if the image must change the direction depending on the language and the image is right to left image then you need to set the value as 2.

Please check the example project to see how it works.

Installation

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

pod 'LanguageManager-iOS'

Or you can use Carthage.

github "Abedalkareem/LanguageManager-iOS"

You can also use Swift Package Manager.

Support me πŸš€

You can support this project by:

1- Checking my apps.
2- Star the repo.
3- Share the repo with your friends.

Follow me ❀️

Facebook | Twitter | Instagram | Youtube

License

Please check the license file.

More Repositories

1

AMTabView

AMTabView is a custom tab bar with amazing animation.
Swift
202
star
2

games_services

A Flutter plugin to support game center and google play games services.
Dart
117
star
3

AMShimmer

Shimmer help you to add a shimmering effect to any view or table view in your app in very easy way.
Swift
62
star
4

LanguageManager-SwiftUI

A Language manager to handle changing app language without restarting the app.
Swift
58
star
5

MaterialTapTargetPrompt-iOS

An iOS version of Material Tap Target Prompt
Swift
57
star
6

LoveButton

Love button is a custom iOS button with animated effect that showing hearts.
Swift
51
star
7

AMDots

AMDots is a loading indicator for iOS
Swift
50
star
8

Zaina-iOS

A UIKit Game.
Swift
46
star
9

AMChoice

Radio buttons and check boxes for iOS
Swift
45
star
10

Kareem-iOS

Careem App clone
Swift
43
star
11

AMPagerTabs

Pager tabs for iOS
Swift
29
star
12

LanguageManager-iOS-Lokalise

Language manager used to handle change app language.
Swift
25
star
13

simple_widget

A flutter plugin to use the flutter widgets in the native home widgets
Dart
22
star
14

AMProgressHUD

A gif progress HUD for iOS.
Swift
18
star
15

SimpleEngine

A simple 2D game engine to make a simple beautiful iOS/tvOS Games!
Swift
14
star
16

AMTabView-Android

AMTabView is a custom tab bar with amazing animation.
Kotlin
14
star
17

Coronavirus-Flutter

A Flutter app to track Coronavirus outbreak.
Dart
6
star
18

AMDots-Android

AMDots is a loading indicator with dots moving like google loading
Kotlin
6
star
19

NewsApp

News app, an app that lists news and its details. The app support two languages, Arabic and English.
Swift
6
star
20

scale

A flutter package to help you scale your design on all screens sizes to achieve the same design look.
Dart
5
star
21

Nami

A SwiftUI navigator.
Swift
3
star
22

Notes-C

A note taking command line app.
C
1
star
23

MyAppCICD

A simple project for continuous Integration and Delivery using Bitrise and Fastlane tutorial.
Swift
1
star
24

WeatherApp

An app to give you the latest weather forecast built using MVVM architecture with RxSwift and Swinject.
Swift
1
star