KDE4 使用標準的 gettext 了
2007-01-15在 KDE 早期,連 gettext 也未有複數格式的支援時,KDE 使用自創的 _n: 格式來表示複數:
msgid ""
"_n: Open %n file\n"
"Open %n files"
msgstr "開啟 %n 個檔案"
這個方案其實有很大問題。用甚麼來決定複數格式?是在 kdelibs 中某一個翻譯條目決定的:
msgid ""
"_: Dear translator, please do not translate this string in any form, but pick "
"the _right_ value out of NoPlural/TwoForms/French... If not sure what to do "
"mail thd@kde.org and coolo@kde.org, they will tell you. Better leave that out "
"if unsure, the programs will crash!!\n"
"Definition of PluralForm - to be set by the translator of kdelibs.po"
msgstr "NoPlural"
總括來說,一句定生死。可是麻煩的地方在於,中文是否永遠都沒有複數?不是!有時中文也會有複數形式的。說中文沒有複數,那只是指數字加量詞的情況,例如 1 horse, 2 horses 等等都變成「n 隻馬」而已。「你」的複數是「你們」,「她」的複數是「她們」,那些情形還是要分辨複數的,但就因為在 kdelibs 裏面的一句,就判定了中文絕對不能有複數。
但現在情況不同了。KDE4 使用 gettext 的標準方式表示複數,即是說在檔案的 header 加一句複數表示形式,不再由 kdelibs 判刑了。對於翻譯者來說,這真是喜訊一樁:
- 情況可以由每個檔案自行決定;
- 翻譯者不需要根據每種軟件分辨複數方式,減少了混亂
至於新的 gettext 的另一個格式 — msgctxt,則暫時仍沒有甚麼軟件用它。現在 gtk+ 和 qt 各用自己的格式為條目加上 context,但期望 gettext 0.15 較多人採用時,情況會改善。










such that
