1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-12-25 06:05:45 +00:00

Localise sounds, voice, and send current locale to webserver when asking for mod list

This commit is contained in:
fgenesis 2012-07-14 14:34:46 +02:00
parent b0f18e9030
commit e8872b09e5
4 changed files with 29 additions and 9 deletions

View file

@ -147,6 +147,10 @@ static void init()
os << AQUARIA_CUSTOM_BUILD_ID;
#endif
const char *loc = getUsedLocale();
if(*loc)
os << "; Locale=" << loc;
userAgent = os.str();
if(!worker)

View file

@ -32,7 +32,12 @@ void setUsedLocale(const std::string& s)
s_locale = s;
}
std::string localisePath(const std::string &path, const std::string &modpath /* = "" */)
const char *getUsedLocale()
{
return s_locale.c_str();
}
std::string localisePath(const std::string &path, const std::string& modpath /* = "" */)
{
if (s_locale.empty())
return path;

View file

@ -4,7 +4,8 @@
#include "Base.h"
void setUsedLocale(const std::string& s);
std::string localisePath(const std::string &path, const std::string &modpath = "");
const char *getUsedLocale();
std::string localisePath(const std::string &path, const std::string& modpath = "");
std::string getSystemLocale();
#endif

View file

@ -926,13 +926,17 @@ bool SoundManager::playVoice(const std::string &name, SoundVoiceType svt, float
if (!voicePath2.empty())
{
fn = core->adjustFilenameCase(voicePath2 + name + fileType);
fn = voicePath2 + name + fileType;
fn = localisePath(fn);
fn = core->adjustFilenameCase(fn);
if (exists(fn)) checkOther = false;
}
if (checkOther)
{
fn = core->adjustFilenameCase(voicePath + name + fileType);
fn = voicePath + name + fileType;
fn = localisePath(fn);
fn = core->adjustFilenameCase(fn);
if (!exists(fn))
{
debugLog("Could not find voice file [" + fn + "]");
@ -1519,20 +1523,26 @@ Buffer SoundManager::loadSoundIntoBank(const std::string &filename, const std::s
debugLog(filename);
if (slt == SFXLOAD_LOCAL && !audioPath2.empty())
{
f = core->adjustFilenameCase(audioPath2 + filename + format);
f = audioPath2 + filename + format;
f = localisePath(f);
f = core->adjustFilenameCase(f);
if (!exists(f))
{
f = core->adjustFilenameCase(path + filename + format);
f = path + filename + format;
f = localisePath(f);
f = core->adjustFilenameCase(f);
}
}
else
{
f = core->adjustFilenameCase(path + filename + format);
f = path + filename + format;
f = localisePath(f);
f = core->adjustFilenameCase(f);
}
bool loop = false;
if (f.find("loop")!=std::string::npos)
if (filename.find("loop")!=std::string::npos)
{
loop = true;
}
@ -1545,7 +1555,7 @@ Buffer SoundManager::loadSoundIntoBank(const std::string &filename, const std::s
}
else
{
debugLog("returning 0");
debugLog("returning 0");
return Buffer();
}