Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有大约 500 个 php 文件,其中包含一些要翻译的日语文本。我想将 gettext 添加到所有这些日文文本中。如何在所有 php 文件中自动添加它
作为初学者,您可以提取所有字符串:
$ find DIRECTORY -name '*.php*' >POTFILES $ xgettext -a --files-from=POTFILES
这会在messages.po当前目录中生成一个文件,其中包含所有可能的可翻译字符串。当您messages.po在诸如 emacs (key s) 或 Poedit(查看文档)之类的 PO 编辑器中打开时,您可以直接从 PO 文件中访问源文件。
messages.po
s
不支持自动添加gettext()呼叫,因为您通常会有很多误报。
gettext()