3

I have a project in Swift and it uses a few languages (3 at the moment). I added them using "Localizations" tab in Project tab. Then I'd use Editor -> Export for Localization.. to generate an Xliff file which would contain all the NSLocalized strings and translated storyboards in my project. After translating, I'd import Xliff back and it's all done. Very convenient.

I'm also using a few Cocoapods which already have NSLocalizedString's inside, just sitting for me to translate them. The problem is, when exporting my Xliff, it wouldn't pick up any other untranslated strings within my workspace, just within the project.

How would I go about translating those strings and also making sure that they stay there when I pod update next time?

SwiftArchitect
  • 47,376
  • 28
  • 140
  • 179
kernelpanic
  • 2,876
  • 3
  • 34
  • 58

1 Answers1

1

How would I go about translating those strings...

see Localization and CocoaPods.

...making sure that they stay there when I pod update next time?

If you are using public CocoaPods (i.e. from GitHub), it is of good etiquette (if not your duty) to collaborate and clone, localize, then git push back to community. This will ensure that you pod install, as well as everyone else's pod install will contain localized data.


It is a bit of a tedious process, but one adopted by countless Pod projects, including, but not limited to Appirater.

Community
  • 1
  • 1
SwiftArchitect
  • 47,376
  • 28
  • 140
  • 179
  • I barely understand how ``NSLocalizedString``'s work and you're talking etiquette or duty? That's why I asked this question in the first place using ``Swift``. Btw thanks for editing it out and pointing to and ``obj-c`` answer, which I had already seen before anyway. – kernelpanic Jul 29 '15 at 07:32
  • The **Swift** version of the **Obj-C** response is now posted on http://stackoverflow.com/questions/12874678/localization-and-cocoapods/31695008#31695008. I understand your frustration on `CocoaPods` ethics, and recommend you explore sharing your hard work. – SwiftArchitect Jul 29 '15 at 08:25
  • Ok, thanks for the Swift version. So where do I put my translations? As they are now - in Localizable.string files? and how do I use this swift method? The original author talks about macros, but I'm not sure what those are in Swift. – kernelpanic Jul 30 '15 at 06:16