Forum OpenACS Development: OpenACS 5.9.1: Error in lang::util::default_locale_from_lang zh

Hi,

With customers both in mainland China and ROC (Taiwan = Republic of China) we've got both zhCN and zhTW enabled.

With this configuration the following call fails with "Query returned more than one row", because

lang::util::defaultlocalefrom_lang zh

SQL: 
        select locale
        from   ad_locales
        where  language = 'zh'
        and    enabled_p = 't'
        and    (default_p = 't' or
                (select count(*)
                from ad_locales
                where language = 'zh') = 1
                    )
      
    while executing
"ns_pg_bind 0or1row nsdb0 {
        select locale
        from   ad_locales
        where  language = 'zh'
        and    enabled_p = 't'
        and  ..."
    ("uplevel" body line 1)
    invoked from within
"uplevel $ulevel [list ns_pg_bind $type $db $sql]"
    invoked from within
"db_exec 0or1row $db $full_name $sql"
    ("uplevel" body line 2)
    invoked from within
"uplevel 1 $code_block "
    invoked from within
"db_with_handle -dbn $dbn db {
            set selection [db_exec 0or1row $db $full_name $sql]
        }"
    (procedure "::nsf::procs::db_string" line 27)
    invoked from within
"db_string default_locale_from_lang {} -default """
    (procedure "lang::util::default_locale_from_lang_not_cached" line 6)
    invoked from within
"lang::util::default_locale_from_lang_not_cached zh"
    invoked from within
"ns_cache_eval {*}$max_age  -- util_memoize $script {*}$script"
    (procedure "util_memoize" line 5)
    invoked from within
"util_memoize [list lang::util::default_locale_from_lang_not_cached $language]"

Cheers Frank

Hi Frank,

This is the same code since 17 years and it hints on a broken configuration.

If one configures two locales (by e.g. enabling the locales "zh_CN" and "zh_TW") for the same language (here "zh") then one has to select via /acs-lang/admin/ a single locale as "default locale" for this language.

Can it be that on the installation in question, this was not done?

I've added a patch to oacs-5-10 to provide a more friendly error message.
Thanks!