Adonthell
0.4
|
00001 /* 00002 $Id: nls.h,v 1.2 2002/04/13 14:51:20 ksterker Exp $ 00003 00004 Copyright (C) 2002 Kai Sterker <kaisterker@linuxgames.com> 00005 Part of the Adonthell Project http://adonthell.linuxgames.com 00006 00007 This program is free software; you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License. 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY. 00011 00012 See the COPYING file for more details. 00013 */ 00014 00015 /** 00016 * @file nls.h 00017 * 00018 * @author Kai Sterker 00019 * @brief National Language Support 00020 */ 00021 00022 #ifndef __NLS_H__ 00023 #define __NLS_H__ 00024 00025 #include "prefs.h" 00026 00027 #ifndef SWIG 00028 using std::string; 00029 #endif 00030 00031 /** 00032 * Provides various services for i18n and l10n. 00033 */ 00034 class nls 00035 { 00036 public: 00037 /** 00038 * Initialize national language support. 00039 * @param myconfig The Engine's configuration 00040 */ 00041 static void init (config &myconfig); 00042 00043 /** 00044 * Set or change the language to use. Setting the language will 00045 * never fail, but only if there is a binary message catalogue 00046 * in <gamedir>/po/<country code>LC_MESSAGES/ named <gamename>.mo 00047 * the desired language will be actually used. 00048 * @param language The country code of the desired language. 00049 */ 00050 static void set_language (const string &language); 00051 00052 /** 00053 * Translate the given string if it's found in the message 00054 * catalogue. This is just a wrapper around the GNU gettext 00055 * function for older versions of Python. 00056 * @param text The text to translate 00057 * @return either the translated text, or the given text if 00058 * no translation was found. 00059 */ 00060 static const char* translate (const string &text); 00061 }; 00062 00063 #endif // __NLS_H__