chore: l10n

This commit is contained in:
lollipopkit🏳️‍⚧️
2024-08-04 13:05:29 +08:00
parent a15c04956c
commit 64676bc5cb
31 changed files with 87 additions and 405 deletions

View File

@@ -115,7 +115,7 @@ class BackupPage extends StatelessWidget {
initiallyExpanded: false,
children: [
ListTile(
title: Text(l10n.setting),
title: Text(libL10n.setting),
trailing: const Icon(Icons.settings),
onTap: () async => _onTapWebdavSetting(context),
),
@@ -189,7 +189,7 @@ class BackupPage extends StatelessWidget {
onTap: () async {
final path = await Backup.backup();
Pfs.copy(await File(path).readAsString());
context.showSnackBar(l10n.success);
context.showSnackBar(libL10n.success);
},
),
ListTile(
@@ -394,7 +394,7 @@ class BackupPage extends StatelessWidget {
context.showSnackBar(result);
return;
}
context.showSnackBar(l10n.success);
context.showSnackBar(libL10n.success);
Webdav.changeClient(url.text, user.text, pwd.text);
}
}
@@ -466,7 +466,7 @@ class BackupPage extends StatelessWidget {
},
);
if (err != null || suc != true) return;
context.showSnackBar(l10n.success);
context.showSnackBar(libL10n.success);
}
} catch (e, s) {
context.showErrDialog(e: e, s: s, operation: libL10n.import);

View File

@@ -123,7 +123,7 @@ class _EditorPageState extends State<EditorPage> {
actions: [
PopupMenuButton<String>(
icon: const Icon(Icons.language),
tooltip: l10n.language,
tooltip: libL10n.language,
onSelected: (value) {
_controller.language = Highlights.all[value];
_langCode = value;

View File

@@ -44,7 +44,6 @@ class _HomePageState extends State<HomePage>
super.initState();
SystemUIs.switchStatusBar(hide: false);
WidgetsBinding.instance.addObserver(this);
_selectIndex.value = Stores.setting.launchPage.fetch();
// avoid index out of range
if (_selectIndex.value >= AppTab.values.length || _selectIndex.value < 0) {
_selectIndex.value = 0;
@@ -234,7 +233,7 @@ class _HomePageState extends State<HomePage>
children: [
ListTile(
leading: const Icon(Icons.settings),
title: Text(l10n.setting),
title: Text(libL10n.setting),
onTap: () => AppRoutes.settings().go(context),
onLongPress: _onLongPressSetting,
),
@@ -255,7 +254,7 @@ class _HomePageState extends State<HomePage>
),
ListTile(
leading: const Icon(OctIcons.feed_discussion),
title: Text('${l10n.about} & ${libL10n.feedback}'),
title: Text('${libL10n.about} & ${libL10n.feedback}'),
onTap: _showAboutDialog,
)
].map((e) => CardX(child: e)).toList(),
@@ -265,7 +264,7 @@ class _HomePageState extends State<HomePage>
void _showAboutDialog() {
context.showRoundDialog(
title: l10n.about,
title: libL10n.about,
child: _buildAboutContent(),
actions: [
TextButton(
@@ -376,7 +375,7 @@ ${GithubIds.participants.map((e) => '[$e](${e.url})').join(' ')}
final result = await AppRoutes.editor(
text: text,
langCode: 'json',
title: l10n.setting,
title: libL10n.setting,
).go<String>(context);
if (result == null) {
return;

View File

@@ -429,7 +429,7 @@ final class _PvePageState extends State<PvePage> {
fn: () => func(item.node, item.id),
);
if (suc == true) {
context.showSnackBar(l10n.success);
context.showSnackBar(libL10n.success);
} else {
context.showSnackBar(err?.toString() ?? libL10n.fail);
}

View File

@@ -91,7 +91,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
}
Widget _buildMainPage(Server si) {
final buildFuncs = !Stores.setting.moveOutServerTabFuncBtns.fetch();
final buildFuncs = !Stores.setting.moveServerFuncs.fetch();
final logoUrl = si.spi.custom?.logoUrl ??
Stores.setting.serverLogoUrl.fetch().selfIfNotNullEmpty;
final buildLogo = logoUrl != null;
@@ -157,7 +157,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
child: ExpandTile(
leading: const Icon(MingCute.information_fill, size: 20),
initiallyExpanded: _getInitExpand(ss.more.entries.length),
title: Text(l10n.about),
title: Text(libL10n.about),
childrenPadding: const EdgeInsets.symmetric(
horizontal: 17,
vertical: 11,

View File

@@ -432,7 +432,7 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
UIs.height7,
ListTile(
leading: const Icon(BoxIcons.bxs_help_circle),
title: Text(l10n.about),
title: Text(libL10n.about),
subtitle: Text(l10n.wolTip, style: UIs.text12Grey),
).cardx,
Input(

View File

@@ -432,7 +432,7 @@ class _ServerPageState extends State<ServerPage>
],
),
UIs.height13,
if (Stores.setting.moveOutServerTabFuncBtns.fetch() &&
if (Stores.setting.moveServerFuncs.fetch() &&
// Discussion #146
!Stores.setting.serverTabUseOldUI.fetch())
SizedBox(
@@ -676,7 +676,7 @@ ${ss.err?.message ?? 'null'}
if (flip) {
return _kCardHeightFlip;
}
if (Stores.setting.moveOutServerTabFuncBtns.fetch() &&
if (Stores.setting.moveServerFuncs.fetch() &&
// Discussion #146
!Stores.setting.serverTabUseOldUI.fetch()) {
return _kCardHeightMoveOutFuncs;

View File

@@ -31,7 +31,7 @@ class _SettingPageState extends State<SettingPage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: CustomAppBar(
title: Text(l10n.setting),
title: Text(libL10n.setting),
actions: [
IconButton(
icon: const Icon(Icons.delete),
@@ -39,14 +39,14 @@ class _SettingPageState extends State<SettingPage> {
title: libL10n.attention,
child: SimpleMarkdown(
data: libL10n.askContinue(
'${libL10n.delete} **${libL10n.all}** ${l10n.setting}',
'${libL10n.delete} **${libL10n.all}** ${libL10n.setting}',
),
),
actions: Btn.ok(
onTap: () {
context.pop();
_setting.box.deleteAll(_setting.box.keys);
context.showSnackBar(l10n.success);
context.showSnackBar(libL10n.success);
},
red: true,
).toList,
@@ -172,12 +172,12 @@ class _SettingPageState extends State<SettingPage> {
String display;
if (val != null) {
if (val > BuildData.build) {
display = l10n.versionHaveUpdate(val);
display = libL10n.versionHasUpdate(val);
} else {
display = l10n.versionUpdated(BuildData.build);
display = libL10n.versionUpdated(BuildData.build);
}
} else {
display = l10n.versionUnknownUpdate(BuildData.build);
display = libL10n.versionUnknownUpdate(BuildData.build);
}
return Text(display, style: UIs.textGrey);
},
@@ -196,12 +196,10 @@ class _SettingPageState extends State<SettingPage> {
Widget _buildUpdateInterval() {
return ListTile(
title: Text(
l10n.updateServerStatusInterval,
),
title: Text(l10n.updateServerStatusInterval),
onTap: () async {
final val = await context.showPickSingleDialog(
title: l10n.setting,
title: libL10n.setting,
items: List.generate(10, (idx) => idx == 1 ? null : idx),
initial: _setting.serverStatusUpdateInterval.fetch(),
name: (p0) => p0 == 0 ? l10n.manual : '$p0 ${l10n.second}',
@@ -223,7 +221,7 @@ class _SettingPageState extends State<SettingPage> {
Widget _buildAppColor() {
return ListTile(
leading: const Icon(Icons.colorize),
title: Text(l10n.primaryColorSeed),
title: Text(libL10n.primaryColorSeed),
trailing: _setting.colorSeed.listenable().listenVal(
(val) {
final c = Color(val);
@@ -233,7 +231,7 @@ class _SettingPageState extends State<SettingPage> {
onTap: () async {
final ctrl = TextEditingController(text: UIs.primaryColor.toHex);
await context.showRoundDialog(
title: l10n.primaryColorSeed,
title: libL10n.primaryColorSeed,
child: StatefulBuilder(builder: (context, setState) {
final children = <Widget>[
/// Plugin [dynamic_color] is not supported on iOS
@@ -353,10 +351,10 @@ class _SettingPageState extends State<SettingPage> {
final len = ThemeMode.values.length;
return ListTile(
leading: const Icon(MingCute.moon_stars_fill),
title: Text(l10n.themeMode),
title: Text(libL10n.themeMode),
onTap: () async {
final selected = await context.showPickSingleDialog(
title: l10n.themeMode,
title: libL10n.themeMode,
items: List.generate(len + 2, (index) => index),
name: (p0) => _buildThemeModeStr(p0),
initial: _setting.themeMode.fetch(),
@@ -392,13 +390,17 @@ class _SettingPageState extends State<SettingPage> {
}
Widget _buildFont() {
final fontName = _setting.fontPath.fetch().getFileName();
return ListTile(
leading: const Icon(MingCute.font_fill),
title: Text(l10n.font),
trailing: Text(
fontName ?? libL10n.empty,
style: UIs.text15,
trailing: _setting.fontPath.listenable().listenVal(
(val) {
final fontName = val.getFileName();
return Text(
fontName ?? libL10n.empty,
style: UIs.text15,
);
},
),
onTap: () {
context.showRoundDialog(
@@ -496,10 +498,10 @@ class _SettingPageState extends State<SettingPage> {
Widget _buildLocale() {
return ListTile(
leading: const Icon(IonIcons.language),
title: Text(l10n.language),
title: Text(libL10n.language),
onTap: () async {
final selected = await context.showPickSingleDialog(
title: l10n.language,
title: libL10n.language,
items: AppLocalizations.supportedLocales,
name: (p0) => p0.nativeName,
initial: _setting.locale.fetch().toLocale,
@@ -658,10 +660,7 @@ class _SettingPageState extends State<SettingPage> {
leading: const Icon(MingCute.history_line),
// title: Text(l10n.openLastPath),
// subtitle: Text(l10n.openLastPathTip, style: UIs.textGrey),
title: TipText(
l10n.openLastPath,
l10n.openLastPathTip
),
title: TipText(l10n.openLastPath, l10n.openLastPathTip),
trailing: StoreSwitch(prop: _setting.sftpOpenLastPath),
);
}
@@ -727,7 +726,7 @@ class _SettingPageState extends State<SettingPage> {
for (final key in deleteKeys) {
Stores.server.box.delete(key);
}
context.showSnackBar(l10n.success);
context.showSnackBar(libL10n.success);
},
);
}
@@ -737,10 +736,7 @@ class _SettingPageState extends State<SettingPage> {
return ListTile(
// title: Text(l10n.textScaler),
// subtitle: Text(l10n.textScalerTip, style: UIs.textGrey),
title: TipText(
l10n.textScaler,
l10n.textScalerTip
),
title: TipText(l10n.textScaler, l10n.textScalerTip),
trailing: ValBuilder(
listenable: _setting.textFactor.listenable(),
builder: (val) => Text(
@@ -790,11 +786,8 @@ class _SettingPageState extends State<SettingPage> {
return ListTile(
// title: Text(l10n.location),
// subtitle: Text(l10n.moveOutServerFuncBtnsHelp, style: UIs.text13Grey),
title: TipText(
l10n.location,
l10n.moveOutServerFuncBtnsHelp
),
trailing: StoreSwitch(prop: _setting.moveOutServerTabFuncBtns),
title: TipText(l10n.location, l10n.moveOutServerFuncBtnsHelp),
trailing: StoreSwitch(prop: _setting.moveServerFuncs),
);
}
@@ -880,10 +873,7 @@ class _SettingPageState extends State<SettingPage> {
return ListTile(
// title: Text(l10n.doubleColumnMode),
// subtitle: Text(l10n.doubleColumnTip, style: UIs.textGrey),
title: TipText(
l10n.doubleColumnMode,
l10n.doubleColumnTip
),
title: TipText(l10n.doubleColumnMode, l10n.doubleColumnTip),
trailing: StoreSwitch(prop: _setting.doubleColumnServersPage),
);
}
@@ -897,7 +887,7 @@ class _SettingPageState extends State<SettingPage> {
if (func == null) return null;
return ListTile(
leading: const Icon(Icons.phone_android),
title: Text('${Pfs.type} ${l10n.setting}'),
title: Text('${Pfs.type} ${libL10n.setting}'),
trailing: const Icon(Icons.keyboard_arrow_right),
onTap: () => func(context),
);
@@ -908,10 +898,7 @@ class _SettingPageState extends State<SettingPage> {
leading: const Icon(MingCute.code_line, size: _kIconSize),
// title: Text(l10n.highlight),
// subtitle: Text(l10n.editorHighlightTip, style: UIs.textGrey),
title: TipText(
l10n.highlight,
l10n.editorHighlightTip
),
title: TipText(l10n.highlight, l10n.editorHighlightTip),
trailing: StoreSwitch(prop: _setting.editorHighlight),
);
}
@@ -934,10 +921,7 @@ class _SettingPageState extends State<SettingPage> {
Widget _buildContainerTrySudo() {
return ListTile(
leading: const Icon(EvaIcons.person_done),
title: TipText(
l10n.trySudo,
l10n.containerTrySudoTip
),
title: TipText(l10n.trySudo, l10n.containerTrySudoTip),
trailing: StoreSwitch(prop: _setting.containerTrySudo),
);
}
@@ -955,10 +939,7 @@ class _SettingPageState extends State<SettingPage> {
leading: const Icon(MingCute.chart_line_line, size: _kIconSize),
// title: Text(l10n.parseContainerStats),
// subtitle: Text(l10n.parseContainerStatsTip, style: UIs.textGrey),
title: TipText(
l10n.stat,
l10n.parseContainerStatsTip
),
title: TipText(l10n.stat, l10n.parseContainerStatsTip),
trailing: StoreSwitch(prop: _setting.containerParseStat),
);
}
@@ -982,10 +963,7 @@ class _SettingPageState extends State<SettingPage> {
return ListTile(
// title: Text(l10n.rememberPwdInMem),
// subtitle: Text(l10n.rememberPwdInMemTip, style: UIs.textGrey),
title: TipText(
l10n.rememberPwdInMem,
l10n.rememberPwdInMemTip
),
title: TipText(l10n.rememberPwdInMem, l10n.rememberPwdInMemTip),
trailing: StoreSwitch(prop: _setting.rememberPwdInMem),
);
}
@@ -1163,9 +1141,7 @@ class _SettingPageState extends State<SettingPage> {
// style: UIs.textGrey,
// ),
title: TipText(
l10n.letterCache,
'${l10n.letterCacheTip}\n${l10n.needRestart}'
),
l10n.letterCache, '${l10n.letterCacheTip}\n${l10n.needRestart}'),
trailing: StoreSwitch(prop: _setting.letterCache),
);
}

View File

@@ -44,7 +44,7 @@ class _AndroidSettingsPageState extends State<AndroidSettingsPage> {
map.forEach((key, value) {
PrefStore.set(key, value);
});
context.showSnackBar(l10n.success);
context.showSnackBar(libL10n.success);
} catch (e) {
context.showSnackBar(e.toString());
}

View File

@@ -46,7 +46,7 @@ class _IOSSettingsPageState extends State<IOSSettingsPage> {
final val = _pushToken.value;
if (val != null) {
Pfs.copy(val);
context.showSnackBar(l10n.success);
context.showSnackBar(libL10n.success);
} else {
context.showSnackBar(libL10n.fail);
}
@@ -115,12 +115,11 @@ class _IOSSettingsPageState extends State<IOSSettingsPage> {
);
if (result == null) return;
final (suc, err) = await context.showLoadingDialog(fn: () async {
final (_, err) = await context.showLoadingDialog(fn: () async {
await wc.updateApplicationContext({'urls': result});
return true;
});
if (suc == true) {
context.showSnackBar(err?.toString() ?? l10n.success);
if (err == null) {
context.showSnackBar(libL10n.success);
}
}
}

View File

@@ -116,7 +116,7 @@ class _SnippetEditPageState extends State<SnippetEditPage>
minLines: 3,
maxLines: 3,
type: TextInputType.multiline,
label: l10n.note,
label: libL10n.note,
icon: Icons.note,
suggestion: true,
),

View File

@@ -310,7 +310,7 @@ class _LocalStoragePageState extends State<LocalStoragePage> {
),
ListTile(
leading: const Icon(Icons.open_in_new),
title: Text(l10n.open),
title: Text(libL10n.open),
onTap: () {
Pfs.share(path: file.absolute.path);
},

View File

@@ -266,7 +266,7 @@ class _SftpPageState extends State<SftpPage> with AfterLayoutMixin {
return Input(
autoFocus: true,
icon: Icons.abc,
label: l10n.path,
label: libL10n.path,
node: node,
controller: controller,
suggestion: true,
@@ -381,9 +381,9 @@ class _SftpPageState extends State<SftpPage> with AfterLayoutMixin {
leading: const Icon(MingCute.copy_line),
title: Text(l10n.copyPath),
onTap: () {
Pfs.copy(_getRemotePath(file));
context.pop();
context.showSnackBar(l10n.success);
Pfs.copy(_getRemotePath(file));
context.showSnackBar(libL10n.success);
},
),
ListTile(

View File

@@ -60,7 +60,7 @@ class ServerFuncBtns extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: btns
.map(
(e) => Stores.setting.moveOutServerTabFuncBtns.fetch()
(e) => Stores.setting.moveServerFuncs.fetch()
? IconButton(
onPressed: () => _onTapMoreBtns(e, spi, context),
padding: EdgeInsets.zero,