Add language selection menu.

This commit is contained in:
Martín Lucas Golini
2024-02-09 23:22:09 -03:00
parent 9c2822e3d6
commit 56ca57fc04
9 changed files with 153 additions and 74 deletions
+6 -13
View File
@@ -732,17 +732,6 @@ App::~App() {
mFileSystemListener = nullptr;
}
mDirTree.reset();
#ifdef EE_DEBUG
if ( !mUISceneNode->getTranslator().isSetDefaultValues() )
return;
std::string langsPath( mConfigPath + "i18n" + FileSystem::getOSSlash() );
if ( !FileSystem::fileExists( langsPath ) && !FileSystem::makeDir( langsPath ) )
return;
std::string lang( mUISceneNode->getTranslator().getCurrentLanguage() );
IOStreamFile file( langsPath + lang + ".xml", "wb" );
mUISceneNode->getTranslator().saveToStream( file, lang );
#endif
}
void App::updateRecentFiles() {
@@ -1838,6 +1827,10 @@ const std::string& App::getThemesPath() const {
return mThemesPath;
}
const std::string& App::geti18nPath() const {
return mi18nPath;
}
std::string App::getThemePath() const {
if ( mConfig.ui.theme.empty() || "default_theme" == mConfig.ui.theme )
return getDefaultThemePath();
@@ -3562,8 +3555,8 @@ void App::init( const LogLevel& logLevel, std::string file, const Float& pidelDe
if ( !language.empty() )
mUISceneNode->getTranslator().setCurrentLanguage( language );
std::string currentLanguage( mUISceneNode->getTranslator().getCurrentLanguage() );
std::string langPath( mResPath + "i18n" + FileSystem::getOSSlash() + currentLanguage +
".xml" );
mi18nPath = mResPath + "i18n" + FileSystem::getOSSlash();
std::string langPath( mi18nPath + currentLanguage + ".xml" );
if ( currentLanguage != "en" && FileSystem::fileExists( langPath ) )
mUISceneNode->getTranslator().loadFromFile( langPath );