chore: group types locale

This commit is contained in:
dongchengjie
2024-07-07 21:56:20 +08:00
parent afa3d39cb3
commit 9dde385073
10 changed files with 94 additions and 45 deletions

View File

@@ -26,7 +26,7 @@ type SearchProps = {
export const BaseSearchBox = styled((props: SearchProps) => { export const BaseSearchBox = styled((props: SearchProps) => {
const { t } = useTranslation(); const { t } = useTranslation();
const inputRef = useRef<HTMLInputElement>(null); const inputRef = useRef<HTMLInputElement>(null);
const [matchCase, setMatchCase] = useState(props.matchCase ?? true); const [matchCase, setMatchCase] = useState(props.matchCase ?? false);
const [matchWholeWord, setMatchWholeWord] = useState( const [matchWholeWord, setMatchWholeWord] = useState(
props.matchWholeWord ?? false props.matchWholeWord ?? false
); );

View File

@@ -23,6 +23,7 @@ import {
DialogActions, DialogActions,
DialogContent, DialogContent,
DialogTitle, DialogTitle,
InputAdornment,
List, List,
ListItem, ListItem,
ListItemText, ListItemText,
@@ -273,7 +274,7 @@ export const GroupsEditorViewer = (props: Props) => {
const validateGroup = () => { const validateGroup = () => {
let group = formIns.getValues(); let group = formIns.getValues();
if (group.name === "") { if (group.name === "") {
throw new Error(t("Group Name Cannot Be Empty")); throw new Error(t("Group Name Required"));
} }
}; };
@@ -342,6 +343,11 @@ export const GroupsEditorViewer = (props: Props) => {
"relay", "relay",
]} ]}
value={field.value} value={field.value}
renderOption={(props, option) => (
<li {...props} title={t(option)}>
{option}
</li>
)}
onChange={(_, value) => value && field.onChange(value)} onChange={(_, value) => value && field.onChange(value)}
renderInput={(params) => <TextField {...params} />} renderInput={(params) => <TextField {...params} />}
/> />
@@ -370,7 +376,7 @@ export const GroupsEditorViewer = (props: Props) => {
control={control} control={control}
render={({ field }) => ( render={({ field }) => (
<Item> <Item>
<ListItemText primary={t("Icon")} /> <ListItemText primary={t("Proxy Group Icon")} />
<TextField <TextField
autoComplete="new-password" autoComplete="new-password"
size="small" size="small"
@@ -418,7 +424,6 @@ export const GroupsEditorViewer = (props: Props) => {
</Item> </Item>
)} )}
/> />
<Controller <Controller
name="url" name="url"
control={control} control={control}
@@ -427,6 +432,7 @@ export const GroupsEditorViewer = (props: Props) => {
<ListItemText primary={t("Health Check Url")} /> <ListItemText primary={t("Health Check Url")} />
<TextField <TextField
autoComplete="new-password" autoComplete="new-password"
placeholder="https://www.gstatic.com/generate_204"
size="small" size="small"
sx={{ width: "calc(100% - 150px)" }} sx={{ width: "calc(100% - 150px)" }}
{...field} {...field}
@@ -434,6 +440,24 @@ export const GroupsEditorViewer = (props: Props) => {
</Item> </Item>
)} )}
/> />
<Controller
name="expected-status"
control={control}
render={({ field }) => (
<Item>
<ListItemText primary={t("Expected Status")} />
<TextField
autoComplete="new-password"
placeholder="*"
size="small"
sx={{ width: "calc(100% - 150px)" }}
onChange={(e) => {
field.onChange(parseInt(e.target.value));
}}
/>
</Item>
)}
/>
<Controller <Controller
name="interval" name="interval"
control={control} control={control}
@@ -442,12 +466,20 @@ export const GroupsEditorViewer = (props: Props) => {
<ListItemText primary={t("Interval")} /> <ListItemText primary={t("Interval")} />
<TextField <TextField
autoComplete="new-password" autoComplete="new-password"
placeholder="300"
type="number" type="number"
size="small" size="small"
sx={{ width: "calc(100% - 150px)" }} sx={{ width: "calc(100% - 150px)" }}
onChange={(e) => { onChange={(e) => {
field.onChange(parseInt(e.target.value)); field.onChange(parseInt(e.target.value));
}} }}
InputProps={{
endAdornment: (
<InputAdornment position="end">
{t("seconds")}
</InputAdornment>
),
}}
/> />
</Item> </Item>
)} )}
@@ -460,12 +492,20 @@ export const GroupsEditorViewer = (props: Props) => {
<ListItemText primary={t("Timeout")} /> <ListItemText primary={t("Timeout")} />
<TextField <TextField
autoComplete="new-password" autoComplete="new-password"
placeholder="5000"
type="number" type="number"
size="small" size="small"
sx={{ width: "calc(100% - 150px)" }} sx={{ width: "calc(100% - 150px)" }}
onChange={(e) => { onChange={(e) => {
field.onChange(parseInt(e.target.value)); field.onChange(parseInt(e.target.value));
}} }}
InputProps={{
endAdornment: (
<InputAdornment position="end">
{t("millis")}
</InputAdornment>
),
}}
/> />
</Item> </Item>
)} )}
@@ -478,6 +518,7 @@ export const GroupsEditorViewer = (props: Props) => {
<ListItemText primary={t("Max Failed Times")} /> <ListItemText primary={t("Max Failed Times")} />
<TextField <TextField
autoComplete="new-password" autoComplete="new-password"
placeholder="5"
type="number" type="number"
size="small" size="small"
sx={{ width: "calc(100% - 150px)" }} sx={{ width: "calc(100% - 150px)" }}
@@ -599,23 +640,6 @@ export const GroupsEditorViewer = (props: Props) => {
</Item> </Item>
)} )}
/> />
<Controller
name="expected-status"
control={control}
render={({ field }) => (
<Item>
<ListItemText primary={t("Expected Status")} />
<TextField
autoComplete="new-password"
size="small"
sx={{ width: "calc(100% - 150px)" }}
onChange={(e) => {
field.onChange(parseInt(e.target.value));
}}
/>
</Item>
)}
/>
<Controller <Controller
name="include-all" name="include-all"
control={control} control={control}
@@ -684,7 +708,7 @@ export const GroupsEditorViewer = (props: Props) => {
onClick={() => { onClick={() => {
try { try {
validateGroup(); validateGroup();
for (const item of prependSeq) { for (const item of [...prependSeq, ...groupList]) {
if (item.name === formIns.getValues().name) { if (item.name === formIns.getValues().name) {
throw new Error(t("Group Name Already Exists")); throw new Error(t("Group Name Already Exists"));
} }
@@ -705,7 +729,7 @@ export const GroupsEditorViewer = (props: Props) => {
onClick={() => { onClick={() => {
try { try {
validateGroup(); validateGroup();
for (const item of appendSeq) { for (const item of [...appendSeq, ...groupList]) {
if (item.name === formIns.getValues().name) { if (item.name === formIns.getValues().name) {
throw new Error(t("Group Name Already Exists")); throw new Error(t("Group Name Already Exists"));
} }
@@ -727,10 +751,7 @@ export const GroupsEditorViewer = (props: Props) => {
padding: "0 10px", padding: "0 10px",
}} }}
> >
<BaseSearchBox <BaseSearchBox onSearch={(match) => setMatch(() => match)} />
matchCase={false}
onSearch={(match) => setMatch(() => match)}
/>
<Virtuoso <Virtuoso
style={{ height: "calc(100% - 24px)", marginTop: "8px" }} style={{ height: "calc(100% - 24px)", marginTop: "8px" }}
totalCount={ totalCount={

View File

@@ -298,10 +298,7 @@ export const ProxiesEditorViewer = (props: Props) => {
padding: "0 10px", padding: "0 10px",
}} }}
> >
<BaseSearchBox <BaseSearchBox onSearch={(match) => setMatch(() => match)} />
matchCase={false}
onSearch={(match) => setMatch(() => match)}
/>
<Virtuoso <Virtuoso
style={{ height: "calc(100% - 24px)", marginTop: "8px" }} style={{ height: "calc(100% - 24px)", marginTop: "8px" }}
totalCount={ totalCount={

View File

@@ -56,6 +56,7 @@ export const ProxyItem = (props: Props) => {
sx={{ cursor: sortable ? "move" : "" }} sx={{ cursor: sortable ? "move" : "" }}
primary={ primary={
<StyledPrimary <StyledPrimary
title={proxy.name}
sx={{ textDecoration: type === "delete" ? "line-through" : "" }} sx={{ textDecoration: type === "delete" ? "line-through" : "" }}
> >
{proxy.name} {proxy.name}

View File

@@ -59,6 +59,7 @@ export const RuleItem = (props: Props) => {
sx={{ cursor: sortable ? "move" : "" }} sx={{ cursor: sortable ? "move" : "" }}
primary={ primary={
<StyledPrimary <StyledPrimary
title={ruleContent || "-"}
sx={{ textDecoration: type === "delete" ? "line-through" : "" }} sx={{ textDecoration: type === "delete" ? "line-through" : "" }}
> >
{ruleContent || "-"} {ruleContent || "-"}

View File

@@ -573,10 +573,7 @@ export const RulesEditorViewer = (props: Props) => {
padding: "0 10px", padding: "0 10px",
}} }}
> >
<BaseSearchBox <BaseSearchBox onSearch={(match) => setMatch(() => match)} />
matchCase={false}
onSearch={(match) => setMatch(() => match)}
/>
<Virtuoso <Virtuoso
style={{ height: "calc(100% - 24px)", marginTop: "8px" }} style={{ height: "calc(100% - 24px)", marginTop: "8px" }}
totalCount={ totalCount={

View File

@@ -1,5 +1,6 @@
{ {
"millis": "millis", "millis": "millis",
"seconds": "seconds",
"mins": "mins", "mins": "mins",
"Back": "Back", "Back": "Back",
"Close": "Close", "Close": "Close",
@@ -54,7 +55,7 @@
"Create Profile": "Create Profile", "Create Profile": "Create Profile",
"Edit Profile": "Edit Profile", "Edit Profile": "Edit Profile",
"Edit Proxies": "Edit Proxies", "Edit Proxies": "Edit Proxies",
"Use newlines for multiple uri": "Use newlines for multiple uri", "Use newlines for multiple uri": "Use newlines for multiple uri(Base64 encoding supported)",
"Edit Rules": "Edit Rules", "Edit Rules": "Edit Rules",
"Rule Type": "Rule Type", "Rule Type": "Rule Type",
"Rule Content": "Rule Content", "Rule Content": "Rule Content",
@@ -109,10 +110,16 @@
"PASS": "Skips this rule when matched", "PASS": "Skips this rule when matched",
"Edit Groups": "Edit Proxy Groups", "Edit Groups": "Edit Proxy Groups",
"Group Type": "Group Type", "Group Type": "Group Type",
"select": "Select proxy manually",
"url-test": "Select proxy based on URL test delay",
"fallback": "Switch to another proxy on error",
"load-balance": "Distribute proxy based on load balancing",
"relay": "Pass through the defined proxy chain",
"Group Name": "Group Name", "Group Name": "Group Name",
"Use Proxies": "Use Proxies", "Use Proxies": "Use Proxies",
"Use Provider": "Use Provider", "Use Provider": "Use Provider",
"Health Check Url": "Health Check Url", "Health Check Url": "Health Check Url",
"Expected Status": "Expected Status",
"Interval": "Interval", "Interval": "Interval",
"Lazy": "Lazy", "Lazy": "Lazy",
"Timeout": "Timeout", "Timeout": "Timeout",
@@ -124,9 +131,10 @@
"Include All Proxies": "Include All Proxies", "Include All Proxies": "Include All Proxies",
"Exclude Filter": "Exclude Filter", "Exclude Filter": "Exclude Filter",
"Exclude Type": "Exclude Type", "Exclude Type": "Exclude Type",
"Expected Status": "Expected Status",
"Disable UDP": "Disable UDP", "Disable UDP": "Disable UDP",
"Hidden": "Hidden", "Hidden": "Hidden",
"Group Name Required": "Group Name Required",
"Group Name Already Exists": "Group Name Already Exists",
"Extend Config": "Extend Config", "Extend Config": "Extend Config",
"Extend Script": "Extend Script", "Extend Script": "Extend Script",
"Global Merge": "Global Extend Config", "Global Merge": "Global Extend Config",

View File

@@ -1,5 +1,6 @@
{ {
"millis": "میلی‌ثانیه", "millis": "میلی‌ثانیه",
"seconds": "ثانیه‌ها",
"mins": "دقیقه", "mins": "دقیقه",
"Back": "بازگشت", "Back": "بازگشت",
"Close": "بستن", "Close": "بستن",
@@ -54,7 +55,7 @@
"Create Profile": "ایجاد پروفایل", "Create Profile": "ایجاد پروفایل",
"Edit Profile": "ویرایش پروفایل", "Edit Profile": "ویرایش پروفایل",
"Edit Proxies": "ویرایش پروکسی‌ها", "Edit Proxies": "ویرایش پروکسی‌ها",
"Use newlines for multiple uri": "استفاده از خطوط جدید برای چندین آدرس", "Use newlines for multiple uri": "استفاده از خطوط جدید برای چندین آدرس (پشتیبانی از رمزگذاری Base64)",
"Edit Rules": "ویرایش قوانین", "Edit Rules": "ویرایش قوانین",
"Rule Type": "نوع قانون", "Rule Type": "نوع قانون",
"Rule Content": "محتوای قانون", "Rule Content": "محتوای قانون",
@@ -107,10 +108,16 @@
"PASS": "این قانون را در صورت تطابق نادیده می‌گیرد", "PASS": "این قانون را در صورت تطابق نادیده می‌گیرد",
"Edit Groups": "ویرایش گروه‌های پروکسی", "Edit Groups": "ویرایش گروه‌های پروکسی",
"Group Type": "نوع گروه", "Group Type": "نوع گروه",
"select": "انتخاب پروکسی به صورت دستی",
"url-test": "انتخاب پروکسی بر اساس تأخیر آزمایش URL",
"fallback": "تعویض به پروکسی دیگر در صورت بروز خطا",
"load-balance": "توزیع پروکسی بر اساس توازن بار",
"relay": "عبور از زنجیره پروکسی تعریف شده",
"Group Name": "نام گروه", "Group Name": "نام گروه",
"Use Proxies": "استفاده از پروکسی‌ها", "Use Proxies": "استفاده از پروکسی‌ها",
"Use Provider": "استفاده از ارائه‌دهنده", "Use Provider": "استفاده از ارائه‌دهنده",
"Health Check Url": "آدرس بررسی سلامت", "Health Check Url": "آدرس بررسی سلامت",
"Expected Status": "وضعیت مورد انتظار",
"Interval": "فاصله زمانی", "Interval": "فاصله زمانی",
"Lazy": "تنبل", "Lazy": "تنبل",
"Timeout": "زمان قطع", "Timeout": "زمان قطع",
@@ -122,9 +129,10 @@
"Include All Proxies": "شامل همه پروکسی‌ها", "Include All Proxies": "شامل همه پروکسی‌ها",
"Exclude Filter": "فیلتر استثناء", "Exclude Filter": "فیلتر استثناء",
"Exclude Type": "نوع استثناء", "Exclude Type": "نوع استثناء",
"Expected Status": "وضعیت مورد انتظار",
"Disable UDP": "غیرفعال کردن UDP", "Disable UDP": "غیرفعال کردن UDP",
"Hidden": "مخفی", "Hidden": "مخفی",
"Group Name Required": "نام گروه مورد نیاز است",
"Group Name Already Exists": "نام گروه قبلا وجود دارد",
"Extend Config": "توسعه پیکربندی", "Extend Config": "توسعه پیکربندی",
"Extend Script": "ادغام اسکریپت", "Extend Script": "ادغام اسکریپت",
"Global Merge": "تنظیمات گسترده‌ی سراسری", "Global Merge": "تنظیمات گسترده‌ی سراسری",

View File

@@ -1,5 +1,6 @@
{ {
"millis": "миллисекунды", "millis": "миллисекунды",
"seconds": "секунды",
"mins": "минуты", "mins": "минуты",
"Back": "Назад", "Back": "Назад",
"Close": "Закрыть", "Close": "Закрыть",
@@ -54,7 +55,7 @@
"Create Profile": "Создать профиль", "Create Profile": "Создать профиль",
"Edit Profile": "Изменить профиль", "Edit Profile": "Изменить профиль",
"Edit Proxies": "Редактировать прокси", "Edit Proxies": "Редактировать прокси",
"Use newlines for multiple uri": "Используйте новые строки для нескольких URI", "Use newlines for multiple uri": "Используйте символы новой строки для нескольких URI (поддерживается кодировка Base64)",
"Edit Rules": "Редактировать правила", "Edit Rules": "Редактировать правила",
"Rule Type": "Тип правила", "Rule Type": "Тип правила",
"Rule Content": "Содержимое правила", "Rule Content": "Содержимое правила",
@@ -107,10 +108,16 @@
"PASS": "Пропускает это правило при совпадении", "PASS": "Пропускает это правило при совпадении",
"Edit Groups": "Редактировать группы прокси", "Edit Groups": "Редактировать группы прокси",
"Group Type": "Тип группы", "Group Type": "Тип группы",
"select": "Выбор прокси вручную",
"url-test": "Выбор прокси на основе задержки теста URL",
"fallback": "Переключение на другой прокси при ошибке",
"load-balance": "Распределение прокси на основе балансировки нагрузки",
"relay": "Передача через определенную цепочку прокси",
"Group Name": "Имя группы", "Group Name": "Имя группы",
"Use Proxies": "Использовать прокси", "Use Proxies": "Использовать прокси",
"Use Provider": "Использовать провайдера", "Use Provider": "Использовать провайдера",
"Health Check Url": "URL проверки здоровья", "Health Check Url": "URL проверки здоровья",
"Expected Status": "Ожидаемый статус",
"Interval": "Интервал", "Interval": "Интервал",
"Lazy": "Ленивый", "Lazy": "Ленивый",
"Timeout": "Таймаут", "Timeout": "Таймаут",
@@ -122,9 +129,10 @@
"Include All Proxies": "Включить все прокси", "Include All Proxies": "Включить все прокси",
"Exclude Filter": "Исключить фильтр", "Exclude Filter": "Исключить фильтр",
"Exclude Type": "Тип исключения", "Exclude Type": "Тип исключения",
"Expected Status": "Ожидаемый статус",
"Disable UDP": "Отключить UDP", "Disable UDP": "Отключить UDP",
"Hidden": "Скрытый", "Hidden": "Скрытый",
"Group Name Required": "Требуется имя группы",
"Group Name Already Exists": "Имя группы уже существует",
"Extend Config": "Изменить Merge.", "Extend Config": "Изменить Merge.",
"Extend Script": "Изменить Script", "Extend Script": "Изменить Script",
"Global Merge": "Глобальный расширенный Настройки", "Global Merge": "Глобальный расширенный Настройки",

View File

@@ -1,6 +1,7 @@
{ {
"millis": "毫秒", "millis": "毫秒",
"mins": "分钟", "mins": "分钟",
"seconds": "秒",
"Back": "返回", "Back": "返回",
"Close": "关闭", "Close": "关闭",
"Cancel": "取消", "Cancel": "取消",
@@ -54,7 +55,7 @@
"Create Profile": "新建配置", "Create Profile": "新建配置",
"Edit Profile": "编辑配置", "Edit Profile": "编辑配置",
"Edit Proxies": "编辑节点", "Edit Proxies": "编辑节点",
"Use newlines for multiple uri": "多条URI请使用换行分隔", "Use newlines for multiple uri": "多条URI请使用换行分隔支持Base64编码",
"Edit Rules": "编辑规则", "Edit Rules": "编辑规则",
"Rule Type": "规则类型", "Rule Type": "规则类型",
"Rule Content": "规则内容", "Rule Content": "规则内容",
@@ -109,25 +110,32 @@
"PASS": "跳过此规则", "PASS": "跳过此规则",
"Edit Groups": "编辑代理组", "Edit Groups": "编辑代理组",
"Group Type": "代理组类型", "Group Type": "代理组类型",
"select": "手动选择代理",
"url-test": "根据URL测试延迟选择代理",
"fallback": "不可用时切换到另一个代理",
"load-balance": "根据负载均衡分配代理",
"relay": "根据定义的代理链传递",
"Group Name": "代理组组名", "Group Name": "代理组组名",
"Use Proxies": "引入代理", "Use Proxies": "引入代理",
"Use Provider": "引入代理集合", "Use Provider": "引入代理集合",
"Health Check Url": "健康检查测试地址", "Health Check Url": "健康检查测试地址",
"Expected Status": "期望状态码",
"Interval": "检查间隔", "Interval": "检查间隔",
"Lazy": "懒惰状态", "Lazy": "懒惰状态",
"Timeout": "超时时间", "Timeout": "超时时间",
"Max Failed Times": "最大失败次数", "Max Failed Times": "最大失败次数",
"Interface Name": "出站接口", "Interface Name": "出站接口",
"Routing Mark": "路由标记", "Routing Mark": "路由标记",
"Include All": "引入所有出站代理以及代理集合", "Include All": "引入所有出站代理代理集合",
"Include All Providers": "引入所有代理集合", "Include All Providers": "引入所有代理集合",
"Include All Proxies": "引入所有出站代理", "Include All Proxies": "引入所有出站代理",
"Exclude Filter": "排除节点", "Exclude Filter": "排除节点",
"Exclude Type": "排除节点类型", "Exclude Type": "排除节点类型",
"Expected Status": "期望状态码",
"Disable UDP": "禁用UDP", "Disable UDP": "禁用UDP",
"Hidden": "隐藏组", "Hidden": "隐藏代理组",
"Extend Config": "扩展配置", "Extend Config": "扩展配置",
"Group Name Required": "代理组名称不能为空",
"Group Name Already Exists": "代理组名称已存在",
"Extend Script": "扩展脚本", "Extend Script": "扩展脚本",
"Global Merge": "全局扩展配置", "Global Merge": "全局扩展配置",
"Global Script": "全局扩展脚本", "Global Script": "全局扩展脚本",