国际语言环境指南

genmsg 实用程序

新的 genmsg 实用程序可以与 catgets() 系列函数一起使用,以创建国际化的源信息目录。该实用程序在源程序文件中检查对 catgets 中函数的调用,然后根据找到的信息生成源信息目录。例如:

% cat example.c
	...
	/* NOTE: %s is a file name */
	printf(catgets(catd, 5, 1, "%s cannot be opened."));
	/* NOTE: "Read" is a past participle, not a present
 
			tense verb */
	printf(catgets(catd, 5, 1, "Read"));
	...
% genmsg -c NOTE example.c
The following file(s) have been created.
			new msg file = "example.c.msg"
% cat example.c.msg
$quote "
$set 5
1			"%s cannot be opened"
	/* NOTE: %s is a file name */
2			"Read"
	/* NOTE: "Read" is a past participle, not a present
			tense verb */

在上面的实例中,对源文件 example.c 运行 genmsg,产生一个名为 example.c.msg 的源信息目录。带 NOTE 参数的 -c 选项使 genmsg 在目录中包含注释。如果源程序中的注释包含指定的字符串,则该注释在信息目录中出现在下一个从对 catgets 的调用中提取的字符串的后面。

可以使用 genmsg 对信息集中的信息进行自动编号。

有关更多信息,请参见 genmsg(1) 手册页。

要生成格式化信息目录文件,请使用 gencat (1) 实用程序。

有关可移植消息文件(.po 文件)的消息提取实用程序的信息,以及如何从 .po 文件生成消息对象文件(.mo 文件)的信息。