diff options
author | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-04-25 20:00:37 (EDT) |
---|---|---|
committer | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-04-25 20:27:06 (EDT) |
commit | 7027ace227e3cab9f9d4de1df74721abcf7effa1 (patch) | |
tree | 0632b80c9db2db92876d09b7a42b79da7078ab37 /src/locale.sh | |
parent | d72a12ba858af727801ef68c7201f1020915fcd8 (diff) |
_try_load_locale(): Define before reference
Diffstat (limited to 'src/locale.sh')
-rw-r--r-- | src/locale.sh | 34 |
1 files changed, 17 insertions, 17 deletions
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 -} |