Setlocale

/Forum/Discussion/OnceAgainAboutAnEmptyScreen


Why is the Wacko engine doing the following in the set_language() function (unchanged since R4.2)

$this->lang['locale'] = setlocale(LC_CTYPE, 0);	

It calls setlocale twice? Why it does this at all, is there a reason? Kinda of a fallback or just a leftover?


https://github.com/WackoWiki/w[...]class/wacko.php#L671
set_language()

<?php

if (($old_lang != $lang || $update) && $this->known_language($lang))
{
    $this->load_translation($lang, $update);
    $this->lang = &$this->languages[$lang];

    setlocale(LC_CTYPE, $this->lang['locale']);
    setlocale(LC_TIME, $this->lang['locale']);    // sql_time_format()

    mb_internal_encoding('utf-8');

    $this->lang['locale'] = setlocale(LC_CTYPE, 0);
}

Still looking for a solution, but maybe we can leave out the last line.


lang/wacko.en.php

<?php

$wacko_translation = [

    // language
    'lang_scheme'    => [
        'name'        => 'English',
        'code'        => 'en',
        'dir'        => 'ltr',
        'locale'    => 'en_US.UTF-8',
    ],
]

Patch - just removed the entire redundant line