diff --git a/db/Database.cpp b/db/Database.cpp index e211ea9..b0cfd30 100644 --- a/db/Database.cpp +++ b/db/Database.cpp @@ -119,9 +119,9 @@ namespace NekoRay { QString ProxyEntity::DisplayLatency() const { if (latency < 0) { - return QObject::tr("Unavailable"); + return UNICODE_LRO + QObject::tr("Unavailable"); } else if (latency > 0) { - return QString("%1 ms").arg(latency); + return UNICODE_LRO + QString("%1 ms").arg(latency); } else { return ""; } diff --git a/db/TrafficData.hpp b/db/TrafficData.hpp index acf2723..53cc29a 100644 --- a/db/TrafficData.hpp +++ b/db/TrafficData.hpp @@ -29,12 +29,12 @@ namespace NekoRay::traffic { } [[nodiscard]] QString DisplaySpeed() const { - return QString("%1↑ %2↓").arg(ReadableSize(uplink_rate), ReadableSize(downlink_rate)); + return UNICODE_LRO + QString("%1↑ %2↓").arg(ReadableSize(uplink_rate), ReadableSize(downlink_rate)); } [[nodiscard]] QString DisplayTraffic() const { if (downlink + uplink == 0) return ""; - return QString("%1↑ %2↓").arg(ReadableSize(uplink), ReadableSize(downlink)); + return UNICODE_LRO + QString("%1↑ %2↓").arg(ReadableSize(uplink), ReadableSize(downlink)); } }; } // namespace NekoRay::traffic diff --git a/main/NekoRay_Utils.hpp b/main/NekoRay_Utils.hpp index e267d8c..98f054c 100644 --- a/main/NekoRay_Utils.hpp +++ b/main/NekoRay_Utils.hpp @@ -25,6 +25,8 @@ inline std::function MW_dialog_message; // String +inline const QString UNICODE_LRO = QString::fromUtf8(QByteArray::fromHex("E280AD")); + #define Int2String(num) QString::number(num) inline QString SubStrBefore(QString str, const QString &sub) { diff --git a/main/main.cpp b/main/main.cpp index 2f34a0d..2465fa3 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -165,11 +165,14 @@ int main(int argc, char *argv[]) { locale = "zh_CN"; break; case 3: - locale = "fa_IR"; //farsi(iran) + locale = "fa_IR"; // farsi(iran) break; default: locale = QLocale().name(); } + QGuiApplication::tr("QT_LAYOUT_DIRECTION"); + QLocale::setDefault(QLocale(locale)); + // QTranslator trans; if (trans.load(":/translations/" + locale + ".qm")) { QCoreApplication::installTranslator(&trans); diff --git a/translations/fa_IR.ts b/translations/fa_IR.ts index aca2bbe..c19ee12 100644 --- a/translations/fa_IR.ts +++ b/translations/fa_IR.ts @@ -1216,6 +1216,13 @@ End: %2 + + QGuiApplication + + QT_LAYOUT_DIRECTION + RTL + + QObject @@ -1337,6 +1344,14 @@ Direct: %2 Request with proxy but no profile started. + + Enable VPN + فعال کردن vpn + + + Enable System Proxy + پروکسی سیستم را فعال کنید + Qv2ray::ui::widgets::AutoCompleteTextEdit diff --git a/translations/zh_CN.ts b/translations/zh_CN.ts index 8375fea..261081b 100644 --- a/translations/zh_CN.ts +++ b/translations/zh_CN.ts @@ -1219,6 +1219,13 @@ Split by line. 删除 %1 ? + + QGuiApplication + + QT_LAYOUT_DIRECTION + LTR + + QObject @@ -1351,6 +1358,14 @@ As of January 1, 2022, compatibility with MD5 authentication information will be Clearing servers... 正在清理服务器... + + Enable VPN + 启用 VPN + + + Enable System Proxy + 启用系统代理 + Qv2ray::ui::widgets::AutoCompleteTextEdit diff --git a/ui/widget/GroupItem.cpp b/ui/widget/GroupItem.cpp index 7242c53..8a64f8b 100644 --- a/ui/widget/GroupItem.cpp +++ b/ui/widget/GroupItem.cpp @@ -43,6 +43,7 @@ QString ParseSubInfo(const QString &info) { GroupItem::GroupItem(QWidget *parent, const QSharedPointer &ent, QListWidgetItem *item) : QWidget(parent), ui(new Ui::GroupItem) { ui->setupUi(this); + this->setLayoutDirection(Qt::LeftToRight); this->ent = ent; this->item = item; diff --git a/ui/widget/ProxyItem.cpp b/ui/widget/ProxyItem.cpp index 1fe7f86..730ae78 100644 --- a/ui/widget/ProxyItem.cpp +++ b/ui/widget/ProxyItem.cpp @@ -6,6 +6,8 @@ ProxyItem::ProxyItem(QWidget *parent, const QSharedPointer &ent, QListWidgetItem *item) : QWidget(parent), ui(new Ui::ProxyItem) { ui->setupUi(this); + this->setLayoutDirection(Qt::LeftToRight); + this->item = item; this->ent = ent; if (ent == nullptr) return; diff --git a/ui/widget/ProxyItem.ui b/ui/widget/ProxyItem.ui index ce7915e..4f51e76 100644 --- a/ui/widget/ProxyItem.ui +++ b/ui/widget/ProxyItem.ui @@ -24,6 +24,12 @@ + + + 0 + 0 + + 名称 @@ -48,6 +54,12 @@ + + + 0 + 0 + + color: rgb(102, 102, 102); @@ -58,6 +70,12 @@ + + + 0 + 0 + + 测试结果 @@ -72,6 +90,12 @@ + + + 0 + 0 + + color: rgb(251, 114, 153); @@ -82,6 +106,12 @@ + + + 0 + 0 + + 流量