diff options
author | Slávek Banko <slavek.banko@axis.cz> | 2020-05-18 17:25:54 +0200 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2020-05-18 17:25:54 +0200 |
commit | 6be262f2f455346fc87efb838cc7e9defe1af535 (patch) | |
tree | d280a9f82ee4e865c857e47cb52b4c455265904e | |
parent | bc35bf285273744ebb10023ad0a6a7beae58a59e (diff) | |
download | scripts-6be262f2f455346fc87efb838cc7e9defe1af535.tar.gz scripts-6be262f2f455346fc87efb838cc7e9defe1af535.zip |
tde-l10n_split_desktop: Automatically add a <default> section
during processing to allow extract translations from desktop
files without sections.
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
-rwxr-xr-x | conversions/tde-l10n/tde-l10n_split_desktop | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/conversions/tde-l10n/tde-l10n_split_desktop b/conversions/tde-l10n/tde-l10n_split_desktop index 47bedaa..444a27b 100755 --- a/conversions/tde-l10n/tde-l10n_split_desktop +++ b/conversions/tde-l10n/tde-l10n_split_desktop @@ -90,8 +90,12 @@ while [ $# -gt 0 ]; do DX="$DX|$D.tde_l10n" if [ ! -f "$D.orig" ]; then - mv "$D" "$D.orig" - grep -v "^[a-zA-Z][^=]*\[[a-z][^=]*\]" "$D.orig" > "$D" + ( + printf "[<default>]\n" + cat "$D" + ) > "$D.orig" + grep -v "^[a-zA-Z][^=]*\[[a-z][^=]*\]" "$D.orig" | \ + grep -Fxv "[<default>]" > "$D" fi # xgettext for desktop files generates a reference to the source file @@ -100,11 +104,11 @@ while [ $# -gt 0 ]; do # That's why we have our own mechanism for extracting strings. sed \ -e "s|\"|\\\\\"|g" \ - < $D | \ + < "$D" | \ sed \ -e "s#^\($KEYWORDS_MATCH\)[ ]*=[ ]*\(.*\)#/*\1*/i18n(\"\2\");#;t" \ -e "s|.*||" \ - > $D.tde_l10n + > "$D.tde_l10n" done # extract strings |