diff options
author | rowanbeentje <rowan@beent.je> | 2010-06-12 15:20:57 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2010-06-12 15:20:57 +0000 |
commit | 1c89992b2af18acb457819b94f50fee247620d28 (patch) | |
tree | 7ab7503093ab37b96dd709a70a1180881d7a6fcd /Scripts/build.sh | |
parent | 03bdabf809d02a7f76c2fbc02841bb1030c49a47 (diff) | |
download | sequelpro-1c89992b2af18acb457819b94f50fee247620d28.tar.gz sequelpro-1c89992b2af18acb457819b94f50fee247620d28.tar.bz2 sequelpro-1c89992b2af18acb457819b94f50fee247620d28.zip |
- Implement the Wil shipley/Golden % Braeburn localisation method for .xibs; add a build stage to Release/Dist builds which generates .strings files for each nib, and swizzle nib loading to automatically translate strings based on any localised .strings files
- Fix the genstring stage of the build script and move it to Release/Dist builds only
- Update Localizable.strings to match latest code
Diffstat (limited to 'Scripts/build.sh')
-rwxr-xr-x | Scripts/build.sh | 53 |
1 files changed, 43 insertions, 10 deletions
diff --git a/Scripts/build.sh b/Scripts/build.sh index b2822012..bf0749ea 100755 --- a/Scripts/build.sh +++ b/Scripts/build.sh @@ -13,22 +13,55 @@ BUILD_PRODUCT="${BUILT_PRODUCTS_DIR}/${TARGET_NAME}${WRAPPER_SUFFIX}" -echo "Running genstrings to update 'Localizable.strings'..." - -# Update 'Localizable.strings' by running genstrings(1) -GENSTRINGS_ERRORS=$(genstrings -o "${SRCROOT}/Resources/English.lproj" "${SRCROOT}/Source/*.m") - -# Check for genstrings errors -if [ $? -ne 0 ] -then - echo "error: genstrings exited with error: ${GENSTRINGS_ERRORS}" -fi echo 'Updating build version...' # Add the build/bundle version "${SRCROOT}/Scripts/build-version.pl" +# Perform localisation updates for 'Release' or 'Distribution' builds +if [[ "$CONFIGURATION" == 'Release' || "$CONFIGURATION" == 'Distribution' ]] +then + + echo "Running genstrings to update 'Localizable.strings'..." + + # Update 'Localizable.strings' by running genstrings(1) + GENSTRINGS_ERRORS=$(genstrings -o "${SRCROOT}/Resources/English.lproj" "${SRCROOT}/Source/"*.m) + + # Check for genstrings errors + if [[ ${GENSTRINGS_ERRORS} -ne 0 ]] + then + echo "error: genstrings exited with error: ${GENSTRINGS_ERRORS}" + fi + + echo "Updating nib and xib localisations..." + + # Generate up-to-date nib .strings files for localisation + find "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"/**/*.nib | while read nibFile + do + stringsFilePath="${SOURCE_ROOT}/Resources/English.lproj/`basename "${nibFile}" .nib`.strings" + xibFile=`basename "${nibFile}" .nib`.xib + xibFilePath=`echo "${SOURCE_ROOT}"/Interfaces/**/"${xibFile}"` + if [[ -e ${xibFilePath} ]] + then + xibfileModDate=`stat -f "%m" "${xibFilePath}"` + if [[ -e ${stringsFilePath} ]] + then + stringsFileModDate=`stat -f "%m" "${stringsFilePath}"` + else + stringsFileModDate=0 + fi + if [[ ${xibfileModDate} -gt ${stringsFileModDate} ]] + then + printf "\tLocalising ${xibFile}...\n"; + ibtool --generate-stringsfile "${stringsFilePath}~" "${xibFilePath}" + "${BUILT_PRODUCTS_DIR}"/xibLocalizationPostprocessor "${stringsFilePath}~" "${stringsFilePath}" + rm "${stringsFilePath}~" + fi + fi + done +fi + # Trim the application if this is a 'Release' or 'Distribution' build if [[ "$CONFIGURATION" == 'Release' || "$CONFIGURATION" == 'Distribution' ]] then |