Add language configuration at runtime
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!
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'
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=
@bhui Please try
export LANG=zh_CN.UTF-8
@bhui You can try: https://github.com/allinurl/goaccess/issues/1506#issuecomment-569499437
@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