summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2012-09-08 17:45:52 (EDT)
committer P. J. McDermott <pjm@nac.net>2012-09-08 17:45:52 (EDT)
commit3f4979bfb07389b33d7a1d71ed02dc4a8aadf24c (patch)
treee0671632a4341a83b5fa408f630afd1b2188f403
parentd67863f58a97562ba2b09d8c5e6984096a85aa03 (diff)
Implement ob_set_locale_path.
-rw-r--r--lib/locale.sh21
1 files changed, 20 insertions, 1 deletions
diff --git a/lib/locale.sh b/lib/locale.sh
index 6c2baad..b1314bf 100644
--- a/lib/locale.sh
+++ b/lib/locale.sh
@@ -24,6 +24,7 @@ _OB_LOCALE_SM='true'
_OB_DEFAULT_LOCALE='en_US'
_OB_TEXT_DOMAIN=
+_OB_LOCALE_PATH='@@LOCALEDIR@@/%s/LC_MESSAGES/%s.ms'
ob_get_text_domain()
{
@@ -70,6 +71,23 @@ ob_set_text_domain()
return 0
}
+ob_set_locale_path()
+{
+ _obslp_format=
+
+ if [ ${#} -eq 1 ]; then
+ _obslp_format="${1}"
+ else
+ unset _obslp_format
+ return 125
+ fi
+
+ _OB_LOCALE_PATH="${_obslp_format}"
+
+ unset _obslp_format
+ return 0
+}
+
ob_get_msg()
{
_obgm_msgid=
@@ -89,7 +107,8 @@ ob_get_msg()
_ob_try_load_messages()
{
_obtlm_locale="${1}"
- _obtlm_ms="@@LOCALEDIR@@/${_obtlm_locale}/LC_MESSAGES/${_OB_TEXT_DOMAIN}.ms"
+ _obtlm_ms="$(printf "${_OB_LOCALE_PATH}" \
+ "${_obtlm_locale}" "${_OB_TEXT_DOMAIN}")"
if [ -f "${_obtlm_ms}" ]; then
. "${_obtlm_ms}"