Index: openacs-4/packages/acs-lang/tcl/lang-message-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/tcl/lang-message-procs.tcl,v diff -u -r1.68.2.7 -r1.68.2.8 --- openacs-4/packages/acs-lang/tcl/lang-message-procs.tcl 6 Jun 2020 16:27:35 -0000 1.68.2.7 +++ openacs-4/packages/acs-lang/tcl/lang-message-procs.tcl 17 Jun 2020 09:55:18 -0000 1.68.2.8 @@ -870,17 +870,36 @@ } # + # Probably, we should check for undefined locales passed in. We + # omit this for now due to missing performance evaluation of this + # change. + # + # elseif {$locale ni [lang::system::get_locales]} { + # error "Unknown locale $locale passed as argument" + #} + + # # Trying locale directly # if { ![message_exists_p -varname message $locale $key] } { # # Trying default locale for language. # set language [lindex [split $locale "_"] 0] - set locale [lang::util::default_locale_from_lang $language] - if { ![message_exists_p -varname message $locale $key] } { + + # + # When the lookup returns empty (no locale for this language), + # or returns the same language we checked before, there is no + # reason for the message lookup and we can go to the next + # test. + # + set lang_locale [lang::util::default_locale_from_lang $language] + if { $lang_locale eq "" + || $lang_locale eq $locale + || ![message_exists_p -varname message $lang_locale $key] + } { # - # Trying system locale for package (or site-wide) + # Trying system locale for package # if { ![message_exists_p -varname message [lang::system::locale] $key] } { #