How to localize to specific targets in my Xcode project? - localization

I have multiple targets in my project, and only one target needs to be using localized strings. How do I make it so only that target will be localized (with .lproj) and the rest continues to use the development language? Currently Xcode allows you to add Localization to the entire project, not a specific target.

Related

Exclude specific library from one configuration from Xcode?

I have defined 3 configurations for my project: development, release and testing. I want to exclude one library from release builds (only used for testing purposes).
Is there any simple option how to do that from Xcode?
I want to achieve same like Exclude specific library from one build variant in android but for iOS specific configurations/scheme.
Is that even possible in Xcode? Or I have to do it in different location/tool (PodFile)?

Multiple Frameworks different targets XCode

If there are say 2 frameworks(framework-test,framework-live), one pointing to a test area and the other to live environment is there any way to keep both in the same xcode project and just change based on target or some flag?

Target specific localization in swift?

I have a project with multiple targets.
Most localizations are shared by all targets.
I have them in Localizable.strings.
In addition, each target has strings to localize that occur only in that target.
Is there a preferred way to have an additional target specific .strings file?
If so, how can I use NSLocalizedString to search localizations
in Localizable.strings and/or the target specific .strings?
Technically I could put all localizations for all targets into Localizable.strings and deploy the with all targets (No problem, there are no target specific localizations for the same string).
But this would a little messy to maintain.
So is there a way to use a target specific additional .strings file?

What targets should I be adding my files to in my xcode project

I'm working on an xcode app using swift and xcode 8.1.
I keep adding files such as pictures and .plist files to my main folder with my storyboard, but each time it asks what targets I want to add it to. Should I be adding it to my test targets as well? If so, why? Whats the rule to know what targets to add it to.
No, you shouldn't add your files to the test target. Unit test target has access to your application files anyway.
According to the Apple documentation, target is a single build artifact. Because of that, you should only add the files which are building blocks of a specific target.
A target specifies a product to build and contains the instructions for building the product from a set of files in a project or workspace. A target defines a single product; it organizes the inputs into the build system—the source files and instructions for processing those source files—required to build that product. Projects can contain one or more targets, each of which produces one product.
For the most basic scenario with one application target and two test targets the general rule is as follows
Add application classes to the application target.
Add unit test case classes to the unit tests target.
Add UI test classes to the ui tests target.
In more complex scenarios you can have more targets in your application. You can have iMessage extension, share extension etc. You can also have multiple targets for building variants of the same applications but the general rule stays the same.

Split localized iOS app into separate apps

I have a dual language localized app that is intended for enterprise distribution and for my purposes, it would be desirable to split it into two separate apps. Some users of the app would need to use both language versions and it would be easier for them to just open a different app than to go into settings and change language each time they want to switch.
What is the easiest way to split such an app into two targets, considering it already has a couple of localized strings files (for text and for InfoPlist) and several language-specific image folders?
Create a new target (one project might have more than 1 target), with a different bundle identifier.
Add a preprocessor macro, e.g. SECONDARY_LANGUAGE=1, into the new target's Build Settings so you'll know which language is being used. You can check for language inside the code with something like
#if (SECONDARY_LANGUAGE)
...
#else
...
#endif

Resources