awstats language

Discussion in 'HOWTO-Related Questions' started by hrnsky, Feb 28, 2012.

  1. hrnsky

    hrnsky New Member

    hello, i have a 64 bit debian vps with ispconfig3, by default awstats language its georgian. how can i change this language ?

    in /etc/awstats/awstats.conf i've changed the Lang="auto" to Lang="en", then restart apache but doesnt change.
     
    bloomsg likes this.
  2. falko

    falko Super Moderator Howtoforge Staff

    I guess the language will be changed the next time AWStats is executed.
     
  3. hrnsky

    hrnsky New Member

    i've manually run the cron script that i created before from here ,its still georgian.
     
    Last edited: Feb 29, 2012
    bloomsg likes this.
  4. erosbk

    erosbk New Member

    You must change language in ispconfig file:
    /usr/local/ispconfig/server/cron_daily.php

    Aprox line 200, search for this line:

    $command = "$awstats_buildstaticpages_pl -month='$awmonth' -year='$awyear' -update -config='$domain' -lang=es -dir='$statsdir' -awstatsprog='$awstat..............

    replace -lang=en for the one you want. This night your stats will appear in your selected language.
     
  5. 8omas

    8omas Member HowtoForge Supporter

    Last edited: Feb 29, 2012
  6. hrnsky

    hrnsky New Member

    thank you all, i changed the two files, it works.
     
  7. Appie Thrasher

    Appie Thrasher Member HowtoForge Supporter

    I was wondering if I do this, it will chance all my stats to the language I enter in this line of code I think.
    I have some sites with different language set, so can this be done per site also?

    tia

    Appie
     
  8. Lancelot28

    Lancelot28 New Member

    [​IMG]I guess the language will be changed the next time AWStats is executed.
     
  9. brt

    brt New Member

    i managed to do this by adding the desired language to the site specific configuration file, e.g. by adding Lang="en" to /etc/awstats/awstats.english-site.com.conf
    and changing cron_daily.php to use this information instead of -lang=".$conf['language']."
    usually additions to a site specific awstats config file get lost, as cron_daily.php recreates those files every day.
    this patch changes this behavior and reads the language setting from the site specific config file and re-adds it when the new configuration file is created. additionally the -lang switch on the $awstats_buildstaticpages_pl command is removed so the awstats "Lang" setting is used:
    PHP:
    --- cron_daily.php.orig 2015-09-09 17:17:53.277736814 +0200
    +++ cron_daily.php      2015-09-09 17:17:15.213407807 +0200
    @@ -358,+358,15 @@
            
    $awstats_conf_dir $web_config['awstats_conf_dir'];
            
    $awstats_website_conf_file $web_config['awstats_conf_dir'].'/awstats.'.$domain.'.conf';
    -       if(
    is_file($awstats_website_conf_file)) unlink($awstats_website_conf_file);
    +       
    $existing_awstats_conf_array = array();
    +       if(
    is_file($awstats_website_conf_file)) {
    +               
    $existing_awstats_conf file($awstats_website_conf_file);
    +               foreach (
    $existing_awstats_conf as $line) {
    +                       if(
    preg_match("/Lang=/",$line)) $existing_awstats_conf_array['Lang'] = implode('',parse_ini_string($line));
    +               }
    +
    +               
    unlink($awstats_website_conf_file);
    +       }
            
    $sql "SELECT domain FROM web_domain WHERE (type = 'alias' OR type = 'subdomain') AND parent_domain_id = ".$rec['domain_id'];
            
    $aliases $app->db->queryAllRecords($sql);
    @@ -
    375,+383,@@
    LogFile="/var/log/ispconfig/httpd/'.$domain.'/yesterday-access.log"
    SiteDomain="'.$domain.'"
    HostAliases="www.'.$domain.' localhost 127.0.0.1'.$aliasdomain.'"';
    +               if (array_key_exists('
    Lang',$existing_awstats_conf_array)) $awstats_conf_file_content .='
    +Lang="'.$existing_awstats_conf_array['Lang'].'"';
                    file_put_contents($awstats_website_conf_file, $awstats_conf_file_content);
            }
    @@ -396,7 +406,7 @@
            // awstats_buildstaticpages.pl -update -config=mydomain.com -lang=en -dir=/var/www/domain.com/'
    .$web_folder.'/stats -awstatsprog=/path/to/awstats.pl
            // $command = "$awstats_buildstaticpages_pl -update -config='
    $domain' -lang=".$conf['language']." -dir='$statsdir' -awstatsprog='$awstats_pl'";
    -       $command = "$awstats_buildstaticpages_pl -month='
    $awmonth' -year='$awyear' -update -config='$domain' -lang=".$conf['language']." -dir='$statsdir' -awstatsprog='$awstats_pl'";
    +       $command = "$awstats_buildstaticpages_pl -month='
    $awmonth' -year='$awyear' -update -config='$domain' -dir='$statsdir' -awstatsprog='$awstats_pl'";
            if (date("d") == 2) {
                    $awmonth = date("m")-1;
    I already added a Feature request on the German Forum:
    https://www.howtoforge.de/forum/thr...a-in-deutsch-und-webseite-b-in-englisch.9315/
    feel free to "thumb up" the thread if you like the idea, comments on the patch are also very welcome!
     

    Attached Files:

    Last edited: Sep 10, 2015

Share This Page