ONLYOFFICE界面汉化,onlyoffice汉化

上面链接里同样介绍了如何汉化和开发。

我用golang的beego框架开发了文档管理,实现实时文档协作。

首先是安装docker,然后是拉取document
server镜像,再就是汉化界面,最后是用golang提供回调和存储编辑后的文档。

汉化的步骤:1、删除容器里的文件,替换windows下的字体。

 删除容器 /usr/share/fonts下的所有文件. 然后运行script:
documentserver-generate-allfonts.sh 然后清理浏览器缓存。

//进入容器(运行的镜像)内,删除/usr/share/fonts下除truetype外其他文件和文件夹

$ dockerexec -it 38e27 /bin/bash

[email protected]:/#dir或者ls
–al

 

[email protected]:~#cd
/usr/share/fonts/

[email protected]:/usr/share/fonts#ls

truetype  X11

//删除文件夹X11

[email protected]:/usr/share/fonts#rm
-R dir X11

rm:cannot remove dir: No such file or directory

[email protected]:/usr/share/fonts#ls

truetype

[email protected]:/usr/share/fonts#cd
truetype

[email protected]:/usr/share/fonts/truetype#ls
–al

[email protected]:/usr/share/fonts/truetype#ls
-al

total462392

drwxr-xr-x11 root   root       4096 Feb 19 04:17 .

………………

//删除trutype文件夹下所有文件,除了custome文件夹外

[email protected]:/usr/share/fonts/truetype#rm
-R dir *.*

rm:cannot remove dir: No such file or directory

[email protected]:/usr/share/fonts/truetype#rm
-R dir *

rm:cannot remove dir: No such file or directory

rm:cannot remove custom: Device or resource busy

[email protected]:/usr/share/fonts/truetype#ls

custom

[email protected]:/usr/share/fonts/truetype#ls
-al

total 12

drwxr-xr-x10 root root 4096 Feb 19 10:14 .

drwxr-xr-x  6 root root 4096 Feb 19 10:12 ..

drwxr-xr-x  2 root root 4096 Feb 19 03:48 custom

……

 

[email protected]:/usr/share/fonts/truetype#exit

exit

 

[email protected]
~/winfont

//将当前文件夹C:\Users\Administrator\下的winfont文件夹内的字体全部拷贝到容器的文件夹/usr/share/fonts/truetype中

$ tar -cv* | docker exec -i 6df tar x -C /usr/share/fonts/truetype

kaiu.ttf

msjh.ttc

msjhbd.ttc

msjhl.ttc

msyh.ttc

msyh.ttf

msyhbd.ttc

msyhl.ttc

simfang.ttf

simhei.ttf

simkai.ttf

simli.ttf

simsun.ttc

simsunb.ttf

simyou.ttf

……

 

[email protected]
~/winfont

//进入容器内

$ dockerexec -it 6df /bin/bash

[email protected]:/#sudo
mkfontscale

[email protected]:/#sudo
mkfontdir

[email protected]:/#sudo
fc-cache -fv

/usr/share/fonts:caching, new cache contents: 0 fonts, 1 dirs

…………

fc-cache:succeeded

[email protected]:/#exit

exit

//退出容器

[email protected]
~/winfont

$ dockerexec 6df /usr/bin/documentserver-generate-allfonts.sh

GeneratingAllFonts.js, please wait…Done

onlyoffice-documentserver:docservice:stopped

onlyoffice-documentserver:docservice:started

onlyoffice-documentserver:converter:stopped

onlyoffice-documentserver:converter:started

 

如果机器重启后,不要用dockerrun命令,要用dockerstart

具体步骤见图:

然后在调用onlyoffice协同编辑的页面中,设置”lang”: “zh-CN”,

[html] view plain copy

  1.                 “editorConfig”: {  
  2.                     “callbackUrl”: “”,  
  3.                     “user”: {  
  4.                         “id”: “{{.Uid}}”,  
  5.                         “name”: “{{.Uname}}”  
  6.                     },  
  7.                     “lang”: “zh-CN”,//”en-US”,  
  8.                 },  

详细代码见

查看评论

上面链接里同样介绍了如何汉化和开发。 我用golang的beego框架开…

相关文章