diff options
author | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-03-11 19:42:17 (EDT) |
---|---|---|
committer | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-03-11 19:43:32 (EDT) |
commit | c871492f224e851343e7a46271a699fd0779cedb (patch) | |
tree | fc7493c8ecb0f7b126ef344964cd23ed9fd1da3f /lib | |
parent | 2b4a5d1df8e567a8b73f90563af05871ad6a1bb9 (diff) |
ob_set_text_domain(): Exit early if messages already loaded
Diffstat (limited to 'lib')
-rw-r--r-- | lib/locale.sh | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/locale.sh b/lib/locale.sh index 5e168ab..5197904 100644 --- a/lib/locale.sh +++ b/lib/locale.sh @@ -74,6 +74,9 @@ ob_set_text_domain() else return 125 fi + case "${_OB_TEXT_DOMAIN}" in *[!A-Za-z0-9_]*) + return 125 + esac # Make sure LC_MESSAGES is set. if [ -z "${LC_MESSAGES}" ]; then @@ -86,7 +89,11 @@ ob_set_text_domain() fi fi - # TODO: Exit early if domain's messages have already been loaded. + # Exit early if domain's messages have already been loaded. + if eval "\${_ob_text_domain_${_OB_TEXT_DOMAIN}_loaded}"; then + return + fi + eval "\${_ob_text_domain_${_OB_TEXT_DOMAIN}_loaded}=true" # Try to load the messages. if ! _ob_try_load_messages "${LC_MESSAGES%.*}"; then |