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), ';');
|
||||
setFirstSearchPath(pathes);
|
||||
}
|
||||
else if (arg.compare("-language-data-path") == 0)
|
||||
{
|
||||
++it;
|
||||
if (it == args.end()) break;
|
||||
setLanguageDataPath(*it);
|
||||
}
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
@ -646,6 +652,25 @@ const vector<string> &ProjectConfig::getFirstSearchPath() const
|
|||
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
|
||||
{
|
||||
|
|
|
@ -107,6 +107,7 @@ public:
|
|||
const vector<string> &getSearchPath() const;
|
||||
void setFirstSearchPath(const vector<string> &args);
|
||||
const vector<string> &getFirstSearchPath() const;
|
||||
void setLanguageDataPath(const std::string &filePath);
|
||||
|
||||
bool isAppMenu() const;
|
||||
bool isResizeWindow() const;
|
||||
|
@ -137,6 +138,7 @@ private:
|
|||
string _bindAddress;
|
||||
vector<string> _searchPath;
|
||||
vector<string> _firstSearchPath;
|
||||
string _languageDataPath;
|
||||
|
||||
void normalize();
|
||||
string replaceProjectDirToMacro(const string &path) const;
|
||||
|
|
Loading…
Reference in New Issue