The localization key can be easily maintained using the power of enum. This demo project provides a top-level view of how enum needs to be used to achieve an organized, structured and scalable localization scenario for the iOS application. Generic and screen-based localization text has been considered as well.
- In LocalizedString enum, add Generic action, label, alerts etc. (LocalizedString.swift)
- Add screen wise localization in LocalizedString extension. (LocalizedStringExtension.swift)
- Add the localization strings in Localizable.strings file. Use proper naming conventions and structure the keys according to the screen name.
- Use localization in the controller using the easy and flexible syntax - For example LocalizedString.DemoScreen.title, LocalizedString.DemoScreen.Label.name. (ViewController.swift)