Go to main content

手册页部分 1:用户命令

退出打印视图

更新时间: 2022年7月27日 星期三
 
 

mkmsgs(1)

名称

mkmsgs - 创建供 gettxt 使用的消息文件

用法概要

mkmsgs [-o] [-i locale] inputstrings msgfile

描述

The mkmsgs utility is used to create a file of text strings that can be accessed using the text retrieval tools gettxt(1), exstr(1), and gettxt(3C).使用该程序可以输入特定地理语言环境的文本字符串文件(请参见 setlocale(3C))以及创建采用 gettxt(1)gettxt(3C) 都可检索的格式的文本字符串文件。By using the –i option, you can install the created file under the /usr/lib/locale/locale/LC_MESSAGES directory, where locale corresponds to the language in which the text strings are written.

inputstrings 是包含原始文本字符串的文件的名称。msgfile 是输出文件的名称,mkmsgs 在该文件中写入的字符串采用 gettxt(1)gettxt(3C) 可读取的格式。msgfile 的名称的长度最多为 14 个字符,但不能包含 \0(空)或者 /(斜杠)或 :(冒号)的 ASCII 代码。

输入文件包含一组特定地理语言环境的文本字符串。文本字符串用换行符分隔。非图形字符必须表示为字母转义序列。消息按顺序转换并从 inputstrings 复制到 msgfile。要在 msgfile 中生成空消息,可在 inputstrings 中的正确位置留下一个空行。

通过编辑文件 inputstrings 就可更改字符串。必须仅将新字符串添加到文件的末尾;然后必须在正确的位置创建和安装新的 msgfile 文件。如果不遵循此过程,检索函数将检索错误的字符串,并会破坏软件的兼容性。

选项

支持以下选项:

–o

覆盖 msgfile(如果存在)。

–i locale

Install msgfile in the /usr/lib/locale/locale/LC_MESSAGES directory.Only someone with appropriate privileges can create or overwrite files in this directory.Directories under /usr/lib/locale will be created if they do not exist.

示例

示例 1 使用 mkmsgs 命令。

以下示例展示了一个输入消息源文件 C.str


File %s:\t cannot be opened\n
%s: Bad directory\n
	.
	.
	.
write error\n
	.
	.
示例 2 使用来自 C.str 的输入字符串在文件中创建文本字符串

以下命令使用来自 C.str 的输入字符串在当前目录下的文件 UX 中以相应的格式创建文本字符串:

example% mkmsgs C.str UX
示例 3 使用来自 FR.str 的输入字符串在文件中创建文本字符串

The following command uses the input strings from FR.str to create text strings in the appropriate format in the file UX in the directory /usr/lib/locale/fr/LC_MESSAGES:

example% mkmsgs -i fr FR.str UX

如果设置了环境变量 LC_MESSAGES=fr,然后调用在“说明”部分的开头列出的文本检索工具之一,则将访问这些文本字符串。

文件

/usr/lib/locale/locale/LC_MESSAGES/*

message files created by mkmsgs for the locale locale

属性

有关下列属性的说明,请参见 attributes(7)

属性类型
属性值
可用性
text/locale

另请参见

exstr(1), gettxt(1), setlocale(3C), gettxt(3C), attributes(7)