mirror of
https://github.com/LorenEteval/Furious.git
synced 2026-10-05 21:37:56 +03:00
Preserve literal plugin routing labels
Signed-off-by: Loren Eteval <loren.eteval@proton.me>
This commit is contained in:
Vendored
+8
-1
@@ -1048,7 +1048,6 @@ TRANSLATION = {
|
||||
},
|
||||
"Routing": {
|
||||
"source": [
|
||||
"Furious.Plugins.Official.Xray.Plugin",
|
||||
"Furious.TrayActions.Routing"
|
||||
],
|
||||
"RU": "Маршрутизация",
|
||||
@@ -2147,5 +2146,13 @@ TRANSLATION = {
|
||||
"RU": "Управление файлами ресурсов Xray-core...",
|
||||
"ZH": "管理Xray-core资源文件...",
|
||||
"isReviewed": "True"
|
||||
},
|
||||
"Edit Routing...": {
|
||||
"source": [
|
||||
"Furious.Plugins.Official.Xray.Plugin"
|
||||
],
|
||||
"RU": "Редактировать маршрут...",
|
||||
"ZH": "编辑路由...",
|
||||
"isReviewed": "True"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ class PluginRouting:
|
||||
id: str
|
||||
displayName: str
|
||||
separatorBefore: bool = False
|
||||
translatable: bool = False
|
||||
|
||||
|
||||
class FuriousPlugin:
|
||||
|
||||
@@ -83,7 +83,8 @@ class Hysteria1Plugin(FuriousPlugin):
|
||||
def routingOptions(self, config=None):
|
||||
"""Return the routing modes supported by Hysteria 1."""
|
||||
return tuple(
|
||||
PluginRouting(routing.value, routing.value) for routing in AppBuiltinRouting
|
||||
PluginRouting(routing.value, routing.value, translatable=True)
|
||||
for routing in AppBuiltinRouting
|
||||
)
|
||||
|
||||
def startCore(
|
||||
|
||||
@@ -161,7 +161,7 @@ class XrayPlugin(FuriousPlugin):
|
||||
def createManagementActions(self, parent=None, **kwargs):
|
||||
"""Create Xray routing and asset-management actions."""
|
||||
# These modules require a fully initialized Furious.Qt package.
|
||||
from Furious.Qt import AppQAction, AppQSeperator
|
||||
from Furious.Qt import AppQAction, AppQSeperator, bootstrapIcon
|
||||
from Furious.Qt import gettext as _
|
||||
|
||||
from .UserRoutingWindow import UserRoutingWindow
|
||||
@@ -172,7 +172,8 @@ class XrayPlugin(FuriousPlugin):
|
||||
|
||||
return (
|
||||
AppQAction(
|
||||
_('Routing'),
|
||||
_('Edit Routing...'),
|
||||
icon=bootstrapIcon('signpost.svg'),
|
||||
callback=routingEditor.show,
|
||||
),
|
||||
AppQSeperator(),
|
||||
@@ -188,14 +189,17 @@ class XrayPlugin(FuriousPlugin):
|
||||
PluginRouting(
|
||||
AppBuiltinRouting.BypassMainlandChina.value,
|
||||
AppBuiltinRouting.BypassMainlandChina.value,
|
||||
translatable=True,
|
||||
),
|
||||
PluginRouting(
|
||||
AppBuiltinRouting.Global.value,
|
||||
AppBuiltinRouting.Global.value,
|
||||
translatable=True,
|
||||
),
|
||||
PluginRouting(
|
||||
AppBuiltinRouting.Custom.value,
|
||||
AppBuiltinRouting.Custom.value,
|
||||
translatable=True,
|
||||
),
|
||||
]
|
||||
enabledProfiles = tuple(
|
||||
|
||||
@@ -228,6 +228,10 @@ class PluginRegistry:
|
||||
raise TypeError(
|
||||
'plugin routing option display name must be a string'
|
||||
)
|
||||
if not isinstance(option.translatable, bool):
|
||||
raise TypeError(
|
||||
'plugin routing option translatable flag must be a boolean'
|
||||
)
|
||||
|
||||
optionId = option.id
|
||||
if optionId in optionIds:
|
||||
|
||||
@@ -92,7 +92,11 @@ class RoutingAction(AppQAction):
|
||||
|
||||
actions.append(
|
||||
RoutingChildAction(
|
||||
_(option.displayName),
|
||||
(
|
||||
_(option.displayName)
|
||||
if option.translatable
|
||||
else option.displayName
|
||||
),
|
||||
routingValue=option.id,
|
||||
checkable=True,
|
||||
checked=routing == option.id,
|
||||
|
||||
Reference in New Issue
Block a user