From 298523862e395d9bf4a264e7842b8bf2ee9dd45a Mon Sep 17 00:00:00 2001 From: Victor Tsvetov Date: Mon, 3 May 2021 03:40:58 +0300 Subject: [PATCH] TT#115002 Do not wrap lines in i18n POT, PO files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- script/extract_i18n.sh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/script/extract_i18n.sh b/script/extract_i18n.sh index 7fbc8e194c..f4bb15b499 100755 --- a/script/extract_i18n.sh +++ b/script/extract_i18n.sh @@ -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