i18n/l10n

Gettext

gettext

1
2
3
4
gettext -o foo.pot //生成pot文件
msginit --input=foo.pot --local=bo //生成bo.po
msgfmt bo.po -o bo.mo //生成mo
msgmerge foo_new.pot bo.po -o bo_new.po // 更具新的pot文件,更新po文件
1
for po in `ls *.po`; do msgmerge -U $po slideshow-ubuntukylin.pot; done

修改po文件:

  1. 在Linux世界里有软件可以直接打开.mo文件以供编辑,这款软件叫——Virtaal

  2. 1
    2
    3
    msgunfmt foo.mo -o foo.po
    // Edit foo.po
    msgfmt foo.po -o foo.mo

qmake

hello.pro

1
2
TRANSLATIONS = zh_CN.ts \
bo.ts
1
2
lupdate -pro hello.pro
lrelease zh_CN.ts

meson

i18n = import(‘i18n’)
its_dir = xxxx
i18n.merge_file(
input: xxx
output: xxx
po_dir: xxx

#data_dir: its_dir
install: xx
install_dir: xxx
)

in po

i18n.gettext(
meson.project_name(),
preset: ‘glib’,

#data_dirs: its_dir,
)