Subversion Repositories SvarDOS

Rev

Rev 1297 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1297 Rev 1367
Line 33... Line 33...
33
 
33
 
34
 * OUT.LNG   - the binary file that contains all translations
34
 * OUT.LNG   - the binary file that contains all translations
35
 * DEFLANG.C - the default translations that will be embedded into the program
35
 * DEFLANG.C - the default translations that will be embedded into the program
36
 
36
 
37
Then, DEFLANG.C must be compiled and linked to your program along with
37
Then, DEFLANG.C must be compiled and linked to your program along with
38
SVARLNGx.LIB. From there you will be able to use SvarLANG calls, typically:
38
SVARLNGx.LIB. From there you will be able to use SvarLANG calls, like this
-
 
39
very basic example:
39
 
40
 
40
  svarlang_load("myprogram.lng", "pl");  /* load PL lang from myprogram.lng */
41
  svarlang_load("myprogram.lng", "pl");  /* load PL lang from myprogram.lng */
41
  puts(svarlang_str(2, 0));              /* display the string with id 2.0 */
42
  puts(svarlang_str(2, 0));              /* display the string with id 2.0 */
42
 
43
 
-
 
44
A more practical, real-world example would probably be this one:
-
 
45
 
-
 
46
  svarlang_autoload_exepath(argv[0], getenv("LANG"));
-
 
47
  puts(svarlang_str(2, 0));
-
 
48
 
43
Read svarlang.h for more information about available functions.
49
Read svarlang.h for more information about available functions.
44
 
50
 
45
 
51
 
46
### ESCAPED CHARACTERS ########################################################
52
### ESCAPED CHARACTERS ########################################################
47
 
53
 
Line 62... Line 68...
62
 
68
 
63
### ENVIRONMENT ###############################################################
69
### ENVIRONMENT ###############################################################
64
 
70
 
65
The program translation file should be named "PROGNAME.LNG", where PROGNAME
71
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,
72
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
73
typically the program's own directory.
68
that store their translation files in a directory pointed out by %NLSPATH%.
-
 
69
 
74
 
70
The %LANG% environment variable usually defines what language should be loaded,
75
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
76
albeit the program can just as well provide its own controls for language
72
selection and pass this information to svarlang_load() accordingly.
77
selection and pass this information to svarlang_load() accordingly.
73
 
78