aboutsummaryrefslogtreecommitdiff
path: root/eselect
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-03-24 22:21:14 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-03-24 22:21:14 +0000
commit9334e28a804b6db8a360ece0fb3a40aa05822ff4 (patch)
tree2145e3f00d1ef7ae15963b0c50e98fc98e3d1200 /eselect
parentda5a575351c8636a694954c5efed2b6866dfeb1d (diff)
downloadpaludis-9334e28a804b6db8a360ece0fb3a40aa05822ff4.tar.gz
paludis-9334e28a804b6db8a360ece0fb3a40aa05822ff4.tar.xz
Make select news support multiple languages. Better 'you have unread news' message. Fixes: ticket:147
Diffstat (limited to 'eselect')
-rw-r--r--eselect/news.eselect16
1 files changed, 14 insertions, 2 deletions
diff --git a/eselect/news.eselect b/eselect/news.eselect
index 903f9a531..9b6c4160e 100644
--- a/eselect/news.eselect
+++ b/eselect/news.eselect
@@ -80,15 +80,27 @@ get_dir_name() {
sed -n -e "s~^ *newsdir: *\(.*\)~\1/${name}/~p"
}
+get_lang() {
+ if [[ -n "${LC_MESSAGES}" ]] ; then
+ echo ${LC_MESSAGES:0:2}
+ elif [[ -n "${LANG}" ]] ; then
+ echo ${LANG:0:2}
+ else
+ echo en
+ fi
+}
+
get_headers() {
local dir=${1}
- dir=${dir}/$(basename ${1%/} ).en.txt
+ dir=${dir}/$(basename ${1%/} ).$(get_lang).txt
+ [[ -f ${dir} ]] || dir=${dir}/$(basename ${1%/} ).en.txt
sed -e '/^$/,$d' < ${dir}
}
get_body() {
local dir=${1}
- dir=${dir}/$(basename ${1%/} ).en.txt
+ dir=${dir}/$(basename ${1%/} ).$(get_lang).txt
+ [[ -f ${dir} ]] || dir=${dir}/$(basename ${1%/} ).en.txt
sed -e '1,/^$/d' < ${dir}
}