Skip to content

Commit 0db912d

Browse files
committed
refactor(i18n): migrate to new internationalization solution
1 parent 183dfba commit 0db912d

44 files changed

Lines changed: 2058 additions & 1941 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

lib/app/controller/chat_controller.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ class ChatController extends GetxController with WidgetsBindingObserver {
145145
}
146146
Uri uri = Uri.parse(urlPrefix);
147147
int port = uri.port;
148-
deviceController.onDeviceConnect(shortHash(''), S.current.device, phone, 'http://${uri.host}', port);
148+
deviceController.onDeviceConnect(shortHash(''), l10n.device, phone, 'http://${uri.host}', port);
149149
// Log.i('$urlPrefix/${info.messagePort}');
150150

151151
sendJoinEvent('http://${uri.host}:$port');
@@ -207,7 +207,7 @@ class ChatController extends GetxController with WidgetsBindingObserver {
207207
Future<void> sendDir() async {
208208
String? dirPath;
209209
if (GetPlatform.isDesktop) {
210-
dirPath = await getDirectoryPath(confirmButtonText: S.current.select);
210+
dirPath = await getDirectoryPath(confirmButtonText: l10n.select);
211211
} else {
212212
dirPath = await file_manager.FileManager.selectDirectory();
213213
}
@@ -458,7 +458,7 @@ class ChatController extends GetxController with WidgetsBindingObserver {
458458
if (url != null) {
459459
uploadFileForWeb(webFileSendCache[notifyMessage.hash]!, '$url:${notifyMessage.port}');
460460
} else {
461-
showToast(S.current.noIPFound);
461+
showToast(l10n.noIPFound);
462462
}
463463
}
464464
}

lib/app/controller/download_controller.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ class DownloadController extends GetxController {
5757
void onClose() {}
5858
Future<void> downloadFile(String url, String? dir) async {
5959
if (progress.containsKey(url) && progress[url]!.progress != 0.0) {
60-
showToast(S.current.fileIsDownloading);
60+
showToast(l10n.fileIsDownloading);
6161
return;
6262
}
6363
if (progress.containsKey(url) && progress[url]!.progress == 1.0) {
64-
showToast(S.current.fileDownloadSuccess);
64+
showToast(l10n.fileDownloadSuccess);
6565
return;
6666
}
6767
DownloadInfo info = DownloadInfo();

lib/app/controller/setting_controller.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class SettingController extends GetxController {
5959
const Duration(milliseconds: 100),
6060
() {
6161
if (!isVIP) {
62-
showToast(S.current.vipTips);
62+
showToast(l10n.vipTips);
6363
enableWebServer = !value;
6464
update();
6565
} else {
@@ -126,7 +126,7 @@ class SettingController extends GetxController {
126126
const Duration(milliseconds: 100),
127127
() {
128128
if (!isVIP) {
129-
showToast(S.current.vipTips);
129+
showToast(l10n.vipTips);
130130
enableAutoDownload = !value;
131131
update();
132132
} else {

lib/app/controller/utils/file_util.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import 'package:file_manager/file_manager.dart';
21
import 'package:file_selector/file_selector.dart';
32
import 'package:get/get.dart';
43
import 'package:file_manager/file_manager.dart' as file_manager;

lib/app/controller/utils/server_util.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class ServerUtil {
2626
// 用shelf部署一个路径的文件
2727
static serveFile(String path, int port) async {
2828
Log.e('部署 path -> $path');
29+
// TODO: 下面三行啥意思
2930
String filePath = path.replaceAll('\\', '/');
3031
filePath = filePath.replaceAll(RegExp('^[A-Z]:'), '');
3132
filePath = filePath.replaceAll(RegExp('^/'), '');

lib/app/routes/app_pages.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ class SpeedPages {
3131
builder: (context) {
3232
return PopScope(
3333
canPop: true,
34-
onPopInvoked: (value) async {
34+
onPopInvokedWithResult: (didPop, result) {
35+
// TODO: Reimplement this
3536
if (time == 0) {
3637
time++;
37-
showToast(S.current.backAgainTip);
38+
showToast(l10n.backAgainTip);
3839
} else {
3940
Navigator.of(context).pop();
4041
}

0 commit comments

Comments
 (0)