-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More customization to autoloading #4
base: master
Are you sure you want to change the base?
Conversation
…tions; Also making autoloading in awakeFromNib optional, and exposing the updateLocalization method to manually localize strings
…tions; Also making autoloading in awakeFromNib optional, and exposing the updateLocalization method to manually localize strings
…leDidChangeNotification
… dictionary prior to applying localization
Hi @nobre84 I was not very reactive on Why did you close this PR? Seems interesting to me, maybe I can reopen it if it can still be merged (even if I will surely refactor it to fix your Thanks! |
Hi! I had this PR come from master, and I made more severe change in another aspect of the library not related to the PR's title. I also use Cocoapods extensively, and the Macros defined in the podspec's pch isn't very convenient (each pod install will overwrite any changes), so I took it off and change it in a Podfile's post_install hook. Let me know which of my changes are wanted to improve the library, and I can create a clean branch so you could review / merge in another PR. |
The work you did to support multiple translations seems interesting. Anyway, while using associatedObjects is a good idea to keep the original translation key, I would only use it when we are in the dynamic-language mode. In other words, in the 99% case scenario, I would not add the associatedObjects (that would be useless), and only use your mechanism when the user opt-in for this feature. I'm interesting in your feedback about this, especially provided that PS: Can you be more specific about the Macros defined in the podspec's pch? Didn't get the issue you got with that. |
Hi! I agree with you, dynamic language support and the overhead from associatedObjects to support it should be an opt-in feature. My implementation on this still requires some refactoring, it was made on a hurry to release. Do you recall a more efficient way of storing the original keys or running the localization code in spite of associatedObjects and NSNotificationCenter? |
I think using associatedObjects to keep the original keys is a good idea. Actually I can't seem to think about any other idea that would work for any UIView (except keeping a huge NSDictionary of UIView* pointers as keys and original key as value, but that would complexify the solution and the dictionary won't be emptied when views get deallocated, so that's not a good solution) And yes we would need one subspec for each optional behavior. Another solution (maybe better?) would be to allow the configuration of |
I like the idea of class methods to configure these aspects of the library. However, I think the subspec approach would stil be required for autoloading, as swizzing can only be done safely in +(void)load . Then, the main podspec would be autoload ON, with an optional subspec to turn it OFF. And the regular features such as debugMode, locale, etc configured at runtime. |
Yep, fine by me! Let me know if you need some help with the implied refactoring. Unfortunately I won't have much time lately (especially with all the news around iOS8/iPhone6 ^^) to spend on |
I'm reopening this PR to avoid forgetting about implementing such a behavior some time (unfortunately not anytime soon due to lot of work) |
Hi! Very interesting project you published, thanks very much!
I made some changes that were required for my use case, please check out wether any of it is of interest to the library:
Unfortunately the observer feature introduces a dependency on a platform 6.0 library, LRNotificationObserver which disposes of the observers in the right way easily. I don't know too much about CocoaPods, I think it can be made optional somehow as a sub-pod. It was important to me, I don't know if it is to you