| 1 | /* |
| 2 | * Copyright (C) 2014 HarpyWar ([email protected]) |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * as published by the Free Software Foundation; either version 2 |
| 7 | * of the License, or (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 17 | */ |
| 18 | #ifndef INCLUDED_LOCALIZATION_TYPES |
| 19 | #define INCLUDED_LOCALIZATION_TYPES |
| 20 | |
| 21 | namespace pvpgn |
| 22 | { |
| 23 | namespace bnetd |
| 24 | { |
| 25 | |
| 26 | typedef struct { |
| 27 | t_gamelang gamelang; |
| 28 | const char* name; |
| 29 | std::vector<std::string> countries; |
| 30 | } t_language; |
| 31 | |
| 32 | extern std::vector<t_language> languages; |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | #endif |
| 37 | |
| 38 | #ifndef JUST_NEED_TYPES |
| 39 | #ifndef INCLUDED_LOCALIZATION_PROTOS |
| 40 | #define INCLUDED_LOCALIZATION_PROTOS |
| 41 | |
| 42 | #define JUST_NEED_TYPES |
| 43 | # include <string> |
| 44 | # include "connection.h" |
| 45 | # include "common/format.h" |
| 46 | #undef JUST_NEED_TYPES |
| 47 | |
| 48 | namespace pvpgn |
| 49 | { |
| 50 | |
| 51 | namespace bnetd |
| 52 | { |
| 53 | extern int i18n_load(void); |
| 54 | extern int i18n_reload(void); |
| 55 | |
| 56 | extern std::string i18n_filename(const char * filename, t_tag gamelang); |
| 57 | extern t_language language_find_by_country(const char * code, bool &found); |
| 58 | extern t_language language_find_by_tag(t_gamelang gamelang, bool &found); |
| 59 | extern t_language language_get_by_country(const char * code); |
| 60 | extern t_gamelang gamelang_get_by_country(const char * code); |
| 61 | extern t_language language_get_by_tag(t_gamelang gamelang); |
| 62 | |
| 63 | extern t_gamelang conn_get_gamelang_localized(t_connection * c); |
| 64 | |
| 65 | extern int handle_language_command(t_connection * c, char const *text); |
| 66 | extern char * i18n_convert(t_connection * c, char * buf); |
| 67 | extern int tag_check_gamelang_real(t_tag gamelang); |
| 68 | |
| 69 | |
| 70 | extern std::string _localize(t_connection * c, const char * func, const char *fmt, const fmt::ArgList &args); |
| 71 | FMT_VARIADIC(std::string, _localize, t_connection *, const char *, const char *) |
| 72 | |
| 73 | #define localize(c, ...) _localize(c, __FUNCTION__, __VA_ARGS__) |
| 74 | } |
| 75 | |
| 76 | } |
| 77 | |
| 78 | /*****/ |
| 79 | #endif |
| 80 | #endif |