mirror of https://github.com/axmolengine/axmol.git
Merge pull request #15190 from FrostPolaris/v3_localizeManage
Add localization arguments in simulator start args. It's OK, merged
This commit is contained in:
commit
f2c999441a
|
@ -415,6 +415,12 @@ void ProjectConfig::parseCommandLine(const vector<string> &args)
|
||||||
vector<string> pathes = split((*it), ';');
|
vector<string> pathes = split((*it), ';');
|
||||||
setFirstSearchPath(pathes);
|
setFirstSearchPath(pathes);
|
||||||
}
|
}
|
||||||
|
else if (arg.compare("-language-data-path") == 0)
|
||||||
|
{
|
||||||
|
++it;
|
||||||
|
if (it == args.end()) break;
|
||||||
|
setLanguageDataPath(*it);
|
||||||
|
}
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -646,6 +652,25 @@ const vector<string> &ProjectConfig::getFirstSearchPath() const
|
||||||
return _firstSearchPath;
|
return _firstSearchPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ProjectConfig::setLanguageDataPath(const std::string &filePath)
|
||||||
|
{
|
||||||
|
bool isBinary = true;
|
||||||
|
string jsonExtension = ".json";
|
||||||
|
int exLength = jsonExtension.length();
|
||||||
|
if (filePath.length() >= exLength &&
|
||||||
|
(0 == filePath.compare(filePath.length() - exLength, exLength, jsonExtension)))
|
||||||
|
{
|
||||||
|
isBinary = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
cocostudio::ILocalizationManager* lm;
|
||||||
|
if (isBinary)
|
||||||
|
lm = cocostudio::BinLocalizationManager::getInstance();
|
||||||
|
else
|
||||||
|
lm = cocostudio::JsonLocalizationManager::getInstance();
|
||||||
|
lm->initLanguageData(filePath);
|
||||||
|
cocostudio::LocalizationHelper::setCurrentManager(lm, isBinary);
|
||||||
|
}
|
||||||
|
|
||||||
bool ProjectConfig::isAppMenu() const
|
bool ProjectConfig::isAppMenu() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -107,6 +107,7 @@ public:
|
||||||
const vector<string> &getSearchPath() const;
|
const vector<string> &getSearchPath() const;
|
||||||
void setFirstSearchPath(const vector<string> &args);
|
void setFirstSearchPath(const vector<string> &args);
|
||||||
const vector<string> &getFirstSearchPath() const;
|
const vector<string> &getFirstSearchPath() const;
|
||||||
|
void setLanguageDataPath(const std::string &filePath);
|
||||||
|
|
||||||
bool isAppMenu() const;
|
bool isAppMenu() const;
|
||||||
bool isResizeWindow() const;
|
bool isResizeWindow() const;
|
||||||
|
@ -137,6 +138,7 @@ private:
|
||||||
string _bindAddress;
|
string _bindAddress;
|
||||||
vector<string> _searchPath;
|
vector<string> _searchPath;
|
||||||
vector<string> _firstSearchPath;
|
vector<string> _firstSearchPath;
|
||||||
|
string _languageDataPath;
|
||||||
|
|
||||||
void normalize();
|
void normalize();
|
||||||
string replaceProjectDirToMacro(const string &path) const;
|
string replaceProjectDirToMacro(const string &path) const;
|
||||||
|
|
Loading…
Reference in New Issue