From 7027ace227e3cab9f9d4de1df74721abcf7effa1 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Thu, 25 Apr 2019 20:00:37 -0400 Subject: _try_load_locale(): Define before reference --- diff --git a/src/locale.sh b/src/locale.sh index 2962b92..42c87f0 100644 --- a/src/locale.sh +++ b/src/locale.sh @@ -20,6 +20,23 @@ DEFAULT_LOCALE='en_US' +_try_load_locale() +{ + local localedir="${1}" + local locale="${2}" + local ms= + + for ms in "${localedir}/${locale}/LC_MESSAGES/${TEXTDOMAIN}.ms" \ + "${localedir}/${locale}.ms"; do + if [ -f "${ms}" ]; then + . "${ms}" + return 0 + fi + done + + return 1 +} + load_locale() { local localedir= @@ -65,20 +82,3 @@ get_msg() return 0 } - -_try_load_locale() -{ - local localedir="${1}" - local locale="${2}" - local ms= - - for ms in "${localedir}/${locale}/LC_MESSAGES/${TEXTDOMAIN}.ms" \ - "${localedir}/${locale}.ms"; do - if [ -f "${ms}" ]; then - . "${ms}" - return 0 - fi - done - - return 1 -} -- cgit v0.9.1