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