@@ -149,7 +149,43 @@ then
149149
150150 if [ -e " ${SRCROOT} /ResourcesToCopy" ]
151151 then
152- find " ${SRCROOT} /ResourcesToCopy" \( -name " *.lproj" \) | while read FILE; do ; printf " \tCopying localization: ${FILE} \n" ; cp -R " $FILE " " ${BUILD_PRODUCT} /Contents/Resources/" ; done ;
152+ TRANSLATIONS_BASE=" ${SRCROOT} /languagetranslations"
153+ IBSTRINGSDIR=" ${SRCROOT} /ibstrings"
154+ XIB_BASE=" ${SRCROOT} /Interfaces/English.lproj"
155+ rm -rf " ${IBSTRINGSDIR} " & > /dev/null
156+ rm -rf " ${TRANSLATIONS_BASE} " & > /dev/null
157+
158+ echo " Creating IB strings files for rekeying..."
159+ cp -R " ${SRCROOT} /ResourcesToCopy" " ${TRANSLATIONS_BASE} "
160+ mkdir -p " $IBSTRINGSDIR /English.lproj"
161+ find " ${XIB_BASE} " \( -name " *.xib" \) | while read FILE; do
162+ ibtool " $FILE " --export-strings-file " $IBSTRINGSDIR /English.lproj/` basename " $FILE " .xib` .strings"
163+ done
164+
165+ echo " Rekeying localization files, translating xibs, merging localizations..."
166+ find " ${TRANSLATIONS_BASE} " \( -name " *.lproj" \) | while read FILE; do
167+ loc=` basename " $FILE " `
168+ mkdir " $IBSTRINGSDIR /$loc "
169+ printf " \tProcessing: $loc \n"
170+ find " $FILE " \( -name " *.strings" \) | while read STRFILE; do
171+ file=` basename " $STRFILE " .strings`
172+ ibkeyfile=" $IBSTRINGSDIR /English.lproj/$file .strings"
173+ xibfile=" $XIB_BASE /$file .xib"
174+ transfile=" $IBSTRINGSDIR /$loc /$file .strings"
175+ if [ -e " $ibkeyfile " ] && [ -e " $xibfile " ]; then
176+ " ${BUILT_PRODUCTS_DIR} /xibLocalizationPostprocessor" " $STRFILE " " $ibkeyfile " " $transfile "
177+
178+ # we no longer need the original file and don't want to copy it
179+ rm -f " $STRFILE "
180+
181+ ibtool " $xibfile " --import-strings-file " $transfile " --compile " ${TRANSLATIONS_BASE} /$loc /$file .nib"
182+ fi
183+ done
184+ cp -R " $FILE " " ${BUILD_PRODUCT} /Contents/Resources/"
185+ done
186+
187+ rm -rf " ${IBSTRINGSDIR} " & > /dev/null
188+ rm -rf " ${TRANSLATIONS_BASE} " & > /dev/null
153189 else
154190 echo ' No localizations to copy.'
155191 fi
0 commit comments