phrase / ios-sdk

Phrase Over the Air iOS SDK
https://phrase.com
Other
14 stars 3 forks source link

Add swizzling support for NSLocalizedString function invocation with bundle parameter. #25

Closed michalmludzik closed 3 years ago

michalmludzik commented 3 years ago

As modular architecture in mobile development becomes more popular, there is a need of supporting OTA updates of Localizable resources stored in different Bundles. Current PhraseSDK assumes that every module uses the resources stored in the main Application Bundle thus swizzling the NSLocalizedString method invocations that don't pass the bundle parameter only.

In the mentioned architecture the App is divided into functional modules horizontally and vertically. Vertical division could be realised in a way that every flow of the app is developed as a separate framework containing all the required resources for it's operation. With that assumption it is reasonable that each module has the Localizable.strings file containing all the translations used in that particular module. If we take as an example a bank application, the money transfer flow might end up in a different module than the history screen. Each module uses the resources that are stored in that module or in some cases a shared module that is reused by a subset of the modules. A further description of such architecture can be found here: modular architecture iOS.

1*saKX3Dssawi-Z4zT0mNRmQ

To fully support Phrase OTA updates for applications following that architecture an iOS SDK is needed that would allow the user to point to the Bundle that is used for the strings files storage on initialisation. Each module could then have it's own instance of the PhraseSDK and synchronise with a separate project while still using the native NSLocalizedString calls passing the corresponding bundle parameter.

winkelsdorf commented 3 years ago

@michalmludzik Thank you for your enhancement suggestion. I forwarded this to the team for an internal discussion.

michalmlu commented 3 years ago

@winkelsdorf Any update on the issue?

KoCMoHaBTa commented 3 years ago

@winkelsdorf I'm also looking for support on this topic.

winkelsdorf commented 3 years ago

@michalmlu et al. Sorry for the delay, I was on winter holiday. No, unfortunately not. I passed it on at the time. I am not responsible for this feature request, so I would kindly ask you to contact the official support channel.

michalmlu commented 3 years ago

@winkelsdorf - What is the official support channel, cause I have been directed here after talking to Customer Support team?

winkelsdorf commented 3 years ago

@michalmlu Thanks your feedback, sorry about that, of course that wasn't supposed to happen.

@theSoenke Could you please take care of this?

theSoenke commented 3 years ago

Hey @michalmlu, after some discussions with the team, we came to the conclusion that we won't be adding support for NSLocalizedString swizzling with different bundles in the near future. The feature would require a significant re-architecture of the SDK and possibly the backend and we simply don't have enough resources for it. We are sorry if this means the SDK is not usable in your project.