{"id":17330075,"url":"https://github.com/stevensorial/smlocalize","last_synced_at":"2025-12-12T06:03:12.950Z","repository":{"id":62454062,"uuid":"180592454","full_name":"StevenSorial/SMLocalize","owner":"StevenSorial","description":"An iOS library for changing localization at runtime","archived":false,"fork":false,"pushed_at":"2019-08-28T03:06:35.000Z","size":113,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-01T12:49:21.653Z","etag":null,"topics":["cocoapods","ios","language","localization","swift","xcode"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/StevenSorial.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-04-10T13:53:03.000Z","updated_at":"2020-12-06T07:37:05.000Z","dependencies_parsed_at":"2022-11-01T23:45:52.406Z","dependency_job_id":null,"html_url":"https://github.com/StevenSorial/SMLocalize","commit_stats":null,"previous_names":["stevenmagdy/smlocalize"],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StevenSorial%2FSMLocalize","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StevenSorial%2FSMLocalize/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StevenSorial%2FSMLocalize/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StevenSorial%2FSMLocalize/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StevenSorial","download_url":"https://codeload.github.com/StevenSorial/SMLocalize/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245791927,"owners_count":20672669,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cocoapods","ios","language","localization","swift","xcode"],"created_at":"2024-10-15T14:50:15.944Z","updated_at":"2025-12-12T06:03:07.659Z","avatar_url":"https://github.com/StevenSorial.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SMLocalize [![Version](https://img.shields.io/cocoapods/v/SMLocalize.svg?style=flat)](https://cocoapods.org/pods/SMLocalize) [![Swift 5](https://img.shields.io/badge/swift-5.0-orange.svg?style=flat)](https://developer.apple.com/swift/) [![License](https://img.shields.io/github/license/StevenMagdy/SMLocalize.svg?style=flat)](https://cocoapods.org/pods/SMLocalize) [![Platform](https://img.shields.io/cocoapods/p/SMLocalize.svg?style=flat)](https://cocoapods.org/pods/SMLocalize)\n\n### An iOS library for changing localization at runtime.\n---\n**Requirements**: iOS 9.0+ \u0026bull; Swift 5.0+\n\n## Basic Usage\n\nIn your AppDelegate:\n\n```swift\nimport SMLocalize\n\n@UIApplicationMain\nclass AppDelegate: UIResponder, UIApplicationDelegate, ReloadableAppDelegate {\n\n  var window: UIWindow?\n\n  func application(_ application: UIApplication,\n                   didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -\u003e Bool {\n    // Uncomment the next line if u want to use Arabic as the default language at the first app launch before the user changes the language manually.\n    // SMLocalize.defaultLanguage = \"ar\"\n    SMLocalize.configure()\n    reload()\n    return true\n  }\n\n  func reload() {\n    if window == nil {\n      window = UIWindow(frame: UIScreen.main.bounds)\n      window!.makeKeyAndVisible()\n    }\n    let storyboard = UIStoryboard(name: \"Main\", bundle: nil)\n    let vc = storyboard.instantiateInitialViewController()\n    window!.rootViewController = vc\n  }\n}\n```\n\nThen in your change language action:\n```swift\nimport SMLocalize\n\nclass ViewController: UIViewController {\n...\n...\n@IBAction func changeLanguageTapped(_ sender: UIButton) {\n  SMLocalize.currentLanguage = \"ar\" // Your new language\n  SMLocalize.reloadAppDelegate()\n  }\n}\n```\n\n## Animation\nPlaying an animation during language changes.\n\nIn your change language action:\n```swift\nimport SMLocalize\n\nclass ViewController: UIViewController {\n...\n...\n@IBAction func changeLanguageTapped(_ sender: UIButton) {\n  SMLocalize.currentLanguage = \"ar\" // Your new language\n  // Optional animation. Change to nil if not needed.\n  SMLocalize.reloadAppDelegate(animation: [.transitionFlipFromRight, .curveEaseOut], duration: 0.3)\n  }\n}\n```\n\n## Default Language\nSetting a default language to be set on the first app launch before the user changes the language.\n\nIn your AppDelegate:\n\n```swift\nimport SMLocalize\n\n@UIApplicationMain\nclass AppDelegate: UIResponder, UIApplicationDelegate, ReloadableAppDelegate {\n\n  var window: UIWindow?\n\n  func application(_ application: UIApplication,\n                   didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -\u003e Bool {\n    SMLocalize.defaultLanguage = \"ar\" // Must be set before SMLocalize.configure()\n    SMLocalize.configure()\n    reload()\n    return true\n  }\n}\n```\n\n## Flipping Images\nFlipping images to match the current language direction, e.g., Arrows.\n\nIn your AppDelegate:\n\n```swift\nimport SMLocalize\n\n@UIApplicationMain\nclass AppDelegate: UIResponder, UIApplicationDelegate, ReloadableAppDelegate {\n  func application(_ application: UIApplication,\n                   didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -\u003e Bool {\n    SMLocalize.configure()\n    // Flip images in views with tags from 1 to 10\n    // Avoid including 0 in this set since it will cause UIKit issues.\n    SMLocalize.flipImagesInViewsWithTags = Set(1...10)\n    return true\n  }\n}\n```\nIn your ViewController:\n```swift\nimport SMLocalize\n\nclass ViewController: UIViewController {\n...\n...\n override func viewDidLoad() {\n    super.viewDidLoad()\n    arrowImgToFlip.tag = 1\n    anotherImgToFlip.tag = 2\n    myContainerView.tag = 5\n    imgInsideMyContainerView.tag = 6\n  }\n}\n```\n\n#### Views that supports flipping its images:\n\n| View | Does support flipping its images? | Note |\n| :---: | :---: | :---: |\n| UIImageView | ✅ | _ |\n| UIButton | ✅\u003cbr\u003e(For all states) | _ |\n| UISlider | ✅ Thumb Image (For all states)\u003cbr\u003e✅ minimumValueImage\u003cbr\u003e✅ maximumValueImage\u003cbr\u003e❌ minimumTrackImage\u003cbr\u003e❌ maximumTrackImage| _ |\n| UICollectionViewCell | ❌ |Use\u003cbr\u003eUIImage.imageFlippedForRightToLeftLayoutDirection()\u003cbr\u003ein  your cellForItem delegate function |\n| UITableViewCell| ❌ |Use\u003cbr\u003eUIImage.imageFlippedForRightToLeftLayoutDirection()\u003cbr\u003ein your cellForRow delegate function |\n\n\n## Example for more information about how to use the library\n\nTo run the example project, clone the repo, and open SMLocalizeExample.xcworkspace from the Example directory.\n\n## Installation\n\nSMLocalize is available through [CocoaPods](https://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod 'SMLocalize'\n```\n\n## TODO\n\n- [ ] Support installation through Carthage \u0026 Swift Package Manager (Help Needed)\n- [ ] Localize Views with Text automatically\n- [ ] Improve the library API?\n\n## Credit\n\n### Other Libraries\nSMLocalize was inspired by these libraries. Uses the same techniques in some parts and deviates in others.\n\n- [MOLH](https://github.com/MoathOthman/MOLH)\n- [Localize-Swift](https://github.com/marmelroy/Localize-Swift)\n- [LanguageManager-iOS](https://github.com/Abedalkareem/LanguageManager-iOS)\n\n### Articles\n\n- [Forcing iOS localization at runtime — the right way](https://medium.com/swift2go/forcing-ios-localization-at-runtime-the-right-way-8afa0569162a) (by [Eldar Eliav](https://github.com/eldare))\n\n## Author\n\nSteven, StevenMagdy92@gmail.com\n\n## License\n\nSMLocalize is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstevensorial%2Fsmlocalize","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstevensorial%2Fsmlocalize","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstevensorial%2Fsmlocalize/lists"}