KWWidgets
debian/tmp/usr/include/KWWidgets/vtkKWLanguage.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Module: $RCSfile: vtkKWLanguage.h,v $
4 
5  Copyright (c) Kitware, Inc.
6  All rights reserved.
7  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notice for more information.
12 
13 =========================================================================*/
14 // .NAME vtkKWLanguage - language support.
15 // .SECTION Description
16 // vtkKWLanguage provides methods to refer to common languages, as well
17 // as set the current language.
18 
19 #ifndef __vtkKWLanguage_h
20 #define __vtkKWLanguage_h
21 
22 #include "vtkObject.h"
23 #include "vtkKWWidgets.h" // Needed for export symbols directives
24 
25 class KWWidgets_EXPORT vtkKWLanguage : public vtkObject
26 {
27 public:
28  static vtkKWLanguage* New();
29  vtkTypeRevisionMacro(vtkKWLanguage,vtkObject);
30  void PrintSelf(ostream& os, vtkIndent indent);
31 
32  // Description:
33  // List of languages IDs.
34  //BTX
35  enum
36  {
37  ABKHAZIAN = 0,
265  UNKNOWN // should be the last one
266  };
267  //ETX
268 
269  // Description:
270  // Set/Get the current language. Setting the language is done by setting
271  // the LC_MESSAGES locale as well as setting the LC_MESSAGES environment
272  // variable. On Windows platform where LC_MESSAGES is not supported, a
273  // call to SetThreadLocale() will change the language accordingly.
274  static void SetCurrentLanguage(int lang);
275  static int GetCurrentLanguage();
276 
277  // Description:
278  // Get short English name of language (or NULL if unknown/error).
279  static const char* GetLanguageName(int lang);
280 
281  // Description:
282  // Get XPG syntax (language[_territory[.codeset]][@modifier]) from language.
283  // Return XPG description on success, NULL on error or if there is
284  // no known XPG syntax for this language ID.
285  static const char* GetXPGFromLanguage(int lang);
286 
287  // Description:
288  // Get language from XPG (language[_territory[.codeset]][@modifier]).
289  // Return language ID on success, vtkKWLanguage::UNKNOWN on error or if
290  // there is no known language ID for this XPG syntax.
291  static int GetLanguageFromXPG(const char *xpg);
292 
293  // Description:
294  // Get Win32 LANGID from language.
295  // Return the output of MAKELANGID using the primary and secondary
296  // language identifier corresponding to the language passed as parameter,
297  // or MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT) if no match was found.
298  // (note that MAKELANGID returns a WORD, which is cast here to an int
299  // for wrapping purposes).
300  static int GetWin32LANGIDFromLanguage(int lang);
301 
302  // Description:
303  // Get language from Win32 LANGID.
304  // Return the language id matching the Win32 primary and secondary language
305  // identifier that were output by MAKELANGID, or vtkKWLanguage::UNKNOWN on
306  // error or if there is no known language ID for this LANGID.
307  // (note that MAKELANGID returns a WORD, but it is accepted here as an int
308  // for wrapping purposes).
309  static int GetLanguageFromWin32LANGID(int win32langid);
310 
311 protected:
314 
315  // Description:
316  // Get language from XPG (language[_territory[.codeset]][@modifier]).
317  // Return language ID on success, vtkKWLanguage::UNKNOWN on error or if
318  // there is no known language ID for this XPG syntax.
319  // This is a stricter version GetLanguageFromXPG since it does not try
320  // to find the language if the territory was missing.
321  static int GetLanguageFromXPGStrict(const char *xpg);
322 
323 private:
324  vtkKWLanguage(const vtkKWLanguage&); // Not implemented
325  void operator=(const vtkKWLanguage&); // Not implemented
326 };
327 
328 #endif
329