Change translation keys

This commit is contained in:
problematicconsumer
2024-03-08 17:24:43 +03:30
parent 7f0397a97f
commit 4118863a20
20 changed files with 1004 additions and 1005 deletions

View File

@@ -35,7 +35,7 @@ class AdaptiveRootScaffold extends HookConsumerWidget {
),
NavigationDestination(
icon: const Icon(FluentIcons.box_edit_20_filled),
label: t.settings.config.pageTitle,
label: t.config.pageTitle,
),
NavigationDestination(
icon: const Icon(FluentIcons.settings_20_filled),

View File

@@ -25,7 +25,7 @@ sealed class ConfigOptionFailure with _$ConfigOptionFailure, Failure {
message: null,
),
MissingWarpConfigFailure() => (
type: t.settings.config.missingWarpConfig,
type: t.config.missingWarpConfig,
message: null,
),
};

View File

@@ -76,7 +76,7 @@ class ConfigOptionsPage extends HookConsumerWidget {
shrinkWrap: true,
slivers: [
NestedAppBar(
title: Text(t.settings.config.pageTitle),
title: Text(t.config.pageTitle),
actions: [
PopupMenuButton(
icon: Icon(AdaptiveIcon(context).more),
@@ -129,7 +129,7 @@ class ConfigOptionsPage extends HookConsumerWidget {
child: Text(t.settings.importOptions),
),
PopupMenuItem(
child: Text(t.settings.config.resetBtn),
child: Text(t.config.resetBtn),
onTap: () async {
await ref
.read(configOptionNotifierProvider.notifier)
@@ -150,19 +150,19 @@ class ConfigOptionsPage extends HookConsumerWidget {
selected: ref.watch(ConfigOptions.logLevel),
preferences: ref.watch(ConfigOptions.logLevel.notifier),
choices: LogLevel.choices,
title: t.settings.config.logLevel,
title: t.config.logLevel,
presentChoice: (value) => value.name.toUpperCase(),
),
const SettingsDivider(),
SettingsSection(t.settings.config.section.route),
SettingsSection(t.config.section.route),
SwitchListTile(
title: Text(experimental(t.settings.config.bypassLan)),
title: Text(experimental(t.config.bypassLan)),
value: ref.watch(ConfigOptions.bypassLan),
onChanged:
ref.watch(ConfigOptions.bypassLan.notifier).update,
),
SwitchListTile(
title: Text(t.settings.config.resolveDestination),
title: Text(t.config.resolveDestination),
value: ref.watch(ConfigOptions.resolveDestination),
onChanged: ref
.watch(ConfigOptions.resolveDestination.notifier)
@@ -172,50 +172,50 @@ class ConfigOptionsPage extends HookConsumerWidget {
selected: ref.watch(ConfigOptions.ipv6Mode),
preferences: ref.watch(ConfigOptions.ipv6Mode.notifier),
choices: IPv6Mode.values,
title: t.settings.config.ipv6Mode,
title: t.config.ipv6Mode,
presentChoice: (value) => value.present(t),
),
const SettingsDivider(),
SettingsSection(t.settings.config.section.dns),
SettingsSection(t.config.section.dns),
ValuePreferenceWidget(
value: ref.watch(ConfigOptions.remoteDnsAddress),
preferences:
ref.watch(ConfigOptions.remoteDnsAddress.notifier),
title: t.settings.config.remoteDnsAddress,
title: t.config.remoteDnsAddress,
),
ChoicePreferenceWidget(
selected: ref.watch(ConfigOptions.remoteDnsDomainStrategy),
preferences: ref
.watch(ConfigOptions.remoteDnsDomainStrategy.notifier),
choices: DomainStrategy.values,
title: t.settings.config.remoteDnsDomainStrategy,
title: t.config.remoteDnsDomainStrategy,
presentChoice: (value) => value.displayName,
),
ValuePreferenceWidget(
value: ref.watch(ConfigOptions.directDnsAddress),
preferences:
ref.watch(ConfigOptions.directDnsAddress.notifier),
title: t.settings.config.directDnsAddress,
title: t.config.directDnsAddress,
),
ChoicePreferenceWidget(
selected: ref.watch(ConfigOptions.directDnsDomainStrategy),
preferences: ref
.watch(ConfigOptions.directDnsDomainStrategy.notifier),
choices: DomainStrategy.values,
title: t.settings.config.directDnsDomainStrategy,
title: t.config.directDnsDomainStrategy,
presentChoice: (value) => value.displayName,
),
SwitchListTile(
title: Text(t.settings.config.enableDnsRouting),
title: Text(t.config.enableDnsRouting),
value: ref.watch(ConfigOptions.enableDnsRouting),
onChanged: ref
.watch(ConfigOptions.enableDnsRouting.notifier)
.update,
),
const SettingsDivider(),
SettingsSection(experimental(t.settings.config.section.mux)),
SettingsSection(experimental(t.config.section.mux)),
SwitchListTile(
title: Text(t.settings.config.enableMux),
title: Text(t.config.enableMux),
value: ref.watch(ConfigOptions.enableMux),
onChanged:
ref.watch(ConfigOptions.enableMux.notifier).update,
@@ -224,28 +224,28 @@ class ConfigOptionsPage extends HookConsumerWidget {
selected: ref.watch(ConfigOptions.muxProtocol),
preferences: ref.watch(ConfigOptions.muxProtocol.notifier),
choices: MuxProtocol.values,
title: t.settings.config.muxProtocol,
title: t.config.muxProtocol,
presentChoice: (value) => value.name,
),
ValuePreferenceWidget(
value: ref.watch(ConfigOptions.muxMaxStreams),
preferences:
ref.watch(ConfigOptions.muxMaxStreams.notifier),
title: t.settings.config.muxMaxStreams,
title: t.config.muxMaxStreams,
inputToValue: int.tryParse,
digitsOnly: true,
),
const SettingsDivider(),
SettingsSection(t.settings.config.section.inbound),
SettingsSection(t.config.section.inbound),
ChoicePreferenceWidget(
selected: ref.watch(ConfigOptions.serviceMode),
preferences: ref.watch(ConfigOptions.serviceMode.notifier),
choices: ServiceMode.choices,
title: t.settings.config.serviceMode,
title: t.config.serviceMode,
presentChoice: (value) => value.present(t),
),
SwitchListTile(
title: Text(t.settings.config.strictRoute),
title: Text(t.config.strictRoute),
value: ref.watch(ConfigOptions.strictRoute),
onChanged:
ref.watch(ConfigOptions.strictRoute.notifier).update,
@@ -255,13 +255,13 @@ class ConfigOptionsPage extends HookConsumerWidget {
preferences:
ref.watch(ConfigOptions.tunImplementation.notifier),
choices: TunImplementation.values,
title: t.settings.config.tunImplementation,
title: t.config.tunImplementation,
presentChoice: (value) => value.name,
),
ValuePreferenceWidget(
value: ref.watch(ConfigOptions.mixedPort),
preferences: ref.watch(ConfigOptions.mixedPort.notifier),
title: t.settings.config.mixedPort,
title: t.config.mixedPort,
inputToValue: int.tryParse,
digitsOnly: true,
validateInput: isPort,
@@ -269,14 +269,14 @@ class ConfigOptionsPage extends HookConsumerWidget {
ValuePreferenceWidget(
value: ref.watch(ConfigOptions.localDnsPort),
preferences: ref.watch(ConfigOptions.localDnsPort.notifier),
title: t.settings.config.localDnsPort,
title: t.config.localDnsPort,
inputToValue: int.tryParse,
digitsOnly: true,
validateInput: isPort,
),
SwitchListTile(
title: Text(
experimental(t.settings.config.allowConnectionFromLan),
experimental(t.config.allowConnectionFromLan),
),
value: ref.watch(ConfigOptions.allowConnectionFromLan),
onChanged: ref
@@ -285,10 +285,10 @@ class ConfigOptionsPage extends HookConsumerWidget {
),
const SettingsDivider(),
SettingsSection(
experimental(t.settings.config.section.tlsTricks),
experimental(t.config.section.tlsTricks),
),
SwitchListTile(
title: Text(t.settings.config.enableTlsFragment),
title: Text(t.config.enableTlsFragment),
value: ref.watch(ConfigOptions.enableTlsFragment),
onChanged: ref
.watch(ConfigOptions.enableTlsFragment.notifier)
@@ -298,7 +298,7 @@ class ConfigOptionsPage extends HookConsumerWidget {
value: ref.watch(ConfigOptions.tlsFragmentSize),
preferences:
ref.watch(ConfigOptions.tlsFragmentSize.notifier),
title: t.settings.config.tlsFragmentSize,
title: t.config.tlsFragmentSize,
inputToValue: OptionalRange.tryParse,
presentValue: (value) => value.present(t),
formatInputValue: (value) => value.format(),
@@ -307,20 +307,20 @@ class ConfigOptionsPage extends HookConsumerWidget {
value: ref.watch(ConfigOptions.tlsFragmentSleep),
preferences:
ref.watch(ConfigOptions.tlsFragmentSleep.notifier),
title: t.settings.config.tlsFragmentSleep,
title: t.config.tlsFragmentSleep,
inputToValue: OptionalRange.tryParse,
presentValue: (value) => value.present(t),
formatInputValue: (value) => value.format(),
),
SwitchListTile(
title: Text(t.settings.config.enableTlsMixedSniCase),
title: Text(t.config.enableTlsMixedSniCase),
value: ref.watch(ConfigOptions.enableTlsMixedSniCase),
onChanged: ref
.watch(ConfigOptions.enableTlsMixedSniCase.notifier)
.update,
),
SwitchListTile(
title: Text(t.settings.config.enableTlsPadding),
title: Text(t.config.enableTlsPadding),
value: ref.watch(ConfigOptions.enableTlsPadding),
onChanged: ref
.watch(ConfigOptions.enableTlsPadding.notifier)
@@ -330,24 +330,24 @@ class ConfigOptionsPage extends HookConsumerWidget {
value: ref.watch(ConfigOptions.tlsPaddingSize),
preferences:
ref.watch(ConfigOptions.tlsPaddingSize.notifier),
title: t.settings.config.tlsPaddingSize,
title: t.config.tlsPaddingSize,
inputToValue: OptionalRange.tryParse,
presentValue: (value) => value.format(),
formatInputValue: (value) => value.format(),
),
const SettingsDivider(),
SettingsSection(experimental(t.settings.config.section.warp)),
SettingsSection(experimental(t.config.section.warp)),
WarpOptionsTiles(key: ConfigOptionSection._warpKey),
const SettingsDivider(),
SettingsSection(t.settings.config.section.misc),
SettingsSection(t.config.section.misc),
ValuePreferenceWidget(
value: ref.watch(ConfigOptions.connectionTestUrl),
preferences:
ref.watch(ConfigOptions.connectionTestUrl.notifier),
title: t.settings.config.connectionTestUrl,
title: t.config.connectionTestUrl,
),
ListTile(
title: Text(t.settings.config.urlTestInterval),
title: Text(t.config.urlTestInterval),
subtitle: Text(
ref
.watch(ConfigOptions.urlTestInterval)
@@ -355,7 +355,7 @@ class ConfigOptionsPage extends HookConsumerWidget {
),
onTap: () async {
final urlTestInterval = await SettingsSliderDialog(
title: t.settings.config.urlTestInterval,
title: t.config.urlTestInterval,
initialValue: ref
.watch(ConfigOptions.urlTestInterval)
.inMinutes
@@ -379,7 +379,7 @@ class ConfigOptionsPage extends HookConsumerWidget {
ValuePreferenceWidget(
value: ref.watch(ConfigOptions.clashApiPort),
preferences: ref.watch(ConfigOptions.clashApiPort.notifier),
title: t.settings.config.clashApiPort,
title: t.config.clashApiPort,
validateInput: isPort,
digitsOnly: true,
inputToValue: int.tryParse,

View File

@@ -29,7 +29,7 @@ class WarpOptionsTiles extends HookConsumerWidget {
(previous, next) async {
if (next case AsyncData(value: final log) when log.isNotEmpty) {
await CustomAlertDialog(
title: t.settings.config.warpConfigGenerated,
title: t.config.warpConfigGenerated,
message: log,
).show(context);
}
@@ -39,7 +39,7 @@ class WarpOptionsTiles extends HookConsumerWidget {
return Column(
children: [
SwitchListTile(
title: Text(t.settings.config.enableWarp),
title: Text(t.config.enableWarp),
value: enableWarp,
onChanged: (value) async {
if (!warpPrefaceCompleted) {
@@ -57,12 +57,12 @@ class WarpOptionsTiles extends HookConsumerWidget {
},
),
ListTile(
title: Text(t.settings.config.generateWarpConfig),
title: Text(t.config.generateWarpConfig),
subtitle: canChangeOptions
? switch (warpOptions.configGeneration) {
AsyncLoading() => const LinearProgressIndicator(),
AsyncError() => Text(
t.settings.config.missingWarpConfig,
t.config.missingWarpConfig,
style:
TextStyle(color: Theme.of(context).colorScheme.error),
),
@@ -81,27 +81,27 @@ class WarpOptionsTiles extends HookConsumerWidget {
preferences: ref.watch(ConfigOptions.warpDetourMode.notifier),
enabled: canChangeOptions,
choices: WarpDetourMode.values,
title: t.settings.config.warpDetourMode,
title: t.config.warpDetourMode,
presentChoice: (value) => value.present(t),
),
ValuePreferenceWidget(
value: ref.watch(ConfigOptions.warpLicenseKey),
preferences: ref.watch(ConfigOptions.warpLicenseKey.notifier),
enabled: canChangeOptions,
title: t.settings.config.warpLicenseKey,
title: t.config.warpLicenseKey,
presentValue: (value) => value.isEmpty ? t.general.notSet : value,
),
ValuePreferenceWidget(
value: ref.watch(ConfigOptions.warpCleanIp),
preferences: ref.watch(ConfigOptions.warpCleanIp.notifier),
enabled: canChangeOptions,
title: t.settings.config.warpCleanIp,
title: t.config.warpCleanIp,
),
ValuePreferenceWidget(
value: ref.watch(ConfigOptions.warpPort),
preferences: ref.watch(ConfigOptions.warpPort.notifier),
enabled: canChangeOptions,
title: t.settings.config.warpPort,
title: t.config.warpPort,
inputToValue: int.tryParse,
validateInput: isPort,
digitsOnly: true,
@@ -110,7 +110,7 @@ class WarpOptionsTiles extends HookConsumerWidget {
value: ref.watch(ConfigOptions.warpNoise),
preferences: ref.watch(ConfigOptions.warpNoise.notifier),
enabled: canChangeOptions,
title: t.settings.config.warpNoise,
title: t.config.warpNoise,
inputToValue: (input) =>
OptionalRange.tryParse(input, allowEmpty: true),
presentValue: (value) => value.present(t),
@@ -120,7 +120,7 @@ class WarpOptionsTiles extends HookConsumerWidget {
value: ref.watch(ConfigOptions.warpNoiseDelay),
preferences: ref.watch(ConfigOptions.warpNoiseDelay.notifier),
enabled: canChangeOptions,
title: t.settings.config.warpNoiseDelay,
title: t.config.warpNoiseDelay,
inputToValue: (input) =>
OptionalRange.tryParse(input, allowEmpty: true),
presentValue: (value) => value.present(t),
@@ -139,9 +139,9 @@ class WarpLicenseAgreementModal extends HookConsumerWidget {
final t = ref.watch(translationsProvider);
return AlertDialog(
title: Text(t.settings.config.warpConsent.title),
title: Text(t.config.warpConsent.title),
content: Text.rich(
t.settings.config.warpConsent.description(
t.config.warpConsent.description(
tos: (text) => TextSpan(
text: text,
style: const TextStyle(color: Colors.blue),

View File

@@ -49,11 +49,11 @@ class QuickSettingsModal extends HookConsumerWidget {
SwitchListTile(
value: ref.watch(ConfigOptions.enableWarp),
onChanged: ref.watch(ConfigOptions.enableWarp.notifier).update,
title: Text(t.settings.config.enableWarp),
title: Text(t.config.enableWarp),
)
else
ListTile(
title: Text(t.settings.config.setupWarp),
title: Text(t.config.setupWarp),
trailing: const Icon(FluentIcons.chevron_right_24_regular),
onTap: () =>
ConfigOptionsRoute(section: ConfigOptionSection.warp.name)
@@ -63,15 +63,15 @@ class QuickSettingsModal extends HookConsumerWidget {
value: ref.watch(ConfigOptions.enableTlsFragment),
onChanged:
ref.watch(ConfigOptions.enableTlsFragment.notifier).update,
title: Text(t.settings.config.enableTlsFragment),
title: Text(t.config.enableTlsFragment),
),
SwitchListTile(
value: ref.watch(ConfigOptions.enableMux),
onChanged: ref.watch(ConfigOptions.enableMux.notifier).update,
title: Text(t.settings.config.enableMux),
title: Text(t.config.enableMux),
),
ListTile(
title: Text(t.settings.config.allOptions),
title: Text(t.config.allOptions),
trailing: const Icon(FluentIcons.chevron_right_24_regular),
dense: true,
onTap: () => const ConfigOptionsRoute().go(context),

View File

@@ -33,9 +33,9 @@ sealed class ConnectionStatus with _$ConnectionStatus {
};
String present(TranslationsEn t) => switch (this) {
Disconnected() => t.home.connection.tapToConnect,
Connecting() => t.home.connection.connecting,
Connected() => t.home.connection.connected,
Disconnecting() => t.home.connection.disconnecting,
Disconnected() => t.connection.tapToConnect,
Connecting() => t.connection.connecting,
Connected() => t.connection.connected,
Disconnecting() => t.connection.disconnecting,
};
}

View File

@@ -27,8 +27,8 @@ class _ConnectionWrapperState extends ConsumerState<ConnectionWrapper>
if (next case AsyncData(value: true)) {
final t = ref.read(translationsProvider);
ref.watch(inAppNotificationControllerProvider).showActionToast(
t.settings.config.reconnectMsg,
actionText: t.settings.config.reconnectBtn,
t.connection.reconnectMsg,
actionText: t.connection.reconnect,
callback: () async {
await ref
.read(connectionNotifierProvider.notifier)

View File

@@ -32,7 +32,7 @@ class ExperimentalFeatureNoticeDialog extends HookConsumerWidget {
final disableNotice = ref.watch(disableExperimentalFeatureNoticeProvider);
return AlertDialog(
title: Text(t.home.connection.experimentalNotice),
title: Text(t.connection.experimentalNotice),
content: SingleChildScrollView(
child: SizedBox(
width: 468,
@@ -40,11 +40,11 @@ class ExperimentalFeatureNoticeDialog extends HookConsumerWidget {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(t.home.connection.experimentalNoticeMsg),
Text(t.connection.experimentalNoticeMsg),
const Gap(8),
CheckboxListTile(
value: disableNotice,
title: Text(t.home.connection.disableExperimentalNotice),
title: Text(t.connection.disableExperimentalNotice),
secondary: const Icon(FluentIcons.eye_off_24_regular),
onChanged: (value) async => ref
.read(disableExperimentalFeatureNoticeProvider.notifier)
@@ -52,7 +52,7 @@ class ExperimentalFeatureNoticeDialog extends HookConsumerWidget {
dense: true,
),
ListTile(
title: Text(t.settings.config.pageTitle),
title: Text(t.config.pageTitle),
leading: const Icon(FluentIcons.box_edit_24_regular),
trailing: const Icon(FluentIcons.chevron_right_20_regular),
onTap: () async {
@@ -76,7 +76,7 @@ class ExperimentalFeatureNoticeDialog extends HookConsumerWidget {
),
TextButton(
onPressed: () => Navigator.of(context).maybePop(true),
child: Text(t.home.connection.connectAnyWay.toUpperCase()),
child: Text(t.connection.connectAnyWay.toUpperCase()),
),
],
);

View File

@@ -82,7 +82,7 @@ class ConnectionButton extends HookConsumerWidget {
},
label: switch (connectionStatus) {
AsyncData(value: Connected()) when requiresReconnect == true =>
t.home.connection.reconnect,
t.connection.reconnect,
AsyncData(value: final status) => status.present(t),
_ => "",
},

View File

@@ -48,7 +48,7 @@ class HomePage extends HookConsumerWidget {
IconButton(
onPressed: () => const QuickSettingsRoute().push(context),
icon: const Icon(FluentIcons.options_24_filled),
tooltip: t.settings.config.quickSettings,
tooltip: t.config.quickSettings,
),
IconButton(
onPressed: () => const AddProfileRoute().push(context),

View File

@@ -73,7 +73,7 @@ class SystemTrayNotifier extends _$SystemTrayNotifier with AppLogger {
},
),
MenuItem.submenu(
label: t.settings.config.serviceMode,
label: t.config.serviceMode,
submenu: Menu(
items: [
...ServiceMode.values.map(

View File

@@ -36,19 +36,19 @@ enum ServiceMode {
};
String present(TranslationsEn t) => switch (this) {
proxy => t.settings.config.serviceModes.proxy,
systemProxy => t.settings.config.serviceModes.systemProxy,
proxy => t.config.serviceModes.proxy,
systemProxy => t.config.serviceModes.systemProxy,
tun =>
"${t.settings.config.serviceModes.tun}${isExperimental ? " (${t.settings.experimental})" : ""}",
"${t.config.serviceModes.tun}${isExperimental ? " (${t.settings.experimental})" : ""}",
tunService =>
"${t.settings.config.serviceModes.tunService}${isExperimental ? " (${t.settings.experimental})" : ""}",
"${t.config.serviceModes.tunService}${isExperimental ? " (${t.settings.experimental})" : ""}",
};
String presentShort(TranslationsEn t) => switch (this) {
proxy => t.settings.config.shortServiceModes.proxy,
systemProxy => t.settings.config.shortServiceModes.systemProxy,
tun => t.settings.config.shortServiceModes.tun,
tunService => t.settings.config.shortServiceModes.tunService,
proxy => t.config.shortServiceModes.proxy,
systemProxy => t.config.shortServiceModes.systemProxy,
tun => t.config.shortServiceModes.tun,
tunService => t.config.shortServiceModes.tunService,
};
}
@@ -64,10 +64,10 @@ enum IPv6Mode {
final String key;
String present(TranslationsEn t) => switch (this) {
disable => t.settings.config.ipv6Modes.disable,
enable => t.settings.config.ipv6Modes.enable,
prefer => t.settings.config.ipv6Modes.prefer,
only => t.settings.config.ipv6Modes.only,
disable => t.config.ipv6Modes.disable,
enable => t.config.ipv6Modes.enable,
prefer => t.config.ipv6Modes.prefer,
only => t.config.ipv6Modes.only,
};
}
@@ -111,7 +111,7 @@ enum WarpDetourMode {
final String key;
String present(TranslationsEn t) => switch (this) {
proxyOverWarp => t.settings.config.warpDetourModes.proxyOverWarp,
warpOverProxy => t.settings.config.warpDetourModes.warpOverProxy,
proxyOverWarp => t.config.warpDetourModes.proxyOverWarp,
warpOverProxy => t.config.warpDetourModes.warpOverProxy,
};
}