From c871492f224e851343e7a46271a699fd0779cedb Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Mon, 11 Mar 2019 19:42:17 -0400 Subject: ob_set_text_domain(): Exit early if messages already loaded --- (limited to 'lib') 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 -- cgit v0.9.1