-
Notifications
You must be signed in to change notification settings - Fork 58
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
Support SPM localized resources #72
Conversation
iDevelopper
commented
Feb 1, 2021
•
edited by vtourraine
Loading
edited by vtourraine
- Update SPM package definition to support localization
- Add manual configuration example project
- Add SPM configuration example project
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for preparing this pull request 👍
Hello @vtourraine,
I thought it was useful for Mac Catalyst, but I'm not sure now. I will test.
From the documentation:
|
That’s because it’s currently mapped to the “Source” folder, which it can no longer find (renamed to “Sources”). You can select the folder in red, then click on the “location” folder button in the Inspectors pane, to pick a relevant folder. |
Yes but before your changes I had already done it. Is it related to the deletion of the xcworkspacedata? |
That’s possible, I think that depends on how you opened the Xcode project. The problem with the |
Oh wow, that’s awesome! I had never heard of this definition before, thanks for bringing this up! |
Thanks for addressing my previous questions. There’s just one last thing that I need to understand: is there a reason for rewriting the |
I thought your function was a bit complicated and not very pretty! (Sorry!) :-) So I simplified it.
You are the owner! |
Ha ha, that’s fair! If I remember correctly, I originally copy-pasted this code from another popular repo. I’m sure it could be improved, but for now I would prefer to minimize the impact of this pull request. |
I’ll have another look at this part of the code, thanks for the feedback. |
Do you think it could be simpler? |
Add SPM example project Add CocoaPods example project
Yes, significantly simpler! Upon investigation, I’ve realized that the current localization implementation was based on old CocoaPods mechanisms. Still working, but there’s a better solution now with the The real difficulty here is to find a system that works for CocoaPods, SPM, and standalone Xcode project configuration (including Carthage). I think I’ve figured it out, following Apple’s SPM guidelines, with inspiration from https://github.com/TimOliver/TOCropViewController. Please have a look at my latest commit. I’ve added dedicated example projects for SPM and CocoaPods, so it’s easier to check they all work as expected. |
Yes, great! This is what I wanted to do at the beginning following Apple's documentation (https://developer.apple.com/documentation/swift_packages/localizing_package_resources), but I mistakenly thought that you wanted to keep the AcknowList.bundle file! Maybe it would be better to use the Pods-acknowledgments.plist in AcknowExampleCocoaPods too, no? |
With the example projects? I think that’s actually the correct behavior. These projects support English (as Base) and French localization. So the AcknowList title should not be localised if the phone is set in Spanish, for instance, because that would lead to half-translated apps. You can try adding Spanish to the list of supported languages to see the difference. |
I’ve updated the CocoaPods project to use its own acknowledgements file ( |
Got it! |