Skip to content

Commit

Permalink
fix compile errors, add config values for i18n #13
Browse files Browse the repository at this point in the history
  • Loading branch information
HarpyWar committed Jun 24, 2014
1 parent d4b513d commit 102e315
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions conf/bnetd.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ storage_path = "file:mode=plain;dir=${LOCALSTATEDIR}/users;clan=${LOCALSTATEDIR}
#----------------------------------------------------------------------------#

filedir = "${LOCALSTATEDIR}/files"
i18ndir = "${SYSCONFDIR}/i18n"
scriptdir = "${LOCALSTATEDIR}/lua"
reportdir = "${LOCALSTATEDIR}/reports"
chanlogdir = "${LOCALSTATEDIR}/chanlogs"
Expand Down
1 change: 1 addition & 0 deletions conf/bnetd.conf.win32
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ storage_path = file:mode=plain;dir=var\users;clan=var\clans;team=var\teams;defau
#----------------------------------------------------------------------------#

filedir = files
i18ndir = conf\i18n
scriptdir = lua
reportdir = var\reports
chanlogdir = var\chanlogs
Expand Down
2 changes: 1 addition & 1 deletion conf/bnhelp.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@
--------------------------------------------------------
/rehash <mode>
Forces the server to reload specified config. Set "all" to reload all configs.
<mode> = all | channels | realms | autoupdate | news | versioncheck | ipbans | helpfile | banners | tracker | commandgroups | aliasfile | transfile | tournament | icons | anongame | topiclist | lua
<mode> = all | i18n | channels | realms | autoupdate | news | versioncheck | ipbans | helpfile | banners | tracker | commandgroups | aliasfile | transfile | tournament | icons | anongame | topiclist | lua

%clan
--------------------------------------------------------
Expand Down
18 changes: 9 additions & 9 deletions src/bnetd/i18n.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
#include "message.h"
#include "helpfile.h"
#include "channel.h"
#include "i18n.h"
#include "prefs.h"
#include "i18n.h"
#include "common/setup_after.h"

namespace pvpgn
Expand All @@ -72,8 +72,10 @@ namespace pvpgn
}
*/
std::map<std::string, std::map<t_gamelang, std::string> > translations = std::map<std::string, std::map<t_gamelang, std::string> >();

std::vector<t_gamelang> languages{

const char * _find_string(char const * text, t_gamelang gamelang);

const t_gamelang languages[12] = {
GAMELANG_ENGLISH_UINT, /* enUS */
GAMELANG_GERMAN_UINT, /* deDE */
GAMELANG_CZECH_UINT, /* csCZ */
Expand All @@ -88,8 +90,6 @@ namespace pvpgn
GAMELANG_CHINESE_T_UINT /* zhTW */
};

const char * _find_string(char const * text, t_gamelang gamelang);


extern int i18n_reload(void)
{
Expand All @@ -108,9 +108,9 @@ namespace pvpgn
std::string original, translate;

// iterate language list
for (std::vector<t_gamelang>::iterator lang = languages.begin(); lang != languages.end(); ++lang)
for (int i = 0; i < (sizeof(languages) / sizeof(*languages)); i++)
{
lang_filename = i18n_filename(filename, *lang);
lang_filename = i18n_filename(filename, languages[i]);
if (FILE *f = fopen(lang_filename.c_str(), "r")) {
fclose(f);

Expand Down Expand Up @@ -158,10 +158,10 @@ namespace pvpgn
if (translate[0] == '\0')
{
translate = original;
WARN2("empty localization for \"%s\", use original string (%s)", original, lang_filename.c_str());
WARN2("empty localization for \"%s\", use original string (%s)", original.c_str(), lang_filename.c_str());
}
}
translations[original][*lang] = translate;
translations[original][languages[i]] = translate;
}

INFO1("localization file loaded \"%s\"", lang_filename.c_str());
Expand Down
1 change: 0 additions & 1 deletion src/bnetd/i18n.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ namespace pvpgn
namespace bnetd
{


}
}

Expand Down

2 comments on commit 102e315

@anonbyte
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is i18n ?

@HarpyWar
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.