Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

612 lines
27 KiB

  1. User's Guide
  2. The Resource Localization Toolset
  3. Version 1.0
  4. Copyright � 1992 Microsoft Corporation
  5. Table of Contents
  6. Table of Contents 1
  7. Introduction 2
  8. Windows Based Tools: 4
  9. RLQuikEd 4
  10. RLAdmin 5
  11. RLEdit 6
  12. DOS Based Tools: 8
  13. TokRes 8
  14. Update 8
  15. Data Files and Data Formats 10
  16. Master Project Files (MPJs) 10
  17. Project Files (PRJs) 10
  18. Master Token Files (MTKs) 10
  19. Language Token Files (TOKs) 11
  20. Resource Description Files (RDFs) 12
  21. Glossaries (TXTs) 13
  22. Introduction
  23. In the past, localization of a software product required the localizer to edit strings and controls
  24. embedded in source code and then rebuild the product in order to test the localized version. Such a
  25. process requires at least a rudimentary knowledge of computer programming and is often prone to human
  26. error. The Resource Localization Toolset (hereafter referred to as the RLToolset) was designed to
  27. automate localization of products that make use of the Windows resource model by allowing the localizer
  28. to extract localizable resources directly from the applications that use them, modify the resources, and use
  29. the modified resources to create localized versions of the original applications. All this can be achieved
  30. without rebuilding the product and with minimal knowledge of computer operations.
  31. The RLToolset consists of three Windows tools and two DOS tools. The Windows tools provide a
  32. complete automated solution in a user-friendly, graphical environment. The DOS tools provide the same
  33. functionality at a more primitive level and can be used in conjunction with (or in place of) the Windows
  34. tools. Having a set of tools that work from the DOS command line allows much of the localization
  35. process to be executed by a batch file or during a build script.
  36. The RLToolset was designed with several goals in mind. Some of these goals were:
  37. * Allow the product to be localized without re-compilation.
  38. * Allow localization to proceed concurrent with development (provide update capability).
  39. * Allow localizers to share glossaries of common terms among applications.
  40. * Provide a user-friendly, simple to understand means of localization.
  41. The localization model followed by the RLToolset is very simple. Localizable resources are extracted
  42. from a source resource file and put into special text file called a token file. Each localizable resource
  43. may generate one or more tokens. Each token is contained on a single line of text and consists of a unique
  44. identifier followed by the localizable data associated with that particular resource. These tokens can then
  45. be localized either by using the tools provide by the RLToolset or by using a standard text editor.
  46. The localized tokens are then used in conjunction with the source resource file to generate a new localized
  47. resource file. The target resource file will contain exactly the same resources as the source resource file,
  48. the only difference is that the data will be localized.
  49. This model has been expanded a little to allow for update tracking. When localization is done in
  50. conjunction with development a target resource file may change after the localizer has tokenized the file
  51. and begun translation. Update tracking allows the localizer to update the localized token file without
  52. loosing any work that might have been done. Any resources that may have changed since the most recent
  53. update are marked "dirty" and the change is tracked in the token file so the localizer may see exactly what
  54. changed and exactly how it changed.
  55. To allow for update tracking, the source resource file is used to generate a "master token file" which tracks
  56. changes. The master token file is then used to update any number of "language token files" (one for each
  57. target language). These language token files are then localized and used to generate the target resource
  58. files.
  59. This two stage update may seem a little complicated but it results in greater efficiency during the update
  60. and it allows a project administrator to preview an update. During this preview, the administrator may
  61. mark tokens as "read only" tokens which the localizer will never need to localize. The administrator may
  62. also mark tokens that have changed very little (perhaps there was a spelling or punctuation change to the
  63. original resource) as "unchanged" so the localizer will not need to waste his time re-addressing a token
  64. that actually needs no attention.
  65. In addition to the localization paths described above, the RLToolset also provides limited automated
  66. translation ability via glossaries. A glossary is a list of suggested translations for common terms.
  67. Glossaries may be created for each target language and then used for reference during localization. Any
  68. text that has an entry in a glossary may be translated automatically by using one of the suggested
  69. translations found in that glossary.
  70. Each of the tools in the RLToolset is described in the following pages. In addition to the tools described
  71. here, the RLToolset uses the Windows Dialog Editor (DLGEDIT.EXE) and the Windows Resource
  72. Compiler (RC.EXE) which are also part of the Windows SDK.
  73. Windows Based Tools:
  74. The Windows based tools in the RLToolset provide a completely automated and user friendly set of tools
  75. for localization.
  76. RLQuikEd is a simple resource editor that allows the user to view the resources contained in a resource
  77. file, modify those resources and write the changes back to either the same resource file or a new resource
  78. file. RLQuikEd does not provide any update capabilities and should only be used with resource files that
  79. will not be changed. Due to its simplicity, RLQuikEd is ideal for localizing products that have
  80. completed the development cycle.
  81. RLAdmin is a tool that is used by the project administrator to create and maintain master project files
  82. which track updates and maintain master token files. This tool allows the project administrator to review
  83. updates and edit token status fields as desired.
  84. RLEdit is a tool that is used by localizers to create and maintain language project files which track
  85. updates to the master project files and maintain language token files. This tool allows the localizer to
  86. translate tokens and build target resource files.
  87. This section describes in detail each of these three tools.
  88. RLQuikEd
  89. RLQuikEd is a simple resource editor that allows the user to view the resources contained in a resource
  90. file, modify those resources and write the changes back to either the same resource file or a new resource
  91. file. RLQuikEd does not provide any update capabilities and should only be used with resource files that
  92. will not be changed. Due to its simplicity, RLQuikEd is ideal for localizing products that have completed
  93. the development cycle.
  94. The RLQuikEd menu is divided into five drop-down menus: File, Glossary,
  95. Edit, Operations, and Help.
  96. The File-Open, File-Close, File-Save, File-Save As, and File-Exit
  97. commands all work on resource files (both .RES and .EXE files). The
  98. File-Save, File-Close, and File-Exit commands save all work back into
  99. the original resource file. The File-Save As command allows the user to
  100. create a new resource file.
  101. Once a resource file has been opened, the localizable resources are
  102. displayed in a list box in the main window data area. Selecting a
  103. resource by double clicking or by pressing enter in the list box brings
  104. up a dialog box which allows the user to translate the text. A
  105. translate button offers suggested translations for the token taken from
  106. the glossary file. Each time the translate button is pressed a
  107. different translation is suggested. When all translations from the
  108. glossary file are exhausted, the original test is displayed. An add to
  109. glossary button allows the selected token's translation to be added to
  110. the glossary file.
  111. The File-Close command prompts the user to save all work and returns the
  112. program to its initial "empty" state.
  113. The File-Exit command performs the same operation as the File-Close
  114. command and then exits the program.
  115. The Glossary-Choose Glossary command allows the user to specify a
  116. glossary which can then be used as an aid for translating the resource.
  117. The user must choose a glossary to use the translate and add to glossary
  118. buttons.
  119. The Edit-Find command brings up a dialog box that allows the user to
  120. search for and modify a given token using any of the token structure
  121. fields. The Edit-Find Next Up and Edit-Find Next Down commands repeat
  122. the most recent find in the indicated direction.
  123. The Edit-Copy command copies a token's text into the clipboard.
  124. The Edit-Paste command copies text from the clipboard into a token's
  125. text.
  126. The Operations-Resize Dialog Boxes command builds a temporary resource
  127. file from the edited tokens, and launches the Windows dialog editor with
  128. the temporary resource file loaded. When the user exits the dialog
  129. editor, RLQuikEd will regenerate the token list from the edited resource
  130. file.
  131. The Help-Help Index command displays on-line help.
  132. The Help-About RLQuikEd command displays copyright, author and version
  133. information.
  134. RLAdmin
  135. RLAdmin (short for Resource Localization Administrator) allows a project
  136. administrator to create and maintain master project files which track
  137. updates and maintain master token files.
  138. The RLAdmin menu is divided into four drop-down menus: Project, Edit,
  139. Operations, and Help.
  140. The commands in the Project menu operate on master project files (MPJs).
  141. A master project file contains fields for the source resource file,
  142. custom resource description files (RDFs), the master token file, and a
  143. date stamp containing the last time the master token file was updated.
  144. Each time a master project file is opened or a new master project file
  145. is created, RLAdmin checks to see if the master token file should be
  146. updated. If the resource file has a date stamp which differs from the
  147. date stamp in the MPJ, the user is asked if an update should be
  148. performed. If the master token file does not exist then RLAdmin will
  149. generate the file.
  150. The Project-New, Project-Open, Project-Close, commands all work with
  151. master project files.
  152. Once a master project file has been opened, the token strings in the
  153. master token file are updated, if necessary, and displayed in a list box
  154. in the main window data area. Unchanged tokens are black, changed
  155. tokens are red, and read-only tokens are gray. Selecting a token by
  156. double clicking or by pressing enter in the list box brings up a dialog
  157. box which allows the user to edit the token's status.
  158. Note that there are no Project-Save commands. RLAdmin will
  159. automatically saves all work when the project is closed, or a new
  160. project is selected.
  161. The Project-View command invokes a dialog box that displays data
  162. relating to the selected project.
  163. The Project-Close command saves all work and returns the program to its
  164. initial "empty" state.
  165. The Project-Exit command performs the same operation as the Project-
  166. Close command and then exits the program.
  167. The Edit-Find command brings up a dialog box that allows the user to
  168. search for and modify a given token using any of the token structure
  169. fields. The Edit-Find Next Up and Edit-Find Next Down commands repeat
  170. the most recent find in the indicated direction.
  171. The Edit-Review command brings up an edit dialog box for each token
  172. marked as changed since the last update.
  173. The Edit-Copy Token command copies an entire token into the clipboard.
  174. This includes the token ID and the token text. This is primarily
  175. supported to allow the entire token to be pasted in a document (such as
  176. an electronic mail message) for bug reporting purposes.
  177. The Edit-Copy command copies a token's text into the clipboard.
  178. The Edit-Paste command copies text from the clipboard into a token's
  179. text.
  180. The Help-Help Index command displays on-line help.
  181. The Help-About RLAdmin command displays copyright, author and version
  182. information.
  183. RLEdit
  184. RLEdit is a tool that is used by localizers to create and maintain language project files which track
  185. updates to the master project files and maintain language token files. This tool allows the localizer to
  186. translate tokens and build target resource files.
  187. The RLEdit menu is divided into four drop-down menus: Project, Edit,
  188. Operations, and Help.
  189. The commands in the Project menu operate on project files (PRJs). A
  190. project file contains fields for the master project file, the language
  191. token file, the target resource file, a date stamp indicating the last
  192. time the language token file was updated, and an optional glossary file.
  193. Each time a project file is opened or a new project file is created,
  194. RLEdit will check to see if the language token file should be updated.
  195. If the master token file has a date stamp which differs from the date
  196. stamp in the PRJ file, the user is asked if an update should be
  197. performed. If the language token file does not exist then RLEdit
  198. generates it.
  199. The Project-New, Project-Open, Project-Close, and Project-Save commands
  200. all work with project files.
  201. When a project file is opened the tokens are checked to see if they must
  202. be updated. If they need to be updated then RLEdit updates the tokens
  203. automatically.
  204. Once a project file has been opened, the token strings in the language
  205. token file are displayed in a list box in the main window data area.
  206. Clean tokens are black, dirty tokens (tokens which have not been
  207. translated since they last changed) are red, and read-only tokens are
  208. gray. Selecting a token by double clicking or by pressing enter in the
  209. list box brings up a dialog box which allows the user to translate the
  210. token text and mark the text as clean. A check box allows the user to
  211. change the read-only status of the token. The untranslated text is
  212. retrieved from the master token file as each token is viewed. An
  213. untranslate button replaces the token's text with text from the master
  214. token file. A translate button offers suggested translations for the
  215. token taken from the glossary file. Each time the translate button is
  216. pressed a different translation is suggested. When all translations
  217. from the glossary file are exhausted, the original test is displayed.
  218. An add to glossary button allows the selected token's translation to be
  219. added to the glossary file.
  220. RLEdit automatically saves all work whenever the dialog editor is
  221. started, when a target file is generated, when a project is closed, or
  222. when a new project is opened, however the Project-Save command may be
  223. used to save work in progress at any time without leaving the selected
  224. project.
  225. The Project-View command invokes a dialog box that displays data about
  226. the selected project.
  227. The Project-Close command saves all work and returns the program to its
  228. initial "empty" state.
  229. The Project-Exit command performs the same operation as the Project-
  230. Close command and then exits the program.
  231. The Edit-Find command brings up a dialog box that allows the user to
  232. search for and modify a given token using any of the token structure
  233. fields. The Edit-Find Next Up and Edit-Find Next Down commands repeat
  234. the most recent find in the indicated direction.
  235. The Edit-Review command brings up an edit dialog box for each token
  236. marked as changed since the last update.
  237. The Edit-Copy Token command copies an entire token into the clipboard.
  238. This includes the token ID and the token text. This is primarily
  239. supported to allow the entire token to be pasted in a document (such as
  240. an electronic mail message) for bug reporting purposes.
  241. The Edit-Copy command copies a token's text into the clipboard.
  242. The Edit-Paste command copies text from the clipboard into a token's
  243. text.
  244. The Operations-Generate Resource File command builds the target resource
  245. file from the language token file. The current language resource file
  246. must be up to date with the resource file for this command to be
  247. enabled.
  248. The Operations-Resize Dialog Boxes command builds a temporary resource
  249. file from the edited tokens, and launches the Windows dialog editor with
  250. the temporary resource file loaded. When the user exits the dialog
  251. editor, RLEdit will regenerate the token list from the edited resource
  252. file. The current language resource file must be up to date with the
  253. source resource file for this command to be enabled.
  254. The Help-Help Index command displays on-line help.
  255. The Help-About RLEdit command displays copyright, author and version
  256. information.
  257. DOS Based Tool:
  258. The DOS based tool (TokRes in the Win16 version and RLMan - see RLMAN.DOC - in the Win32
  259. version) duplicates the update, automated translation, tokenization, and resource generation functions of
  260. the Windows based tools. It may be operated from the command line, via batch files, or via build scripts.
  261. The most common use for the DOS based tool is to eliminate the need to use RLAdmin for updating
  262. master token files but it can be used (in conjunction with a text editor) to take the place of all of the
  263. Windows based tools.
  264. TokRes
  265. TokRes is a tool for merging and extracting tokens to and from resource files.
  266. The syntax of the TokRes command is as follows:
  267. Usage: TokRes [-c <RDF_file>] -{h|e|t|r} <files>
  268. -h Print usage message
  269. -e <Input_exe_file> <Output_res_file> Extract resources
  270. from an exe to a res file.
  271. -t <Input_res_file> <Ouput_tok_file> Build token file
  272. from exe or res file
  273. -r <Input_res_file> <Input_tok_file> < Output_res_file> Build
  274. res or exe file.
  275. -c RDF_file Use custom resources defined in
  276. resource description file
  277. Data Files and Data Formats
  278. The RLToolset uses a variety of special file types. Every one of the file formats described below is a
  279. special form of text file. Each of the file is human-readable and can be edited with any standard text file
  280. editor (such as Notepad).
  281. As a general rule, all text in these files follows the C escape convention when dealing with non-
  282. displayable characters. This convention uses escape characters to represent non-displayable characters.
  283. For example, \n is newline and \t is tab.
  284. Master Project Files (MPJs)
  285. Master project files consist of four lines of text:
  286. * The first line contains the path to the source resource file. This
  287. may be either a .RES file, a .DLG file or an .EXE file.
  288. * The second line contains the path to the master token file (MTK).
  289. * The third line contains zero, one or more paths to resource
  290. description files (RDFs) separated by spaces.
  291. * The fourth line contains a date stamp indicating the date of the
  292. source resource file as of the last update.
  293. Project Files (PRJs)
  294. Project files consist of five lines of text:
  295. * The first line contains the path to the master project file (MPJ).
  296. * The second line contains the path to the language token file (TOK).
  297. * The third line contains the path to the target resource file. This
  298. may be either a .RES file or (if the source resource in the MTK is an
  299. .EXE file) an .EXE file.
  300. * The fourth line contains a date stamp indicating the date of the
  301. master token file (MTK) as of the last update.
  302. * The fifth line may be left blank or it may contain the path to a
  303. glossary file.
  304. Master Token Files (MTKs)
  305. Master token files are text files which contain tokenized resources taken from some source resource file.
  306. Each token consists of a unique identifier followed by the text form of the resource data. Tokens are
  307. delimited by end-of-line characters.
  308. Master token files are used for update tracking. They contain no localized resource data.
  309. An example of what one token might look like is shown below:
  310. [[5|255|1|32|5|"FOO"]]=Localizable string containing text in C format.
  311. The token ID is surrounded by double square brackets and divided into 6 fields delimited by the vertical
  312. pipe | symbol:
  313. * The first field indicates the type of the resource
  314. * The second field is the resource name in the case of an enumerated
  315. resource or it is 255 if the name is a label in which case the label
  316. itself is stored in the sixth field.
  317. * The third field is the internal resource id number taken from the
  318. resource header.
  319. * The fourth field is made up of a combination of data taken from the
  320. resource header and generated by the tools. This value is used in
  321. conjunction with the other values in the token ID to uniquely
  322. identify the resource.
  323. * The fifth field is a status field used by the update tools to
  324. determine the status of the current token.
  325. * The sixth field contains the name of the resource in the case that
  326. the resource is identified by a label. Otherwise it contains a null
  327. string.
  328. A token ID is followed by an equal sign which is in turn followed by the
  329. resource data. The data extends to the end of line and is stored using
  330. the C escape convention. Non printing characters (such as new-line and
  331. control characters) are represented using C escape sequences. Two of
  332. the most common are \n for new-line and \t for tab.
  333. A token's status field is made up by combinations of three basic flags:
  334. * ST_CHANGED 4 indicates that the token has changed since the
  335. last update
  336. * ST_READONLY 2 indicates that the token should not be
  337. localized.
  338. * ST_NEW 1 used in conjunction with the ST_CHANGED flag to indicate whether
  339. this is the new or the old version of the token.
  340. For example, if a token has changed during an update, the current text would be stored in a token with a
  341. status of ST_NEW + ST_CHANGED or 4 + 1 = 5. The previous text is also stored in the token file using
  342. the same token ID but the status field would contain ST_CHANGED or 4. This way both the current and
  343. the previous text are retained.
  344. Language Token Files (TOKs)
  345. Language token files are similar to master token files; the only difference being the meaning of the status
  346. fields found in the token identifiers.
  347. Language token files are used during localization. They contain localized resource data.
  348. A token's status field is made up by combinations of four flags:
  349. * ST_TRANSLATED 4 indicates that the token contains text that
  350. should be put in the target resource. If a
  351. token is not marked as ST_TRANSLATED then it
  352. contains unlocalized text from the master token
  353. file which is maintained for update tracking
  354. purposes.
  355. * ST_READONLY 2 indicates that the token should not be
  356. localized.
  357. * ST_NEW 1 used only for tokens that are not marked with the ST_TRANSLATED
  358. flag to indicate whether this is the new or the old version of the
  359. unlocalized token.
  360. * ST_DIRTY 1 used only for tokens that are marked with the ST_TRANSLATED flag
  361. to indicate that the token is in need of attention (either the original
  362. translation has changed or the token has never been localized).
  363. For example, a clean, localized token is marked only with the ST_TRANSLATED flag and therefore has
  364. a status value of 4.
  365. Resource Description Files (RDFs)
  366. Custom resources are described in resource description files (RDFs)
  367. using c-like structure definitions. Each definition is identified with
  368. a specific resource type and the definition is applied to every resource
  369. of that given type.
  370. An identifier is declared by the following syntax:
  371. <type>
  372. Types are numbers or quoted names UNLESS they are normal windows types
  373. in which case the standard Windows type name may be used in place of a
  374. number or name. (CURSOR, BITMAP, ICON, MENU, DIALOG, STRING, FONTDIR,
  375. FONT, ACCELERATORS, RCDATA, ERRTABLE, GROUP_CURSOR, GROUP_ICON,
  376. NAMETABLE, and VERSION).
  377. A structure definition follows normal c syntax with the following
  378. limitations and differences:
  379. * Each definition must be fully enclosed in braces { }.
  380. * The following data types are accepted: char (single-byte character),
  381. wchar (Unicode character), tchar (same as wchar in NT version of
  382. tools, same as char in Windows 3.1 version), int, float, long, short,
  383. unsigned, near and far pointers. (Labels and macros are not legal.)
  384. * Nested structures and arrays are legal. All arrays must have a fixed
  385. count except for strings which are described below. int[10] is legal
  386. whereas int[] is not.
  387. * Null terminated strings (sz's) are the only variable length
  388. structures allowed. They are represented as an array of characters
  389. with no length: char[]
  390. * Fixed length strings are represented as arrays of characters with a
  391. fixed length: char[10]
  392. * Comments may be included in the file using standard c comment
  393. delimiters (/* */ and //) or by placing them after the pound symbol
  394. #.
  395. * Localizable types (types that need to be placed in token files) are
  396. indicated by all caps. Hence INT would generate a token while int
  397. would not.
  398. The following is a sample RDF file:
  399. # This is a sample Resource Description File
  400. <"type"> {
  401. int, // no token will be generated for this integer
  402. CHAR // this single-byte character will be placed in a token
  403. }
  404. <RCDATA> {
  405. WCHAR[] // a null terminated Unicode string that requires a token
  406. wchar[] // no token will be generated for this Unicode string
  407. }
  408. <1000>
  409. {
  410. TCHAR[], // a null terminated Unicode or OEM string that requires
  411. // a token (Unicode if running NT version, else OEM).
  412. {
  413. int,
  414. FLOAT, // localizable floating point value
  415. far *,
  416. CHAR[20] // localizable 20 character single-byte string
  417. }[3], // an array of three structures (NOT IMPLEMENTED YET)
  418. int
  419. }
  420. END
  421. Glossaries (TXTs)
  422. Glossaries are sorted text files containing suggested translations for resource data.
  423. Each line in a glossary is divided into four fields delimited by tabs. The first field is the untranslated text.
  424. The second field is a single character indicating the hot-key (if any) associated with the untranslated text.
  425. The third field is a suggested translation and the fourth field is the hot-key (if any) associated with the
  426. suggested translation.
  427. Glossaries may be edited using any good text editor but they are best edited by loading them into an Excel
  428. spread sheet. This way each field occupies a different column in the spread sheet.
  429. Throughout this document, the term localization refers to the process of preparing a product for an
  430. international market. This process involves (among other things) translating text and resizing controls
  431. such as dialogs and buttons. A person performing localization is referred to as a localizer.
  432. This document refers to a resource file as being any file that contains Windows resources. This can be a
  433. Windows executable format file as well as a .RES file. The RLToolset can use either .EXE or .DLL files
  434. or .RES files as resource files.
  435. A project administrator is any person who is designated to maintain a master token file. If a resource
  436. file is being localized for more than one environment, one person should be designated as a project
  437. administrator to ensure that the master token file only gets updated when necessary and that each
  438. language token file gets updated before the next time the master token file is updated. This will ensure
  439. that the update tracking information does not become inaccurate due to unnecessary updates. However it
  440. should be stated this is actually a very minor problem. In the event that update tracking information
  441. should become corrupted, localized resource data would still remain valid. The problem will correct itself
  442. after the next complete update.
  443. This document refers to a resource file as being any file that contains Windows resources. This can be
  444. an .EXE file or a .DLL file as well as a .RES file. The RLToolset can use either .EXE files, .DLL files or
  445. .RES files as resource files. Currently we only support Win 3.1 .EXEs and .DLLs. .EXEs and .DLLs
  446. built under Win 3.0 may cause errors. We recommend using .RES files for earlier projects.
  447. 1