CollaboraOnline / online

Collabora Online is a collaborative online office suite based on LibreOffice technology. This is also the source for the Collabora Office apps for iOS and Android.
https://collaboraonline.com
Other
1.83k stars 702 forks source link

Font name list does not display correctly for locale(zh_CN.UTF-8) #3128

Open jiandanfeng opened 3 years ago

jiandanfeng commented 3 years ago

When I added "ENV LANG zh_CN.UTF-8" and installed fonts-wqy-microhei in dockerfile, then build my docker image.

When I running a docker container, font name list display with English name, not Chinese name.

When I into the docker container and run the cmd "locale", the result is

lool@a1e50bde4b0d:/$ locale LANG=zh_CN.UTF-8 LANGUAGE=zh_CN.UTF-8 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=zh_CN.UTF-8

and run the cmd "fc-list :lang=zh", the result is:

lool@a1e50bde4b0d:/$ fc-list :lang=zh /usr/share/fonts/truetype/wqy/wqy-microhei.ttc: 文泉驿微米黑,文泉驛微米黑,WenQuanYi Micro Hei:style=Regular /usr/share/fonts/truetype/wqy/wqy-zenhei.ttc: 文泉驿正黑,文泉驛正黑,WenQuanYi Zen Hei:style=Regular /usr/share/fonts/truetype/wqy/wqy-zenhei.ttc: 文泉驿点阵正黑,文泉驛點陣正黑,WenQuanYi Zen Hei Sharp:style=Regular /usr/share/fonts/truetype/wqy/wqy-zenhei.ttc: 文泉驿等宽正黑,文泉驛等寬正黑,WenQuanYi Zen Hei Mono:style=Regular /usr/share/fonts/truetype/wqy/wqy-microhei.ttc: 文泉驿等宽微米黑,文泉驛等寬微米黑,WenQuanYi Micro Hei Mono:style=Regular

The font name list looks like that in UI: image

Why cann't display with Chinese name?

JackieAnxis commented 2 years ago

你好,不知道你能不能放一下如何增加中文字体的教程?我这边的中文字符都显示为:口口 Hello, would you mind please show me how to add Chinese fonts in Collabora? All Chinese characters are represented by 口口.. image

jiandanfeng commented 2 years ago

@JackieAnxis 把windows的字体路径映射到服务镜像里面就行了,比如:docker run -t -d -p 9980:9980 -v C:/Windows/Fonts:/usr/share/fonts/truetype -v C:/Windows/Fonts:/opt/cool/systemplate/usr/share/fonts/truetype --restart always collabora/code:latest

chiuyau commented 2 years ago

How to add Chinese fonts? 如何增加中文字体?

It works for me! I am adding new fonts to NextCloud Office ( Collabora Online - Built-in CODE Server ) as I found that it does not support Chinese characters originally.

My settings are: Ubuntu, Apache 2.4.52, MySQL 8.0, PHP 8.1 ( LAMP, non docker environment )

Here’s how i made it:

Put fonts files in any path that are listed in /etc/fonts/fonts.conf (i.e. /usr/share/fonts/truetype by default) Run fc-cache -f -v Supposingly, you should see some output like this: /usr/share/fonts: caching, new cache contents: 0 fonts, 1 dirs /usr/share/fonts/truetype: caching, new cache contents: 0 fonts, 2 dirs /usr/share/fonts/truetype/dfkai-sb: caching, new cache contents: 6 fonts, 0 dirs /usr/share/fonts/truetype/dfkai-sb: caching, new cache contents: 1 fonts, 0 dirs /usr/local/share/fonts: caching, new cache contents: 0 fonts, 0 dirs /home//.local/share/fonts: skipping, no such directory /home//.fonts: skipping, no such directory /usr/share/fonts/truetype: skipping, looped directory detected /usr/share/fonts/truetype/dejavu: skipping, looped directory detected /usr/share/fonts/truetype/dfkai-sb: skipping, looped directory detected /var/cache/fontconfig: not cleaning unwritable cache directory /home//.cache/fontconfig: cleaning cache directory /home//.fontconfig: not cleaning non-existent cache directory fc-cache: succeeded dfkai-sb is the font i added. The above command do the caching job and shows the output.

It is done. Back to the Nextcloud Office Editor ( Collabora Online - Built-in CODE Server ), you can see the font you added listed in the font selector. ( If not, try restart the apache service by sudo systemctl reload apache or even sudo systemctl restart apache and reboot your server. For me, I cannot see it after these all because I am using Cloudflare, so after these, turn on Development Mode in Cloudflare (only if you are using Cloudflare caching) to see effects immediately. ) This should help those using Collabora with Nextcloud in LAMP environment.

jiandanfeng commented 2 years ago

首先保证你的文档的对应字体在collabora服务中是存在的,可以进入collabora docker容器中看下,其中有两个路径,并且新环境和旧环境不一样: 新环境是:/usr/share/fonts/以及/opt/cool/systemplate/usr/share/fonts 旧环境是:/usr/share/fonts/以及/opt/lool/systemplate/usr/share/fonts,其实就是cool和lool的区别。 其次在容器中执行下locale,看看是不是UTF-8。 最后,还是不行就换个文档试试。

2022-09-17 13:06:43"ixsword" @.***>写道:

你好,不知道你能不能放一下如何增加中文字体的教程?我这边的中文字符都显示为:口口 Hello, would you mind please show me how to add Chinese fonts in Collabora? All Chinese characters are represented by 口口..

兄弟,搞定了没,我nextcloud就差这个东东还没整好,字体都是方块,而且Collabora除了菜单和表名是中文,好像很多地方都是英文,最主要是单元格汉字没法显示~

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

karaikyo commented 1 year ago

请问一下你的collabora online的界面是怎么调成中文的?我用的官方的docker image,编辑文档的菜单什么的都是英文

jiandanfeng commented 1 year ago

这个需要自己打包镜像,docker镜像中的系统安装中文字体,设置为中文环境 修改源代码中的/docker/from-packages/scripts/install-collabora-online-ubuntu.sh这个文件修改 安装系统中文包:apt-get -y install language-pack-zh-hans

karaikyo commented 1 year ago

抱歉再请教一下,我在install-collabora-online-ubuntu.sh里面加了安装中文包的命令,然后在docker/from-packages/Ubuntu里加了ENV LC_CTYPE zh_CN.UTF-8和ENV LANG zh_CN.UTF-8两行,这样打包完跑起来界面还是英文的。试着又装了中文字体,只是文档里的字变了,编辑器的界面仍是英文。必须在dockerfile里加字体再打包才可以吗,还是说还需要其他的配置?

jiandanfeng commented 1 year ago

抱歉再请教一下,我在install-collabora-online-ubuntu.sh里面加了安装中文包的命令,然后在docker/from-packages/Ubuntu里加了ENV LC_CTYPE zh_CN.UTF-8和ENV LANG zh_CN.UTF-8两行,这样打包完跑起来界面还是英文的。试着又装了中文字体,只是文档里的字变了,编辑器的界面仍是英文。必须在dockerfile里加字体再打包才可以吗,还是说还需要其他的配置?

中文字体运行容器映射进去就行了,这个我不确定是否有影响;另一个有影响的是浏览器的环境(英文还是中文?)

karaikyo commented 1 year ago

启动镜像加了字体映射,浏览器语言(edge)也调成中文了还是不行……可能是用的版本不一样吧?不过发现在URL里加一个lang=zh-CN的参数就可以了,官方的镜像就行,感谢帮助~

coderbhy commented 9 months ago

你好,请问一下,我的Collabora页面只有顶部的菜单栏和功能区、底部的状态栏显示中文,右侧编辑区域中的表单全是英文,这是因为docker中没有配置中文映射导致的吗?