diff options
author | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-04-13 22:55:18 (EDT) |
---|---|---|
committer | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-04-13 22:55:36 (EDT) |
commit | 69beed026908861feb9eb4b648e3d537fe666a91 (patch) | |
tree | 02cc68f0071c64cf71da4a181103c970a7dcb0aa /src/locale.sh | |
parent | 95a9b30c37392a0a9065be697ee5e8923129a92e (diff) |
_try_load_locale(): Move before use
Diffstat (limited to 'src/locale.sh')
-rw-r--r-- | src/locale.sh | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/locale.sh b/src/locale.sh index 1437bb8..7ec9359 100644 --- a/src/locale.sh +++ b/src/locale.sh @@ -22,6 +22,24 @@ DEFAULT_LOCALE='en_US' +_try_load_locale() +{ + local localedir="${1}" + local locale="${2}" + shift 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= @@ -68,21 +86,3 @@ get_msg() return 0 } - -_try_load_locale() -{ - local localedir="${1}" - local locale="${2}" - shift 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 -} |