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