marmelroy / Localize-Swift

Swift friendly localization and i18n with in-app language switching
MIT License
3.08k stars 330 forks source link

Does this work with 8.3 Xcode? #71

Open rlam3 opened 7 years ago

rlam3 commented 7 years ago

Does this work with 8.3 Xcode?

ecdfeaa2 commented 7 years ago

It seems to work well

rlam3 commented 7 years ago

I'm getting a weird error that i cannot run the ./genstrings file. How do I run this file?

Would love to see a video tutorial for this cocoapod. Thanks!

rlam3 commented 7 years ago

@RemyDCF How do we localize storyboard labels with use of localize-swift? It doesn't seem to be pickup the localizations/labels from storyboard. Thanks!

ecdfeaa2 commented 7 years ago

Unfortunately, If you want to localize statics objects in storyboards, you can't use the genstrings.swift file, because this script will search all .localized() and NSLocalizedString (and others function to localize) in your project. The Storyboard is using a separate strings file, and instead of using a custom key, you have to use the storyboard iD of the object.

I made a little video to show you by image: https://youtu.be/HEuB7swacP0

In this video, you can see that:

  1. I'm checking that Storyboard have localized files
  2. I'm getting the Storyboard iD of the object
  3. I'm using this Storyboard iD to localize the object in Storyboard.strings.

Otherwise, you can use add an outlet to your view to change the text in your code with .localized() or NSLocalizedString

ecdfeaa2 commented 7 years ago

And if you don't find the genstrings.swift file, you can copy this to your folder. You can run it with swift genstrings.swift > Localizable.swift. It's will work even if you don't have Localize-Swift in your project.

rlam3 commented 7 years ago

@RemyDCF So in essence, if I translate the storyboards via the Localize button on the right pane. Will Localize Swift pick up those elements? Or should I leave Storyboard Static string seperate from the string localization all together? Thanks!

I'm also looking at BartyCrouch.. Was wondering what your thoughts on this were as well

https://github.com/Flinesoft/BartyCrouch

ecdfeaa2 commented 7 years ago

Seems to be another solution. I think you can use it for translate storyboards. Good luck!

willpowell8 commented 7 years ago

This library works with Xcode 8.3 and Xcode 9: https://github.com/willpowell8/LocalizationKit_iOS