Line 10... |
Line 10... |
10 |
support multiple languages. It is part of the SvarDOS project.
|
10 |
support multiple languages. It is part of the SvarDOS project.
|
11 |
|
11 |
|
12 |
Homepage: http://svardos.org/svarlang/
|
12 |
Homepage: http://svardos.org/svarlang/
|
13 |
|
13 |
|
14 |
|
14 |
|
15 |
### PREPARING TRANSLATION FILES ###
|
15 |
### PREPARING TRANSLATION FILES ###############################################
|
16 |
|
16 |
|
17 |
The translation files must be CATS-style text files in the usual format:
|
17 |
The translation files must be CATS-style text files in the usual format:
|
18 |
|
18 |
|
19 |
1.1:Hello, World!
|
19 |
1.1:Hello, World!
|
20 |
1.2:Help screen
|
20 |
1.2:Help screen
|
Line 41... |
Line 41... |
41 |
puts(svarlang_str(2, 0)); /* display the string with id 2.0 */
|
41 |
puts(svarlang_str(2, 0)); /* display the string with id 2.0 */
|
42 |
|
42 |
|
43 |
Read svarlang.h for more information about available functions.
|
43 |
Read svarlang.h for more information about available functions.
|
44 |
|
44 |
|
45 |
|
45 |
|
46 |
### ESCAPED CHARACTERS ###
|
46 |
### ESCAPED CHARACTERS ########################################################
|
47 |
|
47 |
|
48 |
Translation strings may contain some escaped characters. At this time only the
|
48 |
Translation strings may contain some escaped characters. At this time only the
|
49 |
following escaped characters are supported: \e \r \n \t and \\
|
49 |
following escaped characters are supported: \e \r \n \t and \\
|
50 |
|
50 |
|
51 |
|
51 |
|
52 |
### DIRTY STRINGS ###
|
52 |
### DIRTY STRINGS #############################################################
|
53 |
|
53 |
|
54 |
In the CATS-style source translation, lines may be prefixed with a '?' sign:
|
54 |
In the CATS-style source translation, lines may be prefixed with a '?' sign:
|
55 |
|
55 |
|
56 |
?1.1:Hello, World!
|
56 |
?1.1:Hello, World!
|
57 |
|
57 |
|
58 |
Such string is used by tlumacz like any other, but it is also reported on the
|
58 |
Such string is used by tlumacz like any other, but it is also reported on the
|
59 |
command-line with a warning about the line being "dirty" (that is, requiring
|
59 |
command-line with a warning about the line being "dirty" (that is, requiring
|
60 |
to be reviewed by a translator).
|
60 |
to be reviewed by a translator).
|
61 |
|
61 |
|
62 |
|
62 |
|
63 |
### ENVIRONMENT ###
|
63 |
### ENVIRONMENT ###############################################################
|
64 |
|
64 |
|
65 |
The program translation file should be named "PROGNAME.LNG", where PROGNAME
|
65 |
The program translation file should be named "PROGNAME.LNG", where PROGNAME
|
66 |
is the program's name. This file should be placed in a well-known location,
|
66 |
is the program's name. This file should be placed in a well-known location,
|
67 |
typically the program's own directory. An exception are SvarDOS "CORE" programs
|
67 |
typically the program's own directory. An exception are SvarDOS "CORE" programs
|
68 |
that store their translation files in a directory pointed out by %NLSPATH%.
|
68 |
that store their translation files in a directory pointed out by %NLSPATH%.
|
Line 70... |
Line 70... |
70 |
The %LANG% environment variable usually defines what language should be loaded,
|
70 |
The %LANG% environment variable usually defines what language should be loaded,
|
71 |
albeit the program can just as well provide its own controls for language
|
71 |
albeit the program can just as well provide its own controls for language
|
72 |
selection and pass this information to svarlang_load() accordingly.
|
72 |
selection and pass this information to svarlang_load() accordingly.
|
73 |
|
73 |
|
74 |
|
74 |
|
75 |
### WHY IS IT BETTER THAN CATS? ###
|
75 |
### WHY IS IT BETTER THAN CATS? ###############################################
|
76 |
|
76 |
|
77 |
The CATS library is heavier and slower, as it embeds a text-file parser.
|
77 |
The CATS library is heavier and slower, as it embeds a text-file parser.
|
78 |
Translations also take more disk space since each language is stored in a
|
78 |
Translations also take more disk space since each language is stored in a
|
79 |
separate file, leading to cluster waste. Finally, CATS requires default strings
|
79 |
separate file, leading to cluster waste. Finally, CATS requires default strings
|
80 |
to be part of the application's source code, while SvarLANG keeps all strings
|
80 |
to be part of the application's source code, while SvarLANG keeps all strings
|
Line 84... |
Line 84... |
84 |
There is also a licensing issue: CATS/Kitten libraries are published under the
|
84 |
There is also a licensing issue: CATS/Kitten libraries are published under the
|
85 |
terms of a viral, corrosive license. SvarLANG, on the other hand, is published
|
85 |
terms of a viral, corrosive license. SvarLANG, on the other hand, is published
|
86 |
under a truly free, liberal MIT license.
|
86 |
under a truly free, liberal MIT license.
|
87 |
|
87 |
|
88 |
|
88 |
|
89 |
### FILE FORMAT ###
|
89 |
### FILE FORMAT ###############################################################
|
90 |
|
90 |
|
91 |
File =
|
91 |
File =
|
92 |
magic : Char[4] := "SvL\x1a" (ie. "SvL" followed with a 0x1a char)
|
92 |
magic : Char[4] := "SvL\x1a" (ie. "SvL" followed with a 0x1a char)
|
93 |
; 0x1a is an end-of-file marker that prevents TYPE garbage
|
93 |
; 0x1a is an end-of-file marker that prevents TYPE garbage
|
94 |
num_strings : U16
|
94 |
num_strings : U16
|
Line 110... |
Line 110... |
110 |
; relative to Language.strings[0]
|
110 |
; relative to Language.strings[0]
|
111 |
|
111 |
|
112 |
StringZ = array[?] of Char ; zero-terminated string
|
112 |
StringZ = array[?] of Char ; zero-terminated string
|
113 |
|
113 |
|
114 |
|
114 |
|
- |
|
115 |
NOTE: All numeric values are stored in x86 (little endian) order.
|
- |
|
116 |
|
- |
|
117 |
|
115 |
======================================================================= EOF ===
|
118 |
####################################################################### EOF ###
|