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.

664 lines
24 KiB

  1. Resource Localization Manager User's Guide
  2. Version 1.72
  3. 05/03/94 09:51 AM
  4. Copyright � 1992-1994 Microsoft Corporation
  5. Table of Contents
  6. Table of Contents 2
  7. Introduction 3
  8. Usage: 4
  9. Languages IDs 6
  10. Localization Process 8
  11. One-Shot Process 8
  12. Parallel Process 9
  13. Project Creation 9
  14. Maintaining the Master Project 9
  15. Maintaining Each Locale Project 9
  16. Data Files and Formats 10
  17. Master Project Files (MPJ) 10
  18. Project Files (PRJ) 10
  19. Master Token Files (MTK) 11
  20. Language Token Files (TOK) 12
  21. Resource Description Files (RDF) 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 process
  25. requires at least a rudimentary knowledge of computer programming and is often prone to human error.
  26. The Resource Localization Manager (hereafter referred to as RLMan) was designed to automate
  27. localization of products that make use of the Windows resource model by allowing the localizer to extract
  28. localizable resources directly from the applications that use them, modify the resources, and use the
  29. 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. RLMan was designed with several goals in mind. Some of these goals were:
  32. * Allow the product to be localized without re-compilation.
  33. * Allow localization to proceed concurrent with development (provide update capability).
  34. * Allow localizers to share glossaries of common terms among applications.
  35. The localization model followed by the RLMan is very simple. Localizable resources are extracted from a
  36. source resource file and put into special text file called a token file. Each localizable resource may
  37. generate one or more tokens. Each token is contained on a single line of text and consists of a unique
  38. identifier followed by the localizable data associated with that particular resource. These tokens can then
  39. be localized by using a standard text editor.
  40. The localized tokens are then used in conjunction with the source resource file to generate a new localized
  41. resource file. The term "resource file" in this document means "any Windows executable format file
  42. (.EXE, .DLL, .CPL, etc.) or .RES file". The target resource file will contain exactly the same resources as
  43. the source resource file, the only difference is that the data will be localized.
  44. This model has been expanded a little to allow for update tracking. When localization is done in
  45. conjunction with development a target resource file may change after the localizer has tokenized the file
  46. and begun translation. Update tracking allows the localizer to update the localized token file without
  47. losing any work that might have been done. Any resources that may have changed since the most recent
  48. update are marked "dirty" and the change is tracked in the token file so the localizer may see exactly what
  49. changed and exactly how it changed.
  50. To allow for update tracking, the source resource file is used to generate a "master token file" which tracks
  51. changes. The master token file is then used to update any number of "language token files" (one for each
  52. target language). These language token files are then localized and used to generate the target resource
  53. files.
  54. Usage:
  55. Any file name can include a UNC (Unified Naming Convention) share name or drive letter, and a
  56. directory path.
  57. The syntax of the 'RLMan' command is as follows:
  58. rlman [-c RDFile] [ -p CodePage ] [ -f ResType ] [-{n|o} PriLang SubLang] [-w] -{e|t|m|l|r|a} files
  59. -e InputExeFile OutputResFile
  60. Extract localizable resources from the resource file (.exe, .dll, .cpl, .etc.) InputExeFile and create
  61. a Win32 resource file OutputResFile. This output file can then be used, for example, by the
  62. dialog box editor or the bit map editors that come with the SDK.
  63. -t InputResOrExeFile OuputTokenFile
  64. This option will extract the localizable resources from the executable or resource format file
  65. InputResOrExeFile and create a project token file OuputTokenFile. Using this option will
  66. circumvent the history-keeping mechanism of RLMan. It is made available for those times when
  67. the user wants to simply see what localizable resources are in the input file or when the history
  68. mechanism is not needed. Using the -o option and the -p option with the -t option will allow one
  69. to extract and tokenize resources of a specific language. The resulting token file will contain only
  70. those resources that have the specified locale and the text will be in the given code page.
  71. -m MasterProjectFile [ InputResOrExeFile MasterTokenFile ]
  72. When the history mechanism is wanted, the first step when creating a new master project or
  73. updating an existing master project is to use this option. If the MasterProjectFile does not exist,
  74. the optional InputResOrExeFile and MasterTokenFile arguments must be provided. These last
  75. two arguments will be ignored if the MasterProjectFile exists.
  76. -l LanguageProjectFile [ MasterProjectFile LanguageTokenFile ]
  77. This option is used, when the history mechanism is wanted, to create a new localization project
  78. or to update an existing project. If the LanguageProjectFile does not exist, the optional
  79. MasterProjectFile (the one created via the -m option) and LanguageTokenFile arguments must
  80. be provided. These last two arguments will be ignored if the LanguageProjectFile exists.
  81. -r InputResOrExeFile LanguageTokenFile_or_ResFile OutputResOrExeFile
  82. This option is used to create a localized version of the InputResOrExeFile. The resources in that
  83. InputResOrExeFile will be replaced with the localized resources in
  84. LanguageTokenFile_or_ResFile. OutputResOrExeFile is the localized version. . If the
  85. LanguageTokenFile_or_ResFile is a Token file, use the -o option to specifiy what the old
  86. language to be replaced is and use the -n option to specifiy what the new language is.
  87. -a InputResOrExeFile LanguageTokenFile_or_ResFile OutputResOrExeFile
  88. This option is used to create a localized version of the InputResOrExeFile. The resources in the
  89. resulting OutputResOrExeFile will include the original resources from InputResOrExeFile plus
  90. the localized resources in LanguageTokenFile_or_ResFile. If the
  91. LanguageTokenFile_or_ResFile is a Token file, use the -n option to specifiy what the new
  92. language is.
  93. -n PriLang SubLang
  94. Specifies what the language the tokens in the token file are in and consequently what language
  95. the new resources are in. Used when setting up a new Language Project (-l) and with the -r and -
  96. a options. Can also be used with the -m option when the resources in the original resource file
  97. are not in U.S. English. PriLang SubLang are decimal values from the list of allowed values in
  98. the SDK.
  99. -o PriLangID SubID
  100. Specifies what the language the resources being replaced in, or extracted from, the source
  101. resource file are in.
  102. Used with the -r and -a options when the resources being replaced, or added to, in the original
  103. resource file are not in U.S. English. PriLang SubLang are decimal values from the list of
  104. allowed values in the SDK. For example, if the U.S. English resources had been replaced with
  105. German resources and now you wanted to add French resources to that German file, use the -o
  106. option (with arguments 7 1) to indicate that the original resources are in German not U.S English
  107. together with the -a option. Or, if you had created a file with U.S. English plus German resources
  108. in it, and now you wanted to replace the German resources with French (thus making a U.S
  109. English plus French file), you would use the -r option with the -o option (with arguments 7 1)
  110. and the -n option ( with arguments 12 1) to indicate that the old German resources are to be
  111. replaced with the new ones in the given French token file.
  112. Used with the -t option, this identifies the language of the resources that are to be tokenized. You
  113. should also use the -p option to specifiy the code page the text in the token file is to be written in.
  114. -c RDFile
  115. Use custom resources defined in the resource description file RDFile.
  116. -p CodePage
  117. The default code page used in converting between the Unicode resources and the text in the token
  118. files is the Windows ANSI code page. To change the code page, use this option and use the IBM
  119. code page number as the CodePage argument. For example; -p 932.
  120. -f ResourceType
  121. By default, all localizable resources are extracted. To extract a single resource type, use this
  122. option with ResourceType set to the resource type's numeric value (1-16 for Windows resources).
  123. -w
  124. Print warnings about unknown custom resource types (-c option not given or resource type is not
  125. in the RDFFile), and about resources that are not tokenized because their language is not the
  126. language requested (-o option, or US English by default). It will also warn of any zero-length
  127. resources found.
  128. Languages IDs
  129. Primary Language ID's
  130. Sub language IDs.
  131. Neutral
  132. 0x00
  133. Neutral
  134. 0x00
  135. Albanian
  136. 0x1c
  137. Default
  138. 0x01
  139. Arabic
  140. 0x01
  141. System Default
  142. 0x02
  143. Bahasa
  144. 0x21
  145. Arabic (Saudia Arabia)
  146. 0x04
  147. Bulgarian
  148. 0x02
  149. Arabic (Iraq)
  150. 0x08
  151. Byelorussian
  152. 0x23
  153. Arabic (Egypt)
  154. 0x0C
  155. Catalan
  156. 0x03
  157. Arabic (Libya)
  158. 0x10
  159. Chinese
  160. 0x04
  161. Arabic (Algeria)
  162. 0x14
  163. Czech
  164. 0x05
  165. Arabic (Morocco)
  166. 0x18
  167. Danish
  168. 0x06
  169. Arabic (Tuinisa)
  170. 0x1C
  171. Dutch
  172. 0x13
  173. Arabic (Oman)
  174. 0x20
  175. English
  176. 0x09
  177. Arabic (Yemen)
  178. 0x24
  179. Estonian
  180. 0x25
  181. Arabic (Syria)
  182. 0x28
  183. Farsi
  184. 0x29
  185. Arabic (Jordan)
  186. 0x2C
  187. Finnish
  188. 0x0b
  189. Arabic (Lebanon)
  190. 0x30
  191. French
  192. 0x0c
  193. Arabic (Kuwait)
  194. 0x34
  195. German
  196. 0x07
  197. Arabic (U.A.E.)
  198. 0x38
  199. Greek
  200. 0x08
  201. Arabic (Bahrain)
  202. 0x3C
  203. Hebrew
  204. 0x0d
  205. Arabic (Qatar)
  206. 0x40
  207. Hungarian
  208. 0x0e
  209. Chinese (Traditional)
  210. 0x01
  211. Icelandic
  212. 0x0f
  213. Chinese (Simplified)
  214. 0x02
  215. Italian
  216. 0x10
  217. Chinese (Taiwan)
  218. 0x04
  219. Japanese
  220. 0x11
  221. Chinese (PRC)
  222. 0x08
  223. Kampuchean
  224. 0x2c
  225. Chinese (Hong Kong)
  226. 0x0C
  227. Korean
  228. 0x12
  229. Chinese (Singapore)
  230. 0x10
  231. Laotian
  232. 0x2b
  233. Dutch
  234. 0x01
  235. Latvian
  236. 0x26
  237. Dutch (Belgian)
  238. 0x02
  239. Lithuanian
  240. 0x27
  241. English (US)
  242. 0x01
  243. Maori
  244. 0x28
  245. English (UK)
  246. 0x02
  247. Norwegian
  248. 0x14
  249. English (Australian)
  250. 0x03
  251. Polish
  252. 0x15
  253. English (Canadian)
  254. 0x04
  255. Portuguese
  256. 0x16
  257. English (New Zealand)
  258. 0x05
  259. Rhaeto Roman
  260. 0x17
  261. English (Ireland)
  262. 0x06
  263. Romanian
  264. 0x18
  265. French
  266. 0x01
  267. Russian
  268. 0x19
  269. French (Belgian)
  270. 0x02
  271. Serbo Croatian
  272. 0x1a
  273. French (Canadian)
  274. 0x03
  275. Slovak
  276. 0x1b
  277. French (Swiss)
  278. 0x04
  279. Spanish
  280. 0x0a
  281. German
  282. 0x01
  283. Swedish
  284. 0x1d
  285. German (Swiss)
  286. 0x02
  287. Thai
  288. 0x1e
  289. German (Austrian)
  290. 0x03
  291. Turkish
  292. 0x1f
  293. Hebrew (Israel)
  294. 0x04
  295. Ukrainian
  296. 0x22
  297. Italian
  298. 0x01
  299. Urdu
  300. 0x20
  301. Italian (Swiss)
  302. 0x02
  303. Vietnamese
  304. 0x2a
  305. Japanese (Japan)
  306. 0x04
  307. Sub language IDs. (cont.)
  308. Korean (Korea)
  309. 0x04
  310. Norwegian (Bokmal)
  311. 0x01
  312. Norwegian (Nynorsk)
  313. 0x02
  314. Portuguese (Brazilian)
  315. 0x01
  316. Portuguese
  317. 0x02
  318. Serbo Croatian (Latin)
  319. 0x01
  320. Serbo Croatian
  321. (Cyrillic)
  322. 0x02
  323. Spanish (Traditional
  324. Sort)
  325. 0x01
  326. Spanish (Mexican)
  327. 0x02
  328. Spanish (Modern Sort)
  329. 0x03
  330. Thai (Thailand)
  331. 0x04
  332. Localization Process
  333. There are two basic types of localization. The first is when a product is correctly enabled for localization
  334. ("globalized"), the product development is finished, and all that is needed is to modify the localizable
  335. resources. We'll call this the "one-shot process". The second is when a product is being localized in
  336. parallel with the development process and the localization work is to be preserved across new builds of the
  337. original (typically English) file. We'll call this the "parallel process". It is done in parallel with product
  338. development so the localized versions are ready as soon as possible after the domestic version is.
  339. The next two sections describe, in a step-by-step list, the procedure to use for the two processes. In the
  340. sample command lines, the executable is called "prog.exe". A GUI version of RLMan is being developed.
  341. That version will make the various steps invisible to the user and will incorporate an editor that hides the
  342. token ID part of the lines in the token file.
  343. One-Shot Process
  344. To simplify the file names on the command line, change directories to the place where the localized files
  345. are to be kept. Leave the source executable (typically the English version) in some other directory *
  346. anywhere on the network or on the local machine.
  347. If you have a localized .RES file, simply skip to step 4 and use the .RES file in place of the .TOK file
  348. name shown in that step�s example.
  349. 1. Create the project token file "prog.tok".
  350. rlman -t prog.exe prog.tok
  351. 2. Translate the text in the "prog.tok" file with your favorite text editor. Assume German in this
  352. example.
  353. 3. If dialog boxes are to be resized, create the file "tmpprog.exe" which will contain the translated text.
  354. rlman -n 7 1 -r prog.exe prog.tok tmpprog.exe
  355. Create the .RES file, in German, needed by the dialog editor in the SDK.
  356. rlman -e tmpprog.exe prog.res
  357. Resize the dialog boxes as appropriate to account for the different lengths of the translated text.
  358. dlgedit prog.res
  359. Update the project token file with the revised dialog box coordinates and sizes.
  360. rlman -t prog.res prog.tok
  361. 4. Create the final, localized, executable.
  362. rlman -n 7 1 -r prog.exe prog.tok newprog.exe
  363. This completes the process. The German file "newprog.exe" is now ready to be tested.
  364. Parallel Process
  365. This process maintains the localization work from one build of the source executable (typically the
  366. English version) to the next. With this version of RLMan there is one caveat * if the developers change
  367. the ID number of a localizable item, the previous translation will be lost. This is being addressed and a
  368. solution will be available in a future release of RLMan. New items can be added or old ones deleted but an
  369. item with a changed ID will show up as a new item.
  370. Project Creation
  371. 1. Create a directory for the master files and a separate directory for the project files. These
  372. directories may be anywhere on the net. The master project directory may contain any
  373. number of master projects, one need not create a new directory for each project as long as the
  374. base name for each master project in unique. There should be a separate directory for each
  375. localized version of the executable file. Typically this means one directory for each language.
  376. 2. Move to the master directory.
  377. 3. Copy the source executable to the master directory.
  378. 4. Create the master project file and the master token file.
  379. rlman -m prog.mpj prog.exe prog.mtk
  380. 5. Move to the project directory (for German in this example).
  381. 6. Create the project file and the project token file.
  382. rlman -n 7 1 -l prog.prj prog.mpj prog.tok
  383. 7. Steps 5 and 6 need to be repeated for each project directory (language). The resulting
  384. prog.tok files can then be translated to the appropriate language.
  385. Maintaining the Master Project
  386. 1. Copy the newly built source executable to the master directory.
  387. 2. Move to the master directory, then update the master project file and the master token file.
  388. rlman -m prog.mpj
  389. Maintaining Each Locale Project
  390. 1. Follow steps 2 and 3 of the "one-shot process" (previous page) as often as desired until the
  391. resources are localized satisfactorily.
  392. 2. Every time the master project is been updated (step 2 in the "Maintaining the Master Project"
  393. section), update the project file and project token file.
  394. rlman -l prog.prj
  395. Repeat step 1 as needed to catch new or changed resource items.
  396. Data Files and Formats
  397. RLMan uses a variety of special file types. All of the file formats described below are a special form of text
  398. file. Each file is human-readable and can be edited with any standard text file editor (such as Notepad).
  399. As a general rule, all text in these files follows the C escape convention when dealing with non-
  400. displayable characters. This convention uses escape characters to represent non-displayable characters.
  401. For example, \n is newline and \t is tab.
  402. Master Project Files (MPJ)
  403. Master project files consist of four lines of text:
  404. * The first line contains the path to the source resource file. This may be either a .RES file, or an .EXE
  405. format file.
  406. * The second line contains the path to the master token file (MTK).
  407. * The third line contains zero, one or more paths to resource description files (RDFs) separated by
  408. spaces.
  409. * The fourth line contains a date stamp indicating the date of the source resource file as of the last
  410. update.
  411. * The fifth line contains a date stamp indicating the date of the master token file as of the last update of
  412. the master project.
  413. * The sixth line contains the Language ID of the resources in the master token file (.MTK).
  414. Project Files (PRJ)
  415. Project files consist of five lines of text:
  416. * The first line contains the path to the master project file (MPJ).
  417. * The second line contains the path to the language token file (TOK).
  418. * The third line contains the path to the target resource file. This may be either a .RES file or (if the
  419. source resource in the MTK is an .EXE file) an .EXE format file.
  420. * The fourth line contains a date stamp indicating the date of the master token file (MTK) as of the last
  421. update of the project.
  422. * The fifth line may be left blank or it may contain the path to a glossary file. (Not used in this release.)
  423. * The sixth line contains the code page used when reading/writing the project token file. A zero (0)
  424. means the system's Windows ANSI code page. A one (1) means the syetem's default OEM code page.
  425. * The seventh line contains the Language ID of the resources in the language token file (.TOK).
  426. Master Token Files (MTK)
  427. Master token files are text files which contain tokenized resources taken from some source resource file.
  428. Each token consists of a unique identifier followed by the text form of the resource data. Tokens are
  429. delimited by end-of-line characters.
  430. Master token files are used for update tracking. They contain no localized resource data and should not be
  431. changed except by RLMan.
  432. An example of what one token might look like is shown below:
  433. [[5|255|1|32|5|"FOO"]]=Localizable string containing text in C format.
  434. The token ID is surrounded by double square brackets and divided into 6 fields delimited by the vertical
  435. pipe '|' symbol:
  436. * The first field indicates the type of the resource
  437. * The second field is the resource name in the case of an enumerated resource, or it is 65535 if the
  438. name is a label (string) in which case the label itself is stored in the sixth field.
  439. * The third field is the internal resource id number taken from the resource header.
  440. * The fourth field is made up of a combination of data taken from the resource header and generated by
  441. the tools. This value is used in conjunction with the other values in the token ID to uniquely identify
  442. the resource.
  443. * The fifth field is a status field used by the update tools to determine the status of the current token.
  444. * The sixth field contains the name of the resource if the resource is identified by a label. Otherwise it
  445. contains a null string.
  446. A token ID is followed by an equal sign which is in turn followed by the resource data. The data extends
  447. from after the equal sign to the end of the line (exclusive). Non printing characters (such as new-line and
  448. control characters) are represented using C escape sequences. Two of the most common are \n for new-
  449. line and \t for tab. Some characters are shown in the form '\nnn' where nnn is the decimal value of that
  450. character.
  451. A token's status field is made up of combinations (bitwise OR'ing) of three basic flags:
  452. * CHANGED 4 indicates that the token has changed since the last update
  453. * READONLY 2 indicates that the token should not be localized.
  454. * NEW 1 used in conjunction with the CHANGED flag to indicate that this is
  455. the new version of the token.
  456. For example, if a token has changed during an update, the current text would be stored in a token with a
  457. status of CHANGED+NEW (4 + 1) = 5. The previous text is also stored in the token file using the same
  458. token ID but the status field would contain a 4 (CHANGED). This way both the current and the previous
  459. text are retained.
  460. Language Token Files (TOK)
  461. Language token files are similar to master token files; the only difference being the meaning of the status
  462. fields found in the token identifiers.
  463. Language token files are used during localization. They contain localized resource data.
  464. A token's status field is made up by combinations of four flags:
  465. * TRANSLATED 4 indicates that the token contains text that should be put in the target
  466. resource. If a token is not marked as TRANSLATED then it contains
  467. unlocalized text from the master token file which is maintained for
  468. update tracking purposes.
  469. * READONLY 2 indicates that the token should not be localized.
  470. * NEW 1 used only for tokens that are not marked with the TRANSLATED
  471. flag to indicate that this is the new version of the unlocalized token.
  472. * DIRTY 1 used only for tokens that are marked with the TRANSLATED flag to
  473. indicate that the token is in need of attention (either the original
  474. translation has changed or the token has never been localized).
  475. For example, a clean, localized token is marked only with the TRANSLATED flag and therefore has a
  476. status value of 4.
  477. As in the Master token files, non printing characters (such as new-line and control characters) are
  478. represented (and entered by the localizer) using C escape sequences. Two of the most common are \n for
  479. new-line and \t for tab. Some characters are shown or entered in the form '\nnn' where nnn is the decimal
  480. value of that character. The localizer may enter any character it's '\nnn' form.
  481. Resource Description Files (RDF)
  482. Custom resources are described in resource description files (RDFs) using c-like structure definitions.
  483. Each definition is identified with a specific resource type and the definition is applied to every resource of
  484. that given type.
  485. An identifier is declared by the following syntax:
  486. <type>
  487. Types are numbers or quoted names unless they are normal windows types in which case the standard
  488. Windows type name may be used in place of a number or name. (CURSOR, BITMAP, ICON, MENU,
  489. DIALOG, STRING, FONTDIR, FONT, ACCELERATORS, RCDATA, ERRTABLE, GROUP_CURSOR,
  490. GROUP_ICON, NAMETABLE, and VERSION).
  491. A structure definition follows normal 'C' syntax with the following limitations and differences:
  492. * Each definition must be fully enclosed in braces { }.
  493. * The standard 'C' types: char (single-byte OEM characters), int, float, long, short,
  494. unsigned, and near and far pointers are accepted. Additionaly, the types wchar (Unicode
  495. character) and tchar (Unicode in the NT version, OEM otherwise) are accepted. (Labels and macros
  496. are not legal.)
  497. * Nested structures, arrays and arrays of structures are legal. All arrays must have a fixed count except
  498. for strings which are described below. int[10] is legal int[] is not.
  499. * Null terminated strings (sz's) are the only variable length structures allowed. They are represented as
  500. an array of characters with no length: char[]
  501. * Fixed length strings are represented as arrays of characters with a fixed length: char[10]
  502. * Comments may be included in the file using standard c comment delimiters (/* */ and //) or by
  503. placing them after the pound symbol #.
  504. * Localizable types (types that need to be placed in token files) are indicated by all caps. Hence INT
  505. would generate a token while int would not.
  506. The following is a sample RDF file:
  507. # This is a sample Resource Description File
  508. <"type">
  509. {
  510. int, // no token will be generated for this integer
  511. CHAR // this single-byte character will be placed in a token
  512. }
  513. <RCDATA>
  514. {
  515. WCHAR[] // a null terminated Unicode string that requires a token
  516. wchar[] // no token will be generated for this Unicode string
  517. }
  518. <1000>
  519. {
  520. TCHAR[], // a null terminated Unicode or OEM string that requires
  521. // a token (Unicode if running NT version, else OEM).
  522. {
  523. int,
  524. FLOAT, // localizable floating point value
  525. far *,
  526. CHAR[20] // localizable 20 character single-byte string
  527. }[3], // an array of three structures (NOT IMPLEMENTED YET)
  528. int
  529. }
  530. END // Optional
  531. Throughout this document, the term localization refers to the process of preparing a product for an
  532. international market. This process involves (among other things) translating text and resizing controls
  533. such as dialogs and buttons. A person performing localization is referred to as a localizer.
  534. This document refers to a resource file as being any file that contains Windows resources. This can be a
  535. .EXE file (or a .DLL, a .CPL, etc.), as well as a .RES file. RLMan can use any of these files as resource
  536. files.
  537. The Resource Localization Manager Page 14