From b1dd1a2a60e4ce16336f8a1567f428c9790a86ee Mon Sep 17 00:00:00 2001 From: lars Date: Mon, 1 Jun 2009 11:41:21 +0000 Subject: [PATCH] translate toolkit helper script: * fixed small issues of java properties converter * added copyrigth note and license --- .../java_properties_converter.sh | 33 ++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/translate-workflows/java_properties_converter.sh b/translate-workflows/java_properties_converter.sh index 13f1e27..1e83d5e 100755 --- a/translate-workflows/java_properties_converter.sh +++ b/translate-workflows/java_properties_converter.sh @@ -2,8 +2,32 @@ # # convert a directory or java property files into po files and back # +# The content of (translated) po files overrides the content of +# java properties files. Thus it is recommended to use a po file +# editor (e.g. Pootle) as the single primary source of translations. +# +# Java property template files are handled (converted into pot) as well. +# # This is just the example script used for jsymphonic. # +# Copyright 2009 - Lars Kruse (devel@sumpfralle.de) +# +# License: +# +# This package is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This package is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this package; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# set -eu @@ -44,7 +68,8 @@ template_prop2po() { # input: filename of a translated properties file # output: filename of the properties template file get_prop_template() { - echo "${1%$PROP_EXT}" | sed -r "s/$PROP_LANG_SUFFIX_REGEX$/$PROP_EXT/g" + echo -n "${1%$PROP_EXT}" | sed -r "s/$PROP_LANG_SUFFIX_REGEX$//g" + echo "$PROP_EXT" } @@ -74,7 +99,7 @@ convert_to_po_merged() { if test -f "$po_file"; then # merge the prop with the po file (priority: po file) prop2po $POTOOLS_OPTS -t "$prop_template" -i "$prop_file" -o "$temp_po_file1" - pomerge $POTOOLS_OPTS -t "$po_file" -i "$temp_po_file1" -o "$temp_po_file2" + pomerge $POTOOLS_OPTS --mergeblanks=no -t "$po_file" -i "$temp_po_file1" -o "$temp_po_file2" mv "$temp_po_file2" "$po_file" rm "$temp_po_file1" else prop2po $POTOOLS_OPTS -t "$prop_template" -i "$prop_file" -o "$po_file" @@ -100,13 +125,13 @@ create_symlink_po() { local po_file="$PO_DIR/$(get_po_filename "$1")" local lang_code="$(get_lang_code "$1")" mkdir -p "$POOTLE_DIR/$lang_code" - ln -sfn "$(pwd)/$po_file" "$POOTLE_DIR/$lang_code/" + ln -sfn "$(readlink -f "$po_file")" "$POOTLE_DIR/$lang_code/" } create_symlink_pot() { local pot_file="$PO_DIR/$(get_pot_template "$1")" - ln -sfn "$(pwd)/$pot_file" "$POOTLE_DIR/" + ln -sfn "$(readlink -f "$pot_file")" "$POOTLE_DIR/" }