]> icculus.org git repositories - taylor/freespace2.git/blob - include/localize.h
Initial revision
[taylor/freespace2.git] / include / localize.h
1 /*
2  * $Logfile: /Freespace2/code/Localization/localize.h $
3  * $Revision$
4  * $Date$
5  * $Author$
6  *
7  *
8  * $Log$
9  * Revision 1.1  2002/05/03 03:28:12  root
10  * Initial revision
11  *
12  * 
13  * 18    11/02/99 3:24p Jefff
14  * added translation functions for a few key instances where english was
15  * showing up
16  * 
17  * 17    10/25/99 5:46p Jefff
18  * Many localization fixes/changes for German builds
19  * 
20  * 16    10/14/99 2:52p Jefff
21  * localization fixes.  added support for hi-res specific xstr offsets
22  * 
23  * 15    7/13/99 6:07p Jefff
24  * Added support for localization string offsets.
25  * 
26  * 14    5/26/99 11:46a Dave
27  * Added ship-blasting lighting and made the randomization of lighting
28  * much more customizable.
29  * 
30  * 13    2/23/99 11:18a Andsager
31  * Localize launcher using strings.tbl
32  * 
33  * 12    2/22/99 9:35p Andsager
34  * Add lcl_get_language_name() returns string with current lang.  Added
35  * localization for launcher.
36  * 
37  * 11    12/01/98 4:46p Dave
38  * Put in targa bitmap support (16 bit).
39  *  
40  * $NoKeywords: $
41  */
42
43
44 #ifndef __FREESPACE2_LOCALIZATION_UTILITIES_HEADER_FILE
45 #define __FREESPACE2_LOCALIZATION_UTILITIES_HEADER_FILE
46
47 // ------------------------------------------------------------------------------------------------------------
48 // LOCALIZE DEFINES/VARS
49 //
50
51 // language defines
52 #define LCL_NUM_LANGUAGES                               3                                                       // keep this up to date
53 #define LCL_ENGLISH                                             0
54 #define LCL_GERMAN                                              1
55 #define LCL_FRENCH                                              2
56
57 #define LCL_DEFAULT_LANGUAGE                    LCL_ENGLISH
58
59 // following is the offset where special characters start in our font
60 extern int Lcl_special_chars;
61
62 // for language name strings
63 #define LCL_LANG_NAME_LEN                               32
64
65 // use these to replace *_BUILD values
66 // only 1 will be active at a time
67 extern int Lcl_fr;
68 extern int Lcl_gr;
69 extern int Lcl_english;
70
71
72 // ------------------------------------------------------------------------------------------------------------
73 // LOCALIZE FUNCTIONS
74 //
75
76 // initialize localization, if no language is passed - use the language specified in the registry
77 void lcl_init(int lang = -1);
78
79 // shutdown localization
80 void lcl_close();
81
82 // initialize the xstr table
83 void lcl_xstr_init();
84
85 // free the xstr table
86 void lcl_xstr_close();
87
88 // determine what language we're running in, see LCL_* defines above
89 int lcl_get_language();
90
91 // returns the current language character string
92 void lcl_get_language_name(char *lang_name);
93
94 // set our current language
95 void lcl_set_language(int lang);
96
97
98 // NOTE : generally you should only care about the above functions. Below are very low level functions
99 //        which should already be well entrenched in Freespace. If you think you need to use one of the below
100 //        functions - ask first :)
101 // externalization of table/mission files (only parse routines ever need to deal with these functions) ----------------------- 
102
103 // maybe add on an appropriate subdirectory when opening a localized file
104 void lcl_add_dir(char *current_path);
105
106 // maybe add localized directory to full path with file name when opening a localized file
107 void lcl_add_dir_to_path_with_filename(char *current_path);
108
109 // open the externalization file for use during parsing (call before parsing a given file)
110 void lcl_ext_open();
111
112 // close the externalization file (call after parsing a given file)
113 void lcl_ext_close();
114
115 // get the localized version of the string. if none exists, return the original string
116 // valid input to this function includes :
117 // "this is some text"
118 // XSTR("wheeee", -1)
119 // XSTR("whee", 20)
120 // and these should cover all the externalized string cases
121 // fills in id if non-NULL. a value of -2 indicates it is not an external string
122 void lcl_ext_localize(char *in, char *out, int max_len, int *id = NULL);
123
124 // translate the specified string based upon the current language
125 char *XSTR(char *str, int index);
126 int lcl_get_xstr_offset(int index, int res);
127
128 // translate umlauted chars from ascii to ansi codes
129 // used in launcher
130 #define LCL_TO_ANSI     0
131 #define LCL_TO_ASCII    1
132 char* lcl_fix_umlauts(char *str, int which_way);
133
134 // macro for launcher xstrs
135 #if defined(GERMAN_BUILD)
136 #define LXSTR(str, i)           (lcl_fix_umlauts(XSTR(str, i), LCL_TO_ANSI))
137 #else
138 #define LXSTR(str, i)           (XSTR(str, i))
139 #endif  // defined(GERMAN_BUILD)
140
141 void lcl_translate_wep_name(char *name);
142 void lcl_translate_ship_name(char *name);
143 void lcl_translate_brief_icon_name(char *name);
144 void lcl_translate_targetbox_name(char *name);
145
146 #endif  // defined __FREESPACE2_LOCALIZATION_UTILITIES_HEADER_FILE
147