1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-06-08 09:31:58 +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; os << AQUARIA_CUSTOM_BUILD_ID;
#endif #endif
const char *loc = getUsedLocale();
if(*loc)
os << "; Locale=" << loc;
userAgent = os.str(); userAgent = os.str();
if(!worker) if(!worker)

View file

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

View file

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

View file

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