From 98359e968c11e761ba299fe27ff83221f1d68c69 Mon Sep 17 00:00:00 2001 From: dteske Date: Sun, 12 May 2013 00:46:18 +0000 Subject: Fix i18n violations in the package management module. A few words like `packages', `installed', and `selected' were not internationalized. --- usr.sbin/bsdconfig/include/messages.subr | 3 +++ usr.sbin/bsdconfig/share/packages/index.subr | 9 ++++--- usr.sbin/bsdconfig/share/packages/packages.subr | 31 ++++++++++++++++++------- 3 files changed, 31 insertions(+), 12 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/bsdconfig/include/messages.subr b/usr.sbin/bsdconfig/include/messages.subr index 67763a9..95434be 100644 --- a/usr.sbin/bsdconfig/include/messages.subr +++ b/usr.sbin/bsdconfig/include/messages.subr @@ -164,6 +164,7 @@ msg_install_from_an_ftp_server_thru_proxy="Install from an FTP server through an msg_install_from_the_existing_filesystem="Install from the existing filesystem" msg_install_over_nfs="Install over NFS" msg_installed="Installed" +msg_installed_lc="installed" msg_installed_desc="Leave package as-is, installed" msg_invalid_gateway_ipv4_address_specified="Invalid gateway IPv4 address specified" msg_invalid_hostname_value="Invalid hostname value" @@ -248,6 +249,7 @@ msg_options="Options" msg_options_editor="Options Editor" msg_other="other" msg_package_temp="Package Temp" +msg_packages="packages" msg_page_of_npages="(Page %s of %s)" msg_palm_desc="Software support for the Palm(tm) series." msg_parallel_desc="Applications dealing with parallelism in computing." @@ -318,6 +320,7 @@ msg_secure_mode_requires_x11="Secure-mode requires X11 (use \`-X')!" msg_security_desc="System security software." msg_select="Select" msg_select_a_site_thats_close="Select a site that's close!" +msg_selected="selected" msg_server_error_when_requesting_url="Server error when requesting %s, you could try an other server" msg_shells_desc="Various shells (tcsh, bash, etc)." msg_singapore="Singapore" diff --git a/usr.sbin/bsdconfig/share/packages/index.subr b/usr.sbin/bsdconfig/share/packages/index.subr index 2d4b60c..afbd31b 100755 --- a/usr.sbin/bsdconfig/share/packages/index.subr +++ b/usr.sbin/bsdconfig/share/packages/index.subr @@ -112,6 +112,7 @@ f_index_read() export msg_no_description_provided export msg_all msg_all_desc export VALID_VARNAME_CHARS + export msg_packages eval "$( debug= f_getvar "$var_to_get" | awk -F'|' ' function asorti(src, dest) @@ -140,12 +141,13 @@ f_index_read() # cached (also acting as a visitation indicator) if ( ENVIRON["_index_page_" varcat "_1"] ) cat = cat "*" - printf "'\''%s'\'' '\''%s packages'\'' '\''%s'\''\n", + printf "'\''%s'\'' '\''%s " packages "'\'' '\''%s'\''\n", cat, npkgs, desc } BEGIN { valid_chars = ENVIRON["VALID_VARNAME_CHARS"] default_desc = ENVIRON["msg_no_description_provided"] + packages = ENVIRON["msg_packages"] tpkgs = 0 prefix = "" } @@ -221,11 +223,12 @@ f_index_extract_pages() debug= f_getvar "$var_to_get" | awk -F'|' \ -v cat="$category" \ -v pagesize="$pagesize" \ - -v var_basename="$var_basename" ' + -v var_basename="$var_basename" \ + -v i18n_all="$msg_all" ' BEGIN { n = page = 0 } /'\''/{ gsub(/'\''/, "'\''\\'\'\''") } { - if ( cat !~ /(^$|^All$)/ && $7 !~ \ + if ( cat !~ "(^$|^" i18n_all "$)" && $7 !~ \ "(^|[[:space:]])" cat "([[:space:]]|$)" ) next starting_new_page = (n++ == (pagesize * page)) if ( starting_new_page ) diff --git a/usr.sbin/bsdconfig/share/packages/packages.subr b/usr.sbin/bsdconfig/share/packages/packages.subr index 0d602d4..5caf78d 100755 --- a/usr.sbin/bsdconfig/share/packages/packages.subr +++ b/usr.sbin/bsdconfig/share/packages/packages.subr @@ -78,20 +78,28 @@ f_package_accent_category_menu() while [ $# -gt 0 ]; do cat="${1%\*}" desc="${2%%; *}" help="$3" shift 3 # cat/desc/help - f_str2varname "${cat# }" varcat - # Add an asterisk to the category if its index has been cached - f_isset _index_page_${varcat}_1 && cat="$cat*" + cat="${cat# }" # Trim leading space inserted by sort-method + f_str2varname "$cat" varcat # Add number of installed packages for this category (if any) n=0 - debug= f_getvar "_${varcat}_ninstalled" n && - [ $n -ge 1 ] && desc="$desc; $n installed" + case "$cat" in + "$msg_all") debug= f_getvar "_All_ninstalled" n ;; + *) debug= f_getvar "_${varcat}_ninstalled" n ;; + esac && + [ $n -ge 1 ] && desc="$desc; $n $msg_installed_lc" # Add number of selected packages for this category (if any) n=0 - debug= f_getvar "_${varcat}_nselected" n && - [ $n -ge 1 ] && desc="$desc; $n selected" + case "$cat" in + "$msg_all") debug= f_getvar "_All_nselected" n ;; + *) debug= f_getvar "_${varcat}_nselected" n ;; + esac && + [ $n -ge 1 ] && desc="$desc; $n $msg_selected" + + # Add an asterisk to the category if its index has been cached + f_isset _index_page_${varcat}_1 && cat="$cat*" # Update buffer with modified elements menu_buf="$menu_buf @@ -365,7 +373,7 @@ f_package_menu_select() # Get number of packages for this category case "$category" in - "All"|"") npkgs="${_npkgs:-0}";; + "$msg_all"|"") npkgs="${_npkgs:-0}";; *) f_getvar _npkgs_$varcat npkgs esac @@ -437,7 +445,12 @@ f_package_menu_select() " # End-Quote local prompt="" - f_category_desc_get "$category" prompt + # Accept/Translate i18n "All" but other category names must + # match tree definitions from INDEX, ports, FTP, etc. + case "$category" in + "$msg_all"|"") f_category_desc_get "All" prompt ;; + *) f_category_desc_get "$category" prompt ;; + esac prompt="$prompt $( printf "$msg_page_of_npages" \ "$page" "$npages" )" -- cgit v1.1