1 SYS_MO="$HOME/sbs/target-armel/usr/share/locale/en/LC_MESSAGES/sys_string.mo"
2 APP_MO="$HOME/sbs/target-armel/opt/apps/org.tizen.memo/res/locale/en/LC_MESSAGES/memo.mo"
11 out=../include/"$APP_NAME""_string.h"
14 sbs -et apt-get install sys-string-0 -y --force-yes
16 function get_str_id () {
20 if [[ -e $mo ]] ; then
21 result=`msgunfmt $mo | grep "\"$str\"" -B 1 | head -n 1 | awk '{print $2}'`
26 function get_tmp_id () {
29 if [[ -e $TEMP_STR ]] ; then
30 result=`cat $TEMP_STR | grep "$str" -A 1 | tail -n 1 | awk '{print $1}'`
38 local id=$prefix`echo $str | tr a-z A-Z | sed "s/ /_/g" | sed "s/?//g" | sed "s/%//g"`
45 printf "$str\n" >> $dest
49 cat ./copyright > $out
51 dump $out "#ifndef __MEMO_STRING_H__"
52 dump $out "#define __MEMO_STRING_H__"
54 LINES=`cat $IN |wc -l`
55 for (( i=1; i<=$LINES; i++ )) ; do
56 string=`cat $IN | sed -n "$i p"`
57 sys_id=$(get_str_id "$string" "$SYS_MO")
58 app_id=$(get_str_id "$string" "$APP_MO")
59 tmp_id=$(get_tmp_id "$string")
60 if [ "$sys_id" != "" ] ; then
61 SYS_ID[${#SYS_ID[@]}]=$(gen_id "MEMO_I18N_" "$string") #append id to array
62 SYS_ID[${#SYS_ID[@]}]="dgettext(\"sys_string\", $sys_id) /* $string */" #append def to array
63 elif [ "$app_id" != "" ] ; then
64 APP_ID[${#APP_ID[@]}]=$(gen_id "MEMO_I18N_" "$string")
65 APP_ID[${#APP_ID[@]}]="dgettext(\"memo\", $app_id) /* $string */"
66 elif [ "$tmp_id" != "" ] ; then
67 CUSTOM_ID[${#CUSTOM_ID[@]}]=$(gen_id "MEMO_I18N_" "$string")
68 CUSTOM_ID[${#CUSTOM_ID[@]}]="dgettext(\"memo\", \"$tmp_id\") /* $string */"
70 CUSTOM_ID[${#CUSTOM_ID[@]}]=$(gen_id "MEMO_I18N_" "$string")
71 CUSTOM_ID[${#CUSTOM_ID[@]}]="_(\"$string\") /* $string */"
77 dump $out "/* system string */"
78 for (( i=0; i<${#SYS_ID[@]} ; i+=2 )) ; do
79 printf "#define %-36s %s\n" ${SYS_ID[$i]} "${SYS_ID[$i+1]}">> $out
82 dump $out "/* app string */"
83 for (( i=0; i<${#APP_ID[@]} ; i+=2 )) ; do
84 printf "#define %-36s %s\n" ${APP_ID[$i]} "${APP_ID[$i+1]}">> $out
87 dump $out "/* custom string */"
88 for (( i=0; i<${#CUSTOM_ID[@]} ; i+=2 )) ; do
89 printf "#define %-36s %s\n" "${CUSTOM_ID[$i]}" "${CUSTOM_ID[$i+1]}" >> $out
93 dump $out "#endif /* __MEMO_STRING_H__ */"