TranslateGettext::initEnvironment PHP Method

initEnvironment() protected method

This method will change some env vars and locale settings; the restoreEnvironment should put them all back :)
See also: restoreEnvironment()
protected initEnvironment ( ) : void
return void
    protected function initEnvironment()
    {
        $this->storedLocale = getenv("LANG");
        $this->log("Setting locale to " . $this->locale, Project::MSG_DEBUG);
        putenv("LANG=" . $this->locale);
        $ret = setlocale(LC_ALL, $this->locale);
        if ($ret === false) {
            $msg = "Could not set locale to " . $this->locale . ". You may need to use fully qualified name" . " (e.g. en_US instead of en).";
            throw new BuildException($msg);
        }
        $this->log("Binding domain '" . $this->domain . "' to " . $this->dir, Project::MSG_DEBUG);
        bindtextdomain($this->domain, $this->dir->getAbsolutePath());
        textdomain($this->domain);
    }