TT#115002 Do not wrap lines in i18n POT, PO files

Translation files (*.po) come from Crowdin platform in not wrapped
format. Let's not break the lines on our side, so that it will be easier
to analyze translation changes and also will not generate unnecessary
commits and false commit differences.

Add the '--no-wrap' flag to tell xgettext, msgattrib and msgmerge
programs not to split long lines into several lines.

Normalize the English source POT file with msgattrib utility right after
running xgettext.pl that creates duplicates of context filenames and
does not support the xgettext attribute ‘--width’.

Use the '--width=100000' parameter as a workaround for context filename
lines that continue to be wrapped despite the ‘--no-wrap’ flag.

Change-Id: Ic9e3eed25a63a3ca1519f7bf4750b6aaa9ff43ac
mr9.5.1
Victor Tsvetov 5 years ago
parent 1e06df3fdf
commit 298523862e

@ -24,13 +24,28 @@ perl -I../sipwise-base/lib -I../ngcp-schema/lib -Ilib script/ngcp_panel_dump_db_
echo; echo "Creating ${POT}"; echo
xgettext.pl \
--no-wrap \
--output="${POT}" \
"${I18_DIRS[@]/#/--directory=}" \
-P perl=tt,pm
msgattrib \
--no-wrap \
--add-location=file \
--width=100000 \
--output-file="${POT}" \
"${POT}"
while IFS= read -r -d '' po ; do
echo; echo "Merging ${po}"; echo
msgmerge --no-fuzzy-matching --add-location=file --update "${po}" "${POT}"
msgmerge \
--no-fuzzy-matching \
--no-wrap \
--width=100000 \
--add-location=file \
--update \
"${po}" \
"${POT}"
done < <(find lib/NGCP/Panel/I18N -name "*.po" -print0)
echo; echo "Removing line numbers"; echo

Loading…
Cancel
Save