2 * $Logfile: /Freespace2/code/Localization/localize.h $
9 * Revision 1.1 2002/05/03 03:28:12 root
13 * 18 11/02/99 3:24p Jefff
14 * added translation functions for a few key instances where english was
17 * 17 10/25/99 5:46p Jefff
18 * Many localization fixes/changes for German builds
20 * 16 10/14/99 2:52p Jefff
21 * localization fixes. added support for hi-res specific xstr offsets
23 * 15 7/13/99 6:07p Jefff
24 * Added support for localization string offsets.
26 * 14 5/26/99 11:46a Dave
27 * Added ship-blasting lighting and made the randomization of lighting
28 * much more customizable.
30 * 13 2/23/99 11:18a Andsager
31 * Localize launcher using strings.tbl
33 * 12 2/22/99 9:35p Andsager
34 * Add lcl_get_language_name() returns string with current lang. Added
35 * localization for launcher.
37 * 11 12/01/98 4:46p Dave
38 * Put in targa bitmap support (16 bit).
44 #ifndef __FREESPACE2_LOCALIZATION_UTILITIES_HEADER_FILE
45 #define __FREESPACE2_LOCALIZATION_UTILITIES_HEADER_FILE
47 // ------------------------------------------------------------------------------------------------------------
48 // LOCALIZE DEFINES/VARS
52 #define LCL_NUM_LANGUAGES 3 // keep this up to date
57 #define LCL_DEFAULT_LANGUAGE LCL_ENGLISH
59 // following is the offset where special characters start in our font
60 extern int Lcl_special_chars;
62 // for language name strings
63 #define LCL_LANG_NAME_LEN 32
65 // use these to replace *_BUILD values
66 // only 1 will be active at a time
69 extern int Lcl_english;
72 // ------------------------------------------------------------------------------------------------------------
76 // initialize localization, if no language is passed - use the language specified in the registry
77 void lcl_init(int lang = -1);
79 // shutdown localization
82 // initialize the xstr table
85 // free the xstr table
86 void lcl_xstr_close();
88 // determine what language we're running in, see LCL_* defines above
89 int lcl_get_language();
91 // returns the current language character string
92 void lcl_get_language_name(char *lang_name);
94 // set our current language
95 void lcl_set_language(int lang);
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) -----------------------
103 // maybe add on an appropriate subdirectory when opening a localized file
104 void lcl_add_dir(char *current_path);
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);
109 // open the externalization file for use during parsing (call before parsing a given file)
112 // close the externalization file (call after parsing a given file)
113 void lcl_ext_close();
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)
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);
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);
128 // translate umlauted chars from ascii to ansi codes
130 #define LCL_TO_ANSI 0
131 #define LCL_TO_ASCII 1
132 char* lcl_fix_umlauts(char *str, int which_way);
134 // macro for launcher xstrs
135 #if defined(GERMAN_BUILD)
136 #define LXSTR(str, i) (lcl_fix_umlauts(XSTR(str, i), LCL_TO_ANSI))
138 #define LXSTR(str, i) (XSTR(str, i))
139 #endif // defined(GERMAN_BUILD)
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);
146 #endif // defined __FREESPACE2_LOCALIZATION_UTILITIES_HEADER_FILE