Handle language change within iOS App in auto layout

后端 未结 1 645
北恋
北恋 2021-01-16 10:17

In our app, we have to support English and Arabic languages but the language changing option is available within the app itself. Earlier we have handled the right to left an

相关标签:
1条回答
  • 2021-01-16 10:57

    I need clarifications in that, Is there any solution to change this (language within the app) without restarting the app?

    Yes, there is! if you are already handled changing the language by checking AppleLanguages global key and using Auto Layout, it should be easy to do such a functionality.

    The solution would be switching the lproj bundle in order to get it localized without restarting the app, you should do Method Swizzling to achieve it.

    I'd recommend to check Working with Internationalization and Localization in swift article, it will guides you clearly to do it from scratch (It works fine for me). After following along with it, the output should be similar to:


    Also, you might want to check Localize-Swift library (Actually, I didn't use it).

    Hope this helped.

    0 讨论(0)
提交回复
热议问题