docker-easyconnect/docker-easyconnect

Chinese support

forest0 opened this issue · 3 comments

Thanks for your sharing, I've tested on the debian package of version 7.6.7.3, worked like a charm.

However, one problem that annoys me sometimes is Chinese failed to render, since EasyConnect show most of its messages in Chinese and some messages are really helpful, e.g., the error message when you failed to connect.

So I tried to add Chinese support and it worked, the following are some hints in case some other guys need them:

# install a Chinese font, I just use microhei here
apt-get install locales ttf-wqy-microhei

echo "Asia/Shanghai" > /etc/timezone
dpkg-reconfigure -f noninteractive tzdata
sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen
sed -i -e 's/# zh_CN.UTF-8 UTF-8/zh_CN.UTF-8 UTF-8/' /etc/locale.gen
echo 'LANG="zh_CN.UTF-8"' > /etc/default/locale
dpkg-reconfigure --frontend=noninteractive locales
update-locale LANG=zh_CN.UTF-8

# and set your language environment variables
# here I set them in Dockerfile, adjust according to your needs
ENV LANG zh_CN.UTF-8
ENV LANGUAGE zh_CN.UTF-8
ENV LC_ALL zh_CN.UTF-8
Hagb commented

Hi. Thanks for your code. It works perfect!

But I tried to make the image as small as possible, and don't know whether it is a good idea to include the Chinese font in image. (There is a workaround if Chinese font(s) installed in the host: add --mount type=bind,source=/usr/share/fonts/,target=/usr/share/fonts/,readonly as a docker argument so as to use the font from the host)

The language in EasyConnect can also be changed to English. I used EasyConnect 7.6.3 where the language can be changed directly in the interface.

I didn't find how to change the language by GUI in EasyConnect 7.6.7, but it can be done by setting the value of language in /root/easy_connect.json (such as "language": "en_US" for English).

I did not find how to change language by GUI in 7.6.7 either, so I thought that Chinese was the only language it support. Now I managed to change language to English by editing easy_connect.json, so Chinese is not a necessary now(though I believe providing a default configuration with language set to English is more friendly to users).

BTW, mount the fonts in host into docker is a smart trick.

Hagb commented

EasyConnect 7.6.7 displays resources whose names are defined by server-side and are usually Chinese, so a Chinese font becomes necessary. fonts-wqy-microhei has been installed in the image since 5b52478.