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