aboutsummaryrefslogtreecommitdiff
path: root/contrib/extract_translations
diff options
context:
space:
mode:
authorEvgeniy Khramtsov <ekhramtsov@process-one.net>2013-04-08 11:12:54 +0200
committerChristophe Romain <christophe.romain@process-one.net>2013-06-13 11:11:02 +0200
commit4d8f7706240a1603468968f47fc7b150b788d62f (patch)
tree92d55d789cc7ac979b3c9e161ffb7f908eba043a /contrib/extract_translations
parentFix Guide: ejabberd_service expects a shaper_rule, not a shaper (diff)
Switch to rebar build tool
Use dynamic Rebar configuration Make iconv dependency optional Disable transient_supervisors compile option Add hipe compilation support Only compile ibrowse and lhttpc when needed Make it possible to generate an OTP application release Add --enable-debug compile option Add --enable-all compiler option Add --enable-tools configure option Add --with-erlang configure option. Add --enable-erlang-version-check configure option. Add lager support Improve the test suite
Diffstat (limited to 'contrib/extract_translations')
-rw-r--r--contrib/extract_translations/extract_translations.erl14
-rwxr-xr-xcontrib/extract_translations/prepare-translation.sh14
2 files changed, 20 insertions, 8 deletions
diff --git a/contrib/extract_translations/extract_translations.erl b/contrib/extract_translations/extract_translations.erl
index 90f4ac519..97bef684c 100644
--- a/contrib/extract_translations/extract_translations.erl
+++ b/contrib/extract_translations/extract_translations.erl
@@ -91,6 +91,16 @@ parse_form(Dir, File, Form, Used) ->
{call,
_,
{remote, _, {atom, _, translate}, {atom, _, translate}},
+ [_,
+ {bin,_,
+ [{bin_element,_,
+ {string,Line,Str},
+ default,default}]}]
+ } ->
+ process_string(Dir, File, Line, Str, Used);
+ {call,
+ _,
+ {remote, _, {atom, _, translate}, {atom, _, translate}},
[_, {var, _, Name}]
} ->
case ets:lookup(vars, Name) of
@@ -281,8 +291,8 @@ build_additional_translators(List) ->
List).
print_translation(File, Line, Str, StrT) ->
- StrQ = ejabberd_regexp:greplace(Str, "\\\"", "\\\\\""),
- StrTQ = ejabberd_regexp:greplace(StrT, "\\\"", "\\\\\""),
+ StrQ = ejabberd_regexp:greplace(list_to_binary(Str), <<"\\\"">>, <<"\\\\\"">>),
+ StrTQ = ejabberd_regexp:greplace(list_to_binary(StrT), <<"\\\"">>, <<"\\\\\"">>),
io:format("#: ~s:~p~nmsgid \"~s\"~nmsgstr \"~s\"~n~n", [File, Line, StrQ, StrTQ]).
print_translation_obsolete(Str, StrT) ->
diff --git a/contrib/extract_translations/prepare-translation.sh b/contrib/extract_translations/prepare-translation.sh
index 9f2d54ad6..fcc58cb27 100755
--- a/contrib/extract_translations/prepare-translation.sh
+++ b/contrib/extract_translations/prepare-translation.sh
@@ -15,13 +15,14 @@ prepare_dirs ()
ERL=`which erl`
EJA_SRC_DIR=$EJA_DIR/src/
- EJA_MSGS_DIR=$EJA_SRC_DIR/msgs/
+ EJA_MSGS_DIR=$EJA_DIR/priv/msgs/
EXTRACT_DIR=$EJA_DIR/contrib/extract_translations/
EXTRACT_ERL=$EXTRACT_DIR/extract_translations.erl
EXTRACT_BEAM=$EXTRACT_DIR/extract_translations.beam
SRC_DIR=$RUN_DIR/src
- MSGS_DIR=$SRC_DIR/msgs
+ EBIN_DIR=$RUN_DIR/ebin
+ MSGS_DIR=$EJA_DIR/priv/msgs
if !([[ -n $EJA_DIR ]])
then
@@ -155,7 +156,8 @@ extract_lang_srcmsg2po ()
echo $MSGS_PATH
- $ERL -pa $EXTRACT_DIR -pa $SRC_DIR -pa $EJA_SRC_DIR -pa /lib/ejabberd/include -noinput -noshell -s extract_translations -s init stop -extra -srcmsg2po . $MSGS_PATH >$PO_PATH.1
+ cd $SRC_DIR
+ $ERL -pa $EXTRACT_DIR -pa $EBIN_DIR -pa $EJA_SRC_DIR -pa /lib/ejabberd/include -noinput -noshell -s extract_translations -s init stop -extra -srcmsg2po . $MSGS_PATH >$PO_PATH.1
sed -e 's/ \[\]$/ \"\"/g;' $PO_PATH.1 > $PO_PATH.2
msguniq --sort-by-file $PO_PATH.2 --output-file=$PO_PATH
@@ -174,7 +176,7 @@ extract_lang_src2pot ()
echo "" >>$MSGS_PATH
cd $SRC_DIR
- $ERL -pa $EXTRACT_DIR -pa $SRC_DIR -pa $EJA_SRC_DIR -pa /lib/ejabberd/include -noinput -noshell -s extract_translations -s init stop -extra -srcmsg2po . $MSGS_PATH >$POT_PATH.1
+ $ERL -pa $EXTRACT_DIR -pa $EBIN_DIR -pa $EJA_SRC_DIR -pa /lib/ejabberd/include -noinput -noshell -s extract_translations -s init stop -extra -srcmsg2po . $MSGS_PATH >$POT_PATH.1
sed -e 's/ \[\]$/ \"\"/g;' $POT_PATH.1 > $POT_PATH.2
#msguniq --sort-by-file $POT_PATH.2 $EJA_MSGS_DIR --output-file=$POT_PATH
@@ -288,8 +290,8 @@ translation_instructions ()
echo " $MSGS_PATH"
}
-EJA_DIR=`pwd`/..
-RUN_DIR=`pwd`/..
+EJA_DIR=`pwd`
+RUN_DIR=`pwd`
PROJECT=ejabberd
while [ $# -ne 0 ] ; do