Reputation: 261
My project includes several targets, each target is used for a different customer. Some customers need specific localization, and I don't want all the customers to get this specific localization. Since localization is handled on the project level, I couldn't find a way to add localization only for a specific target.
Any suggestions how to do it?
Looking for stable option without the need to delete unused localization before each build.
Upvotes: 9
Views: 5817
Reputation: 1954
Use the Build phase script to remove unwanted languages from specific targets. This will not appear in removed languages in the application or Appstore.
select YOUR TARGET goto Build Phase click the '+' on the left top then choose New Run Script Phase then add the following script.
# add language code to remove it during build.
for lang in "hi" "fr"
do
if [ -e "${TARGET_BUILD_DIR}/${PRODUCT_NAME}.app/$lang.lproj" ]; then
rm -r "${TARGET_BUILD_DIR}/${PRODUCT_NAME}.app/$lang.lproj"
else
echo "file does not exists"
fi
done
You can add language codes of languages that you want to remove from your target. The remaining localizations from your PROJECT will reflect in your build.
Upvotes: 2
Reputation: 261
I manage to solve it with @Yitzchak answer + additional changes:
Upvotes: 5
Reputation: 3416
Create a separate "Localizeable.strings" for each target.
link the correct strings files with each "group" of strings.
Then set it in the Build Phases
for each target the correct "strings" like this:
Upvotes: 5