9

I'm developing an app that, among other things, will play a large audio file (30MB).

I want to submit the app to the App Store in several countries. The audio file is different per target country, the rest of the app remains the same (Although localized).

I've created a target for each country, a bash script takes care of copying the correct audio file into compiled app based on the target, and it works great.

I've also localized the ressources (Images and Localized.strings) to make it easy to maintain.

Let's say I built my target for Sweden, I want to include only the swedish localization to force the app to always show swedish language (Which matches the audio file).

Here's the actual question:* How do I exclude all localizations from a target or force a target to ONLY use a specific localization, regardless of phone settings?

Kim Biesbjerg
  • 441
  • 4
  • 9

3 Answers3

0

I think you might be able to pull it of by going to:

Target Settings => Info => Add a new row called Localizations => Add a new element to that array with the kind of language you want (I think the default is english)

I haven't tested it, just let me know if it worked.

Rui Peres
  • 25,741
  • 9
  • 87
  • 137
0

If I understand your question, you don't actually need a localized app, or at least not a fully localized one. If that is the case, I would use a run-script build phase which is responsible for copying the appropriate non-localized but target-specific resources based on the current target. E.g. supposing you have an Audio folder in your project root with all the versions for the different languages, your script could look like:

cp "$PROJECT_DIR/Audio/$TARGETNAME.mp3" "$TARGET_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH/audio.mp3"

which would e.g. copy/rename "Swedish.mp3" to "audio.mp3" directly accessible from the bundle.

Lvsti
  • 1,525
  • 15
  • 15
  • That's the approach I'm using right now for the audio file. I'm just wondering though, if it isn'n possible to use XCode's built-in localization tools, since it makes it simpler to manage the files (Edit the localized xib-files and so on). It seems all I need is a way to hardcode the locale used for a specific target. Your suggestion is the route I will take if I don't find a better method :-) *Crossing fingers* PS. How do you insert line breaks here? Two spaces doesn't seem to do it for me? – Kim Biesbjerg May 07 '12 at 21:16
  • To my understanding, localization is meant for providing various versions of a resouce within the same target, thus forcing Xcode to discard localizations it otherwise detects wouldn't really make much sense... – Lvsti May 07 '12 at 21:59
  • Yeah, but I mean, you should at least be able to tell it not to use specific localizations, even though a folder with the locale name is there. I have 2 translations that are not finished in my app, 3 others that are ready for app store. But because the two unfinished translations can be autodetected and used I can't submit my app before I get the translations back from the translator (Or delete the work I've done so far on the nib files and start all over once I get the translations). Hope I'm missing something! – Kim Biesbjerg May 07 '12 at 22:07
0

Based on your comment in answer to Lvsti (where you say the reason you're doing this is that translations in some of your languages aren't finished yet but you want to release what you have), perhaps as an alternative to deleting all the relevant localization files or messing with your build settings you can try to edit the list of languages in your XCode project? It's not per target but per project, but it might allow you to exclude languages you don't want in your build. See under Localizations in your project settings (there's a little - icon you can use to remove a language).

enter image description here

Clafou
  • 15,250
  • 7
  • 58
  • 89
  • This seems to be a good way to omit unfinished localizations for now - Optimally this setting was per target, but oh well, maybe in the future! Thanks! – Kim Biesbjerg May 08 '12 at 17:28