Skip to content

start:

Extracting and Merging Software and Help Messages

This document describes how to extract software and help messages from resource files, and how to merge them back. For more information, see the following topics:

Software and Help File Types

The OpenOffice.org source code contains several file types of messages. These include the following:

  • File types for the OpenOffice.org resource system

  • File types for the OpenOffice.org configuration and setup process

The following table describes these file types:

File Type

Extension

Explanation

Resource Definition

src, hrc

OpenOffice.org resource system. Includes dialogs, menus, software and help messages.

Setup Definition

lng

Message definitions for the setup program.

XML Configuration

xcd

XML format for configuration files.

There is a common mechanism to do the following:

  • Extract all messages from these files.

  • Merge the translated text back into the different files.

Parsers for Extracting and Merging Messages

For each file type there is a tool to extract and merge back messages, as shown in the following table:

Extension

Tool

src, hrc

transex3

lng

lngex

xcd

cfgex

Each of these tools produces the same output format when run in extract mode, and needs the same input format when run in merge mode. Also, the command line parameters are the same for each of these tools.

The source code of transex3, lngex, xmlex and cfgex is located in the transex3 module.

Command Line Options

The following sections describe the command line options available with ] the localization tools.

Command Line Options for Extracting

The following table describes the command line options available when using the transex3, lngex, xmlex and cfgex tools to extract messages:

Option

Explanation

-p

Specifies the project from which to extract the messages.

-r

Specifies the relative path to the root directory of the module, that is, where the file for export is located.

-i

Specifies the name of the input file.

-o

Specifies the output file. This file should have a .out extension.

Note: Do not use a precompiler when you are extracting messages. The tools use symbolic identifiers.

Command Line Options for Merging

The following table describes the command line options available when using the transex3, lngex, xmlex and cfgex tools to merge messages:

Option

Explanation

-m

Specifies the file with the new translations for merging back. This file must be in the same location as the input file if you want to build binaries with the new translations.

Note: Validate that the merge has performed correctly before overwriting your original input file.

Output File Format

When run in extract mode, transex3, lngex, xmlex and cfgex produce output files in tab-separated format. Each line in the files contains a message in one language. Each line contains a number of fields. The following table shows the fields represented in each of these lines. The fields are listed as they appear in a line, from left to right.

Field

Explanation

Project

The module where the source file is located.

Source File

The path of source file, starting at the module root.

Dummy

This information is obsolete, and is only included to remain compatible with older versions.

Resource Type

Type of resource for which the text is defined. For example, dialog box, tab page, message box, message, and so on.

GroupId

Symbolic identifier for the message.

LocalId

Symbolic identifier for the message.

HelpId

Unique identifier that identifies a window control.

Platform

This information is obsolete, and is only included to remain compatible with older versions.

Width

Width of the resource. Only used for .src and .hrc files.

LanguageId

The language that the text is in.

Text

The text.

HelpText

This information is obsolete, and is only included to remain compatible with older versions.

QuickHelpText

Some resources include QuickHelpText, which is displayed in the office suite user interface.

Title

The title for some resources, such as dialog boxes, message boxes, and so on.

Input File Format

When run in merge mode, transex3, lngex, xmlex and cfgex reads input files in tab-separated format. Each line in these files contains a message in one language. Each line contains a number of fields. There are two possible formats o this line. One format is similar to the output format, which is already described. The following table shows the fields represented in each of these lines of the other possible format (These format is old and only supported because of compatibility to older versions). The fields are listed as they appear in a line, from left to right.

Field

Explanation

Resource Type

Type of resource for which the text is defined. For example, dialog box, tab page, message box, message, and so on.

GroupId

Symbolic identifier for the message.

LocalId

Symbolic identifier for the message.

Platform

This information is obsolete, and is only included to remain compatible with older version.

LanguageId

The language that the text is in.

Text

The text.

QuickHelpText

Some resources include QuickHelpText, which is displayed in the office suite user interface.

Title

The title for some resources, such as Dialogs, MessageBoxes, and so on.

Sample Files

The following table provides links to sample resource, input, and output files that you can view.

Sample File

Description

Resource file

The resource file svx/source/dialogs/textattr.src.

Output file

Resource file after parsing with transex3 to extract the message definitions.

Input file (old format)

After translation, you can use this input file to merge the messages back with transex3.