- Notifications
You must be signed in to change notification settings - Fork13
Change language in the app. Simple approach to localize strings/images. Written in Swift.
License
NotificationsYou must be signed in to change notification settings
romansorochak/Localizable
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
- Simple approach to localize strings/images.
- Change app language in the app.
- iOS 9.0+
- Xcode 8.0+
- Swift 3.0+
All logic is inLocalizable.swift file.Just copy thisfile to your project.
- Create Localizable.strings file
- In Localizable.strings file tap Localize button and select english language.
- In project file add supported languages.
- Recommendation: do not localize storyboards or xibs. Make it simpler. Put all your localized strings in Localizable.strings file.
- Reproduce step 2 for needed languages.
Recommendation: do not localize storyboards/xibs. Always set strings from code.
Extend enum Language with appropriate languages used in the project
enumLanguage:String{case english="en"case arabic="ar"case ukrainian="uk" //...
"main_page_language".localized
"flag".localizedImage
To change language just set Language case to Language.language static property.It will change app language and semantic if need.To enable changes it will restart the app within instantiating initial view controller from Main storyboard.
- Important: use appropriate properties described above.
Language.language=Language.english
Roman Sorochak - iOS developer -roman.sorochak@gmail.com
Localizable is released under the MIT license. SeeLICENSE for details.