mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-06-08 01:22:02 +00:00
Localise sounds, voice, and send current locale to webserver when asking for mod list
This commit is contained in:
parent
b0f18e9030
commit
e8872b09e5
4 changed files with 29 additions and 9 deletions
|
@ -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)
|
||||||
|
|
|
@ -32,7 +32,12 @@ void setUsedLocale(const std::string& s)
|
||||||
s_locale = 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())
|
if (s_locale.empty())
|
||||||
return path;
|
return path;
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
#include "Base.h"
|
#include "Base.h"
|
||||||
|
|
||||||
void setUsedLocale(const std::string& s);
|
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();
|
std::string getSystemLocale();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -1545,7 +1555,7 @@ Buffer SoundManager::loadSoundIntoBank(const std::string &filename, const std::s
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
debugLog("returning 0");
|
debugLog("returning 0");
|
||||||
return Buffer();
|
return Buffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue