diff options
-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 |