Line 1... |
Line 1... |
1 |
/* This file is part of the svarlang project and is published under the terms
|
1 |
/* This file is part of the svarlang project and is published under the terms
|
2 |
* of the MIT license.
|
2 |
* of the MIT license.
|
3 |
*
|
3 |
*
|
4 |
* Copyright (C) 2021-2022 Mateusz Viste
|
4 |
* Copyright (C) 2021-2023 Mateusz Viste
|
5 |
*
|
5 |
*
|
6 |
* Permission is hereby granted, free of charge, to any person obtaining a
|
6 |
* Permission is hereby granted, free of charge, to any person obtaining a
|
7 |
* copy of this software and associated documentation files (the "Software"),
|
7 |
* copy of this software and associated documentation files (the "Software"),
|
8 |
* to deal in the Software without restriction, including without limitation
|
8 |
* to deal in the Software without restriction, including without limitation
|
9 |
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
9 |
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
Line 23... |
Line 23... |
23 |
*/
|
23 |
*/
|
24 |
|
24 |
|
25 |
#ifndef SVARLANG_H
|
25 |
#ifndef SVARLANG_H
|
26 |
#define SVARLANG_H
|
26 |
#define SVARLANG_H
|
27 |
|
27 |
|
- |
|
28 |
/* library version */
|
- |
|
29 |
#define SVARLANGVER "20230628"
|
- |
|
30 |
|
- |
|
31 |
/* returns a pointer to a string with the SvarLANG's library version,
|
- |
|
32 |
* independently of the SVARLANGVER string above. */
|
- |
|
33 |
const char *svarlang_getver(void);
|
- |
|
34 |
|
28 |
/* loads translations for program progname, language lang, in paths.
|
35 |
/* loads translations for program progname, language lang, in paths.
|
29 |
*
|
36 |
*
|
30 |
* only the two first letters of the lang strings are meaningful and they are
|
37 |
* only the two first letters of the lang strings are meaningful and they are
|
31 |
* case insensitive.
|
38 |
* case insensitive.
|
32 |
*
|
39 |
*
|
Line 40... |
Line 47... |
40 |
* to call svarlang_strid() after a load failure, the previously loaded
|
47 |
* to call svarlang_strid() after a load failure, the previously loaded
|
41 |
* language will be used then, or the default language if no loading has been
|
48 |
* language will be used then, or the default language if no loading has been
|
42 |
* done yet. */
|
49 |
* done yet. */
|
43 |
int svarlang_load(const char *progname, const char *lang, const char *paths);
|
50 |
int svarlang_load(const char *progname, const char *lang, const char *paths);
|
44 |
|
51 |
|
- |
|
52 |
|
45 |
/* same as svarlang_load(), but relies on getenv() to pull LANG and NLSPATH.
|
53 |
/* same as svarlang_load(), but relies on getenv() to pull LANG and NLSPATH.
|
46 |
* this call should be used only by "CORE" SvarDOS programs. */
|
54 |
* this call should be used only by "CORE" SvarDOS programs. */
|
47 |
int svarlang_autoload(const char *progname);
|
55 |
int svarlang_autoload(const char *progname);
|
48 |
|
56 |
|
- |
|
57 |
|
49 |
/* Returns a pointer to the string "id". Does not require svalang_load() to be
|
58 |
/* Returns a pointer to the string "id". Does not require svalang_load() to be
|
50 |
* executed, but then it will only return the reference language strings.
|
59 |
* executed, but then it will only return the reference language strings.
|
51 |
* a string id is the concatenation of the CATS-style identifiers, for example
|
60 |
* a string id is the concatenation of the CATS-style identifiers, for example
|
52 |
* string 1,0 becomes 0x0100, string 2.10 is 0x020A, etc.
|
61 |
* string 1,0 becomes 0x0100, string 2.10 is 0x020A, etc.
|
53 |
* It NEVER returns NULL, if id not found then an empty string is returned */
|
62 |
* It NEVER returns NULL, if id not found then an empty string is returned */
|
54 |
const char *svarlang_strid(unsigned short id);
|
63 |
const char *svarlang_strid(unsigned short id);
|
55 |
|
64 |
|
- |
|
65 |
|
56 |
/* a convenience definition to fetch strings by their CATS-style pairs instead
|
66 |
/* a convenience definition to fetch strings by their CATS-style pairs instead
|
57 |
* of the 16-bit id. */
|
67 |
* of the 16-bit id. */
|
58 |
#define svarlang_str(x, y) svarlang_strid((x << 8) | y)
|
68 |
#define svarlang_str(x, y) svarlang_strid((x << 8) | y)
|
59 |
|
69 |
|
- |
|
70 |
|
60 |
#endif
|
71 |
#endif
|