mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-11-16 23:04:24 +08:00
feat(i18n): add Russian UI and harden localization
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { locales } from '@/i18n/config';
|
||||
import type { EdgeChange, Node, NodeChange } from '@xyflow/react';
|
||||
import type { WAFRuleGraph, WAFRuleNode } from '@/lib/services/openflare';
|
||||
|
||||
@@ -140,7 +141,7 @@ function findMessageId(
|
||||
return [...ids]
|
||||
.sort((a, b) => b.length - a.length)
|
||||
.find((id) =>
|
||||
(['en', 'zh-CN'] as const).some((locale) => {
|
||||
locales.some((locale) => {
|
||||
const t = getRuntimeTranslator(locale);
|
||||
const token = `${escapeRegExp(t(tokenKey))}(?:\\s+ID)?`;
|
||||
const pattern = t
|
||||
|
||||
@@ -14,9 +14,24 @@ export const UA_BROWSER_OPTIONS = [
|
||||
},
|
||||
{ value: 'Postman', label: 'Postman' },
|
||||
{ value: 'CLI', label: 'CLI' },
|
||||
{ value: 'Bot', label: 'Bot' },
|
||||
{ value: 'Unknown', label: 'Unknown' },
|
||||
{ value: 'Other', label: 'Other' },
|
||||
{
|
||||
value: 'Bot',
|
||||
get label() {
|
||||
return runtimeText('ui_botLabel');
|
||||
},
|
||||
},
|
||||
{
|
||||
value: 'Unknown',
|
||||
get label() {
|
||||
return runtimeText('ui_unknownLabel');
|
||||
},
|
||||
},
|
||||
{
|
||||
value: 'Other',
|
||||
get label() {
|
||||
return runtimeText('ui_otherLabel');
|
||||
},
|
||||
},
|
||||
] as const;
|
||||
|
||||
export const UA_OS_OPTIONS = [
|
||||
@@ -26,9 +41,24 @@ export const UA_OS_OPTIONS = [
|
||||
{ value: 'macOS', label: 'macOS' },
|
||||
{ value: 'Chrome OS', label: 'Chrome OS' },
|
||||
{ value: 'Linux', label: 'Linux' },
|
||||
{ value: 'Bot', label: 'Bot' },
|
||||
{ value: 'Unknown', label: 'Unknown' },
|
||||
{ value: 'Other', label: 'Other' },
|
||||
{
|
||||
value: 'Bot',
|
||||
get label() {
|
||||
return runtimeText('ui_botLabel');
|
||||
},
|
||||
},
|
||||
{
|
||||
value: 'Unknown',
|
||||
get label() {
|
||||
return runtimeText('ui_unknownLabel');
|
||||
},
|
||||
},
|
||||
{
|
||||
value: 'Other',
|
||||
get label() {
|
||||
return runtimeText('ui_otherLabel');
|
||||
},
|
||||
},
|
||||
] as const;
|
||||
|
||||
export const UA_BROWSER_LABELS = new Set<string>(
|
||||
|
||||
Reference in New Issue
Block a user