public function applyMatchLocale(string $indexlocale):void
    {
        $locale = $this->applocale;
        $values = ((array)$locale->getValues());
        $key = array_search($indexlocale, (array)$values[0] ?? []);
        if (null === $key || false === $key) {
            throw new Server500(new \ArrayObject(array("explain" => "Undefined locale value [$indexlocale]",
                "solution" => "Please refer to the config.json to set the correct local value")));
        }
        putenv("LC_ALL=$key");
        setlocale(LC_ALL, $key);
        FEnv::set("app.locale.context", $key);
        if (in_array($locale->getTranstype(), $this->transType)) {
            switch ($locale->getTranstype()) {
                case 'poedit':
                    bindtextdomain($locale->getAppname(), FEnv::get("framework.root") . "apps/" .
                        $locale->getAppname() . "/locales");
                    textdomain($locale->getAppname());
                    FEnv::set("app.locale.content.file", FEnv::get("framework.root") . "apps/" .
                        $locale->getAppname() . "/locales/$key/LC_MESSAGES/" . $locale->getAppname() . ".mo");

                    // Translation is looking for in locale/{localevalue}/LC_MESSAGES/{appname}.mo now
                    break;
                case 'json':
                    FEnv::set("app.locale.content.file", FEnv::get("framework.root") . "apps/" .
                        $locale->getAppname() . "/locales/" . strtolower($key) . ".json");
                    break;
            }
        }
    }