Skip to content

Commit eaba2e4

Browse files
committedMar 21, 2025·
fix translate bug
1 parent 9b2a5f5 commit eaba2e4

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed
 

‎src/base/models/QvSettingsObject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ struct Qv2rayConfig_UI
5656
#else
5757
QString theme = "Fusion";
5858
#endif
59-
QString language = "en_US";
59+
QString language = "zh_CN";
6060
QList<ConnectionGroupPair> recentConnections;
6161
Qv2rayConfig_Graph graphConfig;
6262
bool quietMode = false;

‎src/components/translations/QvTranslator.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ void QvTranslator::refreshTranslations()
3333
languages.clear();
3434
for (const auto &path : searchPaths)
3535
{
36-
languages << QDir(path).entryList({ "*.qm" }, QDir::Hidden | QDir::Files);
36+
languages << QDir(path).entryList({"*.qm"}, QDir::Hidden | QDir::Files);
3737
}
3838
std::transform(languages.begin(), languages.end(), languages.begin(), [](QString &fileName)
3939
{
40-
return fileName.replace(".qm", "");
40+
return fileName.replace(".qm", "").replace("qv2ray_", "");
4141
});
4242
languages.removeDuplicates();
4343
DEBUG("Found translations: " + languages.join(" "));
@@ -47,11 +47,11 @@ bool QvTranslator::InstallTranslation(const QString &code)
4747
{
4848
for (const auto &path : searchPaths)
4949
{
50-
if (FileExistsIn(QDir(path), code + ".qm"))
50+
if (FileExistsIn(QDir(path), "qv2ray_" + code + ".qm"))
5151
{
5252
DEBUG("Found " + code + " in folder: " + path);
5353
QTranslator *translatorNew = new QTranslator();
54-
bool success = translatorNew->load(code + ".qm", path);
54+
bool success = translatorNew->load("qv2ray_" + code + ".qm", path);
5555
if (!success)
5656
{
5757
LOG("Cannot load translation: " + code);

0 commit comments

Comments
 (0)
Please sign in to comment.