您的位置:首页 > 其它

ONLYOFFICE界面汉化

2018-02-19 21:57 531 查看
http://blog.csdn.net/hotqin888/article/details/79337881上面链接里同样介绍了如何汉化和开发。我用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
root@38e27823ae92:/#dir或者ls –al
 
root@6dfa5705aaef:~#cd /usr/share/fonts/
root@6dfa5705aaef:/usr/share/fonts#ls
truetype  X11
//删除文件夹X11
root@6dfa5705aaef:/usr/share/fonts#rm -R dir X11
rm:cannot remove dir: No such file or directory
root@6dfa5705aaef:/usr/share/fonts#ls
truetype
root@6dfa5705aaef:/usr/share/fonts#cd truetype
root@6dfa5705aaef:/usr/share/fonts/truetype#ls –al
root@6dfa5705aaef:/usr/share/fonts/truetype#ls -al
total462392
drwxr-xr-x11 root   root       4096 Feb 19 04:17 .
………………
//删除trutype文件夹下所有文件,除了custome文件夹外
root@6dfa5705aaef:/usr/share/fonts/truetype#rm -R dir *.*
rm:cannot remove dir: No such file or directory
root@6dfa5705aaef:/usr/share/fonts/truetype#rm -R dir *
rm:cannot remove dir: No such file or directory
rm:cannot remove custom: Device or resource busy
root@6dfa5705aaef:/usr/share/fonts/truetype#ls
custom
root@6dfa5705aaef:/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
……
 
root@6dfa5705aaef:/usr/share/fonts/truetype#exit
exit
 
Administrator@604TFALNDKDKJWCMINGW64 ~/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
……
 
Administrator@604TFALNDKDKJWCMINGW64 ~/winfont
//进入容器内
$ dockerexec -it 6df /bin/bash
root@6dfa5705aaef:/#sudo mkfontscale
root@6dfa5705aaef:/#sudo mkfontdir
root@6dfa5705aaef:/#sudo fc-cache -fv
/usr/share/fonts:caching, new cache contents: 0 fonts, 1 dirs
…………
fc-cache:succeeded
root@6dfa5705aaef:/#exit
exit
//退出容器
Administrator@604TFALNDKDKJWCMINGW64 ~/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                "editorConfig": {  
                    "callbackUrl": "http://192.168.99.1/url-to-callback?id={{.Doc.Id}}",  
                    "user": {  
                        "id": "{{.Uid}}",  
                        "name": "{{.Uname}}"  
                    },  
                    "lang": "zh-CN",//"en-US",  
                },  
详细代码见http://blog.csdn.net/hotqin888/article/details/79337881https://github.com/3xxx/EngineerCMS


内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: