goaccess icon indicating copy to clipboard operation
goaccess copied to clipboard

Add language configuration at runtime

Open mcmidget opened this issue 6 years ago • 5 comments

It would be nice to have the language configuration available at runtime (available at goaccess.conf or passing option like --language) so we can generate reports on different languages at runtime.

Thanks and keep the great work!

mcmidget avatar May 31 '19 10:05 mcmidget

A workaround would be doing something like this

LANG="en_US.UTF-8" bash -c 'goaccess access.log --log-format=COMBINED'
LANG="zh_CN.UTF-8" bash -c 'goaccess nginx.log --log-format=COMBINED -o result.html'

allinurl avatar Jun 11 '19 20:06 allinurl

I stilled get a en_US report html, use this command. Did I have to check some where? I am using goaccess1.3 on ubuntu16.04.


/tmp# locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=zh_CN.UTF-8
LANGUAGE=
LC_CTYPE="zh_CN.UTF-8"
LC_NUMERIC="zh_CN.UTF-8"
LC_TIME="zh_CN.UTF-8"
LC_COLLATE="zh_CN.UTF-8"
LC_MONETARY="zh_CN.UTF-8"
LC_MESSAGES="zh_CN.UTF-8"
LC_PAPER="zh_CN.UTF-8"
LC_NAME="zh_CN.UTF-8"
LC_ADDRESS="zh_CN.UTF-8"
LC_TELEPHONE="zh_CN.UTF-8"
LC_MEASUREMENT="zh_CN.UTF-8"
LC_IDENTIFICATION="zh_CN.UTF-8"
LC_ALL=

flyuuo9 avatar Aug 02 '19 03:08 flyuuo9

@bhui Please try

export LANG=zh_CN.UTF-8

allinurl avatar Aug 13 '19 15:08 allinurl

@bhui You can try: https://github.com/allinurl/goaccess/issues/1506#issuecomment-569499437

Hill-98 avatar Dec 29 '19 12:12 Hill-98

@bhui You can try: #1506 (comment)

It worked after I did this

sudo apt-get update
sudo apt-get install language-pack-zh-hans

sudo locale-gen zh_CN.UTF-8

export LANG=zh_CN.UTF-8

goaccess ./halt/access-demo.log \
  --log-format='%h %e [%d:%t %z] "%r" %s %b "%R" "%u"' \
  --date-format='%d/%b/%Y' \
  --time-format='%H:%M:%S' \
  --geoip-database ./GeoIP/GeoLite2-City.mmdb \
  --geoip-database ./GeoIP/GeoLite2-ASN.mmdb \
  -o report.html

Norlandz avatar Aug 21 '25 09:08 Norlandz