commit 27c14b6da29da3bc925d0aff1c67b68ee6b77c21
Author: Koji Yokota <[email protected]>
Date:   Tue Jul 8 23:26:01 2025 +0900

    Make theme names translatable
---
 src/frontends/qt/GuiPrefs.cpp | 8 +++++++-
 src/frontends/qt/GuiPrefs.h   | 9 +++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/frontends/qt/GuiPrefs.cpp b/src/frontends/qt/GuiPrefs.cpp
index 36786d9ba3..6a63789c07 100644
--- a/src/frontends/qt/GuiPrefs.cpp
+++ b/src/frontends/qt/GuiPrefs.cpp
@@ -1692,9 +1692,15 @@ void PrefColors::initializeThemesLW()
        const FileNameList sys_theme_files = sys_theme_dir.dirList("theme");
        const FileNameList usr_theme_files = usr_theme_dir.dirList("theme");
        for (const FileName & file : sys_theme_files) {
-               const QString guiname =
+               QString guiname =
                        
QString(file.onlyFileNameWithoutExt().c_str()).replace('_', ' ');
+               // if theme name matches the dictionary, use it for translation
+               ThemeNameDic::iterator dic_it = theme_name_dic_.find(guiname);
+               if (dic_it != theme_name_dic_.end())
+                       guiname = dic_it->second;
+
                const QString filename = file.absFileName().c_str();
+
                // four labeling chars are appended to guiname to gurantee both 
system
                // and user themes are listed even if they have the same name
                themes.emplace(guiname + "_sys", std::make_pair(filename, 
false));
diff --git a/src/frontends/qt/GuiPrefs.h b/src/frontends/qt/GuiPrefs.h
index 42e5e41d98..489e233197 100644
--- a/src/frontends/qt/GuiPrefs.h
+++ b/src/frontends/qt/GuiPrefs.h
@@ -353,6 +353,15 @@ private:
        ///
        ColorPair toqcolor(ColorNamePair);
 
+       // Dictionary of theme names for translation purpose
+       // Add a system theme name here if you create another one
+       typedef std::map<QString, QString> ThemeNameDic;
+       ThemeNameDic theme_name_dic_ = {
+           {"Default",    qt_("Default")},
+           {"Monochrome", qt_("Monochrome")},
+           {"Solarized",  qt_("Solarized")}
+       };
+
        QStringList header_labels_ =
                        {qt_("Light"), qt_("Dark"), qt_("Object/Element")};
        QString reset_label_ = qt_("Reset");
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to