Batch localization using IBTools?

Is there a way to run IBTools in a bunch of NIB files with a single command? I am trying to extract strings from NIB. Should I run ibtools once for each NIB?

It is very difficult for me to run IBTools so many times. (I only have 9 NIB files. It could be worse ...)

+7
source share
2 answers

I don't think ibtool can take multiple files as an argument. The only thing I see is to write a bash script to complete this task.

#!/bin/bash find . -name "*.xib" | while read FILENAME; do ibtool --export-strings-file $FILENAME.strings $FILENAME done 
+8
source

Here is a more fully functional script that I used for the same operation:

 #!/bin/bash # Argument = -o output_dir -i input_dir usage() { cat << EOF usage: $0 [options] This script generates strings files from all xibs in a given directory. OPTIONS: -h Show this message -i Input directory where XIBs are located [./] -o Output directory where .strings files will be generated EOF } INPUT_DIRECTORY="." OUTPUT_DIRECTORY="." while getopts "hi:o:" OPTION do case $OPTION in h) usage exit 1 ;; i) INPUT_DIRECTORY=$OPTARG ;; o) OUTPUT_DIRECTORY=$OPTARG ;; ?) usage exit ;; esac done if [[ -z $INPUT_DIRECTORY ]] || [[ -z $OUTPUT_DIRECTORY ]] then usage exit 1 fi # do the generation find $INPUT_DIRECTORY -name "*.xib" | while read FILENAME; do XIBNAME=$(basename "$FILENAME") XIBNAME="${XIBNAME%.*}" ibtool --generate-strings-file $OUTPUT_DIRECTORY/$XIBNAME.strings $FILENAME done 
+3
source

All Articles