archlinuxcn / lilac

Lilac is the build bot for archlinuxcn
GNU General Public License v3.0
114 stars 40 forks source link

i18n #117

Closed petronny closed 2 years ago

petronny commented 5 years ago

没翻译完。。。先开个坑

lilydjwg commented 5 years ago

为什么要翻译成英文呢?不搞个国际化方案吗?

petronny commented 5 years ago

也行啊,咋弄?

lilydjwg commented 5 years ago

不知道。我是希望给不同用户能选择不同的语种。不知道 gettext 这样子要怎么弄。

yan12125 commented 5 years ago

以前在其他專案有搞過python + gettext,或許可參考一下 https://github.com/ytdl-org/youtube-dl/pull/7852 (那邊一直沒合併是因為python 2的相容性搞不定,lilac沒這問題)

petronny commented 5 years ago

我想了一下,应该这么干:

  1. 创建po
  2. CI 转换 po 到 mo 并提交
  3. lfs 追踪所有mo

鉴于我们并没有Makefile...

SilverRainZ commented 5 years ago

提交 mo 干啥?

SilverRainZ commented 5 years ago

不知道。我是希望给不同用户能选择不同的语种。不知道 gettext 这样子要怎么弄。

是指给不同用户发邮件是用不同语言么?听起来不太容易。而且 gettext 切语言的方式好像只有改环境变量,不太适合动态地输出各种语言的翻译。

petronny commented 5 years ago

提交 mo 干啥?

省得本地编译啊

gettext 切语言的方式好像只有改环境变量

https://docs.python.org/3/library/gettext.html#changing-languages-on-the-fly

petronny commented 5 years ago

是指给不同用户发邮件是用不同语言么?

这个就是i18n哪些东西的问题了,我觉得: lilac中:

  1. logger的输出
  2. email的subject和body
  3. 不含build_logger,build_logger_old直接删了吧
lilydjwg commented 5 years ago

logger 里就用英文不翻译了。邮件里可以翻译一下,好像也没别的地方了。 build_logger_old 得看 @a-wing 的 KISS2U 迁过去了没有。

petronny commented 5 years ago

build_logger_old 得看 @a-wing 的 KISS2U 迁过去了没有。

grep build-log.json KISS2U/ -r输出是空。。。

yan12125 commented 5 years ago

lfs 追踪所有mo

mo檔也不大不用LFS吧,懶得再裝git-lfs (

petronny commented 5 years ago

mo檔也不大不用LFS吧,懶得再裝git-lfs (

改动一多就大了啊。。。

我先把要翻译的都括起来了,大家先帮忙检查一遍有没有 false-positive 和 true-negative ?

我先去把括起来的都翻译成英文。。。

petronny commented 5 years ago

初步都翻译了,求校对

校对好了之后我就照着这个做英文和中文的po了 PS. 英文就是照抄。。。

yan12125 commented 5 years ago

改动一多就大了啊。。。

It's not uncommon that *.po files are larger than *.mo. For example, https://github.com/neovim/neovim/blob/v0.3.5/src/nvim/po/zh_TW.UTF-8.po is 181KB, while compiled /usr/share/locale/zh_TW.UTF-8/LC_MESSAGES/nvim.mo is only 81KB. If you want to avoid bloated git packs, you need to put *.po into Git LFS, too.

初步都翻译了,求校对

I think you need to transform f-strings to .format().

petronny commented 5 years ago

但是有改动的话,po的diff只有几行,但是mo需要整个重新提交。 比如改动10次的话,po全部pull下来可能就比181KB多一点点,但是mo就是810KB了。

虽然文件挺小的,但总感觉git track binary files不合适。。。

yan12125 commented 5 years ago

就算po(對人類來說)是文字檔,10個git commit後也是會10倍大小喔。git本來就不是追蹤diff的,而是把整份檔案存起來。

By the way, 寫個Makefile本地編譯不好嗎?

SilverRainZ commented 5 years ago

真的需要那么在意仓库大小么?按一般实践来说都是跟踪 po 而本地编译 mo,感觉并没有什么问题。

petronny commented 5 years ago

I think you need to transform f-strings to .format().

改了

By the way, 寫個Makefile本地編譯不好嗎?

。。。那我倒时候先写一个Makefile扔lang/下面得了

petronny commented 5 years ago

po和Makefile都加了,接下来就是怎么应用了

如果要每人的都不一样的话,感觉是要在maintainers的信息里加上lang

lilydjwg commented 5 years ago

如果要每人的都不一样的话,感觉是要在maintainers的信息里加上lang

对。所以你们这个还没处理就把翻译给弄好了……

我们需要维护一个 maintainers 信息数据。不过这样的话,lilac.yaml 里的 maintainers 可以直接写一个字符串就完事了。每个维护者的信息单独放着,里边有 github id、电子邮件地址、名字、语种什么的。