From 7fa1f0e2aa70a610d6de76e2194857b2ddc36b18 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Wed, 23 May 2012 17:12:52 +0200 Subject: Add localization to calcurse-upgrade * Use gettext in "scripts/calcurse-upgrade". * Add "scripts/calcurse-upgrade" to "po/POTFILES.in". * Rename "scripts/calcurse-upgrade" to "scripts/calcurse-upgrade.sh" to make sure xgettext(1) detects the correct input file format. Signed-off-by: Lukas Fleischer --- scripts/Makefile.am | 12 +++++- scripts/calcurse-upgrade | 94 -------------------------------------------- scripts/calcurse-upgrade.sh | 96 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 107 insertions(+), 95 deletions(-) delete mode 100644 scripts/calcurse-upgrade create mode 100644 scripts/calcurse-upgrade.sh (limited to 'scripts') diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 408de30..5502cfd 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -1,3 +1,13 @@ AUTOMAKE_OPTIONS = foreign -dist_bin_SCRIPTS = calcurse-upgrade +dist_bin_SCRIPTS = \ + calcurse-upgrade + +EXTRA_DIST = \ + calcurse-upgrade.sh + +CLEANFILES = \ + calcurse-upgrade + +calcurse-upgrade: calcurse-upgrade.sh + $(AM_V_GEN) $(INSTALL) $< $@ diff --git a/scripts/calcurse-upgrade b/scripts/calcurse-upgrade deleted file mode 100644 index 271ade4..0000000 --- a/scripts/calcurse-upgrade +++ /dev/null @@ -1,94 +0,0 @@ -#!/bin/sh - -set -e - -if [ "$1" = "--config" ]; then - CONFFILE=$2 -else - CONFFILE=$HOME/.calcurse/conf -fi - -if [ ! -e "$CONFFILE" ]; then - echo "Configuration file not found: $CONFFILE" >&2 - exit 1 -fi - -if grep -q -e '^auto_save=' -e '^auto_gc=' -e '^periodic_save=' \ - -e '^confirm_quit=' -e '^confirm_delete=' -e '^skip_system_dialogs=' \ - -e '^skip_progress_bar=' -e '^calendar_default_view=' \ - -e '^week_begins_on_monday=' -e '^color-theme=' -e '^layout=' \ - -e '^side-bar_width=' -e '^notify-bar_show=' -e '^notify-bar_date=' \ - -e '^notify-bar_clock=' -e '^notify-bar_warning=' -e '^notify-bar_command=' \ - -e '^notify-all=' -e '^output_datefmt=' -e '^input_datefmt=' \ - -e '^notify-daemon_enable=' -e '^notify-daemon_log=' "$CONFFILE"; then - - echo "Pre-3.0.0 configuration file format detected..." - - tmpfile="${TMPDIR:-/tmp}/calcurse-upgrade.$!" - [ -e "$tmpfile" ] && exit 1 - - echo -n "Upgrade configuration directives..." - - sed -e 's/^auto_save=/general.autosave=/' \ - -e 's/^auto_gc=/general.autogc=/' \ - -e 's/^periodic_save=/general.periodicsave=/' \ - -e 's/^confirm_quit=/general.confirmquit=/' \ - -e 's/^confirm_delete=/general.confirmdelete=/' \ - -e 's/^skip_system_dialogs=/general.systemdialogs=/' \ - -e 's/^skip_progress_bar=/general.progressbar=/' \ - -e 's/^calendar_default_view=/appearance.calendarview=/' \ - -e 's/^week_begins_on_monday=/general.firstdayofweek=/' \ - -e 's/^color-theme=/appearance.theme=/' \ - -e 's/^layout=/appearance.layout=/' \ - -e 's/^side-bar_width=/appearance.sidebarwidth=/' \ - -e 's/^notify-bar_show=/appearance.notifybar=/' \ - -e 's/^notify-bar_date=/format.notifydate=/' \ - -e 's/^notify-bar_clock=/format.notifytime=/' \ - -e 's/^notify-bar_warning=/notification.warning=/' \ - -e 's/^notify-bar_command=/notification.command=/' \ - -e 's/^notify-all=/notification.notifyall=/' \ - -e 's/^output_datefmt=/format.outputdate=/' \ - -e 's/^input_datefmt=/format.inputdate=/' \ - -e 's/^notify-daemon_enable=/daemon.enable=/' \ - -e 's/^notify-daemon_log=/daemon.log=/' "$CONFFILE" > "$tmpfile" - mv "$tmpfile" "$CONFFILE" - - if grep -q -e '^[^#=][^#=]*$' -e '^[^#=][^#=]*#.*$' "$CONFFILE"; then - sed -e '/^general.autosave=/{N;s/\n//}' \ - -e '/^general.autogc=/{N;s/\n//}' \ - -e '/^general.periodicsave=/{N;s/\n//}' \ - -e '/^general.confirmquit=/{N;s/\n//}' \ - -e '/^general.confirmdelete=/{N;s/\n//}' \ - -e '/^general.systemdialogs=/{N;s/\n//}' \ - -e '/^general.progressbar=/{N;s/\n//}' \ - -e '/^appearance.calendarview=/{N;s/\n//}' \ - -e '/^general.firstdayofweek=/{N;s/\n//}' \ - -e '/^appearance.theme=/{N;s/\n//}' \ - -e '/^appearance.layout=/{N;s/\n//}' \ - -e '/^appearance.sidebarwidth=/{N;s/\n//}' \ - -e '/^appearance.notifybar=/{N;s/\n//}' \ - -e '/^format.notifydate=/{N;s/\n//}' \ - -e '/^format.notifytime=/{N;s/\n//}' \ - -e '/^notification.warning=/{N;s/\n//}' \ - -e '/^notification.command=/{N;s/\n//}' \ - -e '/^notification.notifyall=/{N;s/\n//}' \ - -e '/^format.outputdate=/{N;s/\n//}' \ - -e '/^format.inputdate=/{N;s/\n//}' \ - -e '/^daemon.enable=/{N;s/\n//}' \ - -e '/^daemon.log=/{N;s/\n//}' "$CONFFILE" > "$tmpfile" - mv "$tmpfile" "$CONFFILE" - fi - - awk ' - BEGIN { FS=OFS="=" } - $1 == "general.systemdialogs" || $1 == "general.progressbar" \ - { $2 = ($2 == "yes") ? "no" : "yes" } - $1 == "general.firstdayofweek" { $2 = ($2 == "yes") ? "monday" : "sunday" } - { print } - ' < "$CONFFILE" > "$tmpfile" - mv "$tmpfile" "$CONFFILE" - - echo -n ' ' - echo 'done' -fi - diff --git a/scripts/calcurse-upgrade.sh b/scripts/calcurse-upgrade.sh new file mode 100644 index 0000000..ffe110a --- /dev/null +++ b/scripts/calcurse-upgrade.sh @@ -0,0 +1,96 @@ +#!/bin/sh + +export TEXTDOMAIN='calcurse' + +set -e + +if [ "$1" = "--config" ]; then + CONFFILE=$2 +else + CONFFILE=$HOME/.calcurse/conf +fi + +if [ ! -e "$CONFFILE" ]; then + echo "$(gettext "Configuration file not found:") $CONFFILE" >&2 + exit 1 +fi + +if grep -q -e '^auto_save=' -e '^auto_gc=' -e '^periodic_save=' \ + -e '^confirm_quit=' -e '^confirm_delete=' -e '^skip_system_dialogs=' \ + -e '^skip_progress_bar=' -e '^calendar_default_view=' \ + -e '^week_begins_on_monday=' -e '^color-theme=' -e '^layout=' \ + -e '^side-bar_width=' -e '^notify-bar_show=' -e '^notify-bar_date=' \ + -e '^notify-bar_clock=' -e '^notify-bar_warning=' -e '^notify-bar_command=' \ + -e '^notify-all=' -e '^output_datefmt=' -e '^input_datefmt=' \ + -e '^notify-daemon_enable=' -e '^notify-daemon_log=' "$CONFFILE"; then + + echo "$(gettext "Pre-3.0.0 configuration file format detected...")" + + tmpfile="${TMPDIR:-/tmp}/calcurse-upgrade.$!" + [ -e "$tmpfile" ] && exit 1 + + echo -n "$(gettext "Upgrade configuration directives...")" + + sed -e 's/^auto_save=/general.autosave=/' \ + -e 's/^auto_gc=/general.autogc=/' \ + -e 's/^periodic_save=/general.periodicsave=/' \ + -e 's/^confirm_quit=/general.confirmquit=/' \ + -e 's/^confirm_delete=/general.confirmdelete=/' \ + -e 's/^skip_system_dialogs=/general.systemdialogs=/' \ + -e 's/^skip_progress_bar=/general.progressbar=/' \ + -e 's/^calendar_default_view=/appearance.calendarview=/' \ + -e 's/^week_begins_on_monday=/general.firstdayofweek=/' \ + -e 's/^color-theme=/appearance.theme=/' \ + -e 's/^layout=/appearance.layout=/' \ + -e 's/^side-bar_width=/appearance.sidebarwidth=/' \ + -e 's/^notify-bar_show=/appearance.notifybar=/' \ + -e 's/^notify-bar_date=/format.notifydate=/' \ + -e 's/^notify-bar_clock=/format.notifytime=/' \ + -e 's/^notify-bar_warning=/notification.warning=/' \ + -e 's/^notify-bar_command=/notification.command=/' \ + -e 's/^notify-all=/notification.notifyall=/' \ + -e 's/^output_datefmt=/format.outputdate=/' \ + -e 's/^input_datefmt=/format.inputdate=/' \ + -e 's/^notify-daemon_enable=/daemon.enable=/' \ + -e 's/^notify-daemon_log=/daemon.log=/' "$CONFFILE" > "$tmpfile" + mv "$tmpfile" "$CONFFILE" + + if grep -q -e '^[^#=][^#=]*$' -e '^[^#=][^#=]*#.*$' "$CONFFILE"; then + sed -e '/^general.autosave=/{N;s/\n//}' \ + -e '/^general.autogc=/{N;s/\n//}' \ + -e '/^general.periodicsave=/{N;s/\n//}' \ + -e '/^general.confirmquit=/{N;s/\n//}' \ + -e '/^general.confirmdelete=/{N;s/\n//}' \ + -e '/^general.systemdialogs=/{N;s/\n//}' \ + -e '/^general.progressbar=/{N;s/\n//}' \ + -e '/^appearance.calendarview=/{N;s/\n//}' \ + -e '/^general.firstdayofweek=/{N;s/\n//}' \ + -e '/^appearance.theme=/{N;s/\n//}' \ + -e '/^appearance.layout=/{N;s/\n//}' \ + -e '/^appearance.sidebarwidth=/{N;s/\n//}' \ + -e '/^appearance.notifybar=/{N;s/\n//}' \ + -e '/^format.notifydate=/{N;s/\n//}' \ + -e '/^format.notifytime=/{N;s/\n//}' \ + -e '/^notification.warning=/{N;s/\n//}' \ + -e '/^notification.command=/{N;s/\n//}' \ + -e '/^notification.notifyall=/{N;s/\n//}' \ + -e '/^format.outputdate=/{N;s/\n//}' \ + -e '/^format.inputdate=/{N;s/\n//}' \ + -e '/^daemon.enable=/{N;s/\n//}' \ + -e '/^daemon.log=/{N;s/\n//}' "$CONFFILE" > "$tmpfile" + mv "$tmpfile" "$CONFFILE" + fi + + awk ' + BEGIN { FS=OFS="=" } + $1 == "general.systemdialogs" || $1 == "general.progressbar" \ + { $2 = ($2 == "yes") ? "no" : "yes" } + $1 == "general.firstdayofweek" { $2 = ($2 == "yes") ? "monday" : "sunday" } + { print } + ' < "$CONFFILE" > "$tmpfile" + mv "$tmpfile" "$CONFFILE" + + echo -n ' ' + echo "$(gettext 'done')" +fi + -- cgit v1.2.3-70-g09d2