Skip to content

Commit c10d2b7

Browse files
committed
More English localization
1 parent 417cf7f commit c10d2b7

File tree

5 files changed

+96
-24
lines changed

5 files changed

+96
-24
lines changed

lib/l10n/intl_en.arb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
"openSourceLicenses": "Open Source Licenses",
8181
"permissionUsage": "Permission Usage",
8282
"privacyStatement": "\nThis app does not collect your private information.\n\nHowever, I cannot control behaviors of apps you install/use inside the container system (including via shortcut commands).\n\nRequested permissions are used for:\nFile permissions: accessing phone directories\nNotifications & accessibility: Required by Termux:X11",
83-
"supportAuthor": "Support Author",
83+
"supportAuthor": "Support Developers",
8484
"recommendApp": "If you find it useful, please recommend to others!",
8585
"projectUrl": "Project URL",
8686
"commandEdit": "Command Edit",
@@ -98,15 +98,15 @@
9898
"enterNumber": "Please enter a number",
9999
"enterValidNumber": "Please enter a valid number",
100100
"installingBootPackage": "Installing Boot Package",
101-
"copyingContainerSystem": "Copying Container System",
102-
"installingContainerSystem": "Installing Container System",
101+
"copyingContainerSystem": "Copying System Files",
102+
"installingContainerSystem": "Installing System Files",
103103
"installationComplete": "Installation Complete",
104104
"reinstallingBootPackage": "Reinstalling Boot Package",
105105
"issueUrl": "Issue Report",
106106
"faqUrl": "FAQ",
107107
"solutionUrl": "Usage Guide",
108108
"discussionUrl": "Discussion",
109-
"firstLoadInstructions": "The first load may take about 5 to 10 minutes...\n\nNormally, the software will automatically redirect to the graphical interface after loading.\n\nIn the graphical interface:\n- Tap for left-click\n- Long press for right-click\n- Two-finger tap to open the keyboard\n- Two-finger swipe for mouse wheel\n\nPlease do not exit the software during installation.\n\nWhile waiting, you can click the button below to request permissions.\n\nMany folders in Tiny Computer (e.g., Downloads, Documents, Pictures) are bound to the corresponding device folders. Without these permissions, access to these folders will be denied.\n\nIf you don't need to access these folders, you can skip granting file permissions (but this may cause Firefox to fail when downloading files due to denied access to the Downloads folder).",
109+
"firstLoadInstructions": "The first load takes about 5 to 10 minutes... and does not require an internet connection.\n\nNormally, the software will automatically redirect to the graphical interface after loading.\n\nIn the graphical interface:\n- Tap for left-click\n- Long press for right-click\n- Two-finger tap to open the keyboard\n- Two-finger swipe for mouse wheel\n\nPlease do not exit the software during installation.\n\nWhile waiting, you can click the button below to request permissions.\n\nMany folders in Tiny Computer (e.g., Downloads, Documents, Pictures) are bound to the corresponding device folders. Without these permissions, access to these folders will be denied.\n\nIf you don't need to access these folders, you can skip granting file permissions (but this may cause Firefox to fail when downloading files due to denied access to the Downloads folder).",
110110
"updateRequest": "Please try to use the latest version. Visit the project address to check for the latest version.",
111111
"avncScreenResize": "Adaptive Screen Size",
112112
"avncResizeFactor": "Screen Scaling Ratio",

lib/l10n/intl_zh.arb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
"faqUrl": "常见问题",
107107
"solutionUrl": "典型场景使用指南",
108108
"discussionUrl": "论坛与讨论",
109-
"firstLoadInstructions": "第一次加载大概需要5到10分钟...\n\n正常情况下,加载完成后软件会自动跳转到图形界面。\n\n在图形界面时:\n- 点击为鼠标左键\n- 长按为鼠标右键\n- 双指点击可弹出键盘\n- 双指划动为鼠标滚轮\n\n请不要在安装时退出软件。\n\n在等待时,可以点击下面的按钮申请一下权限。\n\n小小电脑的许多文件夹,比如下载、文档、图片等等都和设备的对应文件夹绑定,如果不授予这些权限会导致这些文件夹无权访问。\n\n但如果你不需要访问这些文件夹,也可以不授予文件权限(可能导致火狐浏览器下载文件失败,因为无权访问下载文件夹)。",
109+
"firstLoadInstructions": "第一次加载大概需要5到10分钟...并且不需要网络。\n\n正常情况下,加载完成后软件会自动跳转到图形界面。\n\n在图形界面时:\n- 点击为鼠标左键\n- 长按为鼠标右键\n- 双指点击可弹出键盘\n- 双指划动为鼠标滚轮\n\n请不要在安装时退出软件。\n\n在等待时,可以点击下面的按钮申请一下权限。\n\n小小电脑的许多文件夹,比如下载、文档、图片等等都和设备的对应文件夹绑定,如果不授予这些权限会导致这些文件夹无权访问。\n\n但如果你不需要访问这些文件夹,也可以不授予文件权限(可能导致火狐浏览器下载文件失败,因为无权访问下载文件夹)。",
110110
"updateRequest": "请尽量使用最新版本。前往项目地址可查看最新版本。",
111111
"avncScreenResize": "自适应屏幕尺寸",
112112
"avncResizeFactor": "屏幕缩放比",

lib/l10n/intl_zh_Hant.arb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
"faqUrl": "常見問題",
107107
"solutionUrl": "操作指南",
108108
"discussionUrl": "討論",
109-
"firstLoadInstructions": "第一次載入大概需要5到10分鐘...\n\n正常情況下,載入完成後軟體會自動跳轉到圖形介面。\n\n在圖形介面時:\n- 點擊為滑鼠左鍵\n- 長按為滑鼠右鍵\n- 雙指點擊可彈出鍵盤\n- 雙指滑動為滑鼠滾輪\n\n請不要在安裝時退出軟體。\n\n在等待時,可以點擊下面的按鈕申請權限。\n\n小小電腦的許多資料夾,比如下載、文件、圖片等等都和裝置的這些資料夾綁定,如果不授予這些權限會導致這些資料夾無權存取。\n\n但如果你不需要存取這些資料夾,也可以不授予檔案權限(可能導致火狐瀏覽器下載檔案失敗,因為無權存取下載資料夾)。",
109+
"firstLoadInstructions": "第一次加載大概需要5到10分鐘...並且不需要網絡。\n\n正常情況下,載入完成後軟體會自動跳轉到圖形介面。\n\n在圖形介面時:\n- 點擊為滑鼠左鍵\n- 長按為滑鼠右鍵\n- 雙指點擊可彈出鍵盤\n- 雙指滑動為滑鼠滾輪\n\n請不要在安裝時退出軟體。\n\n在等待時,可以點擊下面的按鈕申請權限。\n\n小小電腦的許多資料夾,比如下載、文件、圖片等等都和裝置的這些資料夾綁定,如果不授予這些權限會導致這些資料夾無權存取。\n\n但如果你不需要存取這些資料夾,也可以不授予檔案權限(可能導致火狐瀏覽器下載檔案失敗,因為無權存取下載資料夾)。",
110110
"updateRequest": "請盡量使用最新版本。前往專案網址查看最新版本。",
111111
"avncScreenResize": "自適應螢幕尺寸",
112112
"avncResizeFactor": "螢幕縮放比",

lib/main.dart

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ class _SettingPageState extends State<SettingPage> {
197197
Navigator.of(context).pop();
198198
}, child: Text(AppLocalizations.of(context)!.cancel)),
199199
TextButton(onPressed:() async {
200-
await Util.setCurrentProp("boot", D.boot);
200+
await Util.setCurrentProp("boot", Localizations.localeOf(context).languageCode == 'zh' ? D.boot : D.boot.replaceFirst('LANG=zh_CN.UTF-8', 'LANG=en_US.UTF-8').replaceFirst('公共', 'Public').replaceFirst('图片', 'Pictures').replaceFirst('音乐', 'Music').replaceFirst('视频', 'Videos').replaceFirst('下载', 'Downloads').replaceFirst('文档', 'Documents').replaceFirst('照片', 'Photos'));
201201
G.bootTextChange.value = !G.bootTextChange.value;
202202
if (!context.mounted) return;
203203
Navigator.of(context).pop();
@@ -579,14 +579,24 @@ sed -i -E "s@^(VNC_RESOLUTION)=.*@\\1=${w}x${h}@" \$(command -v startvnc)""");
579579
const SizedBox.square(dimension: 16),
580580
Text(AppLocalizations.of(context)!.wineCommandsHint),
581581
const SizedBox.square(dimension: 8),
582-
Wrap(alignment: WrapAlignment.center, spacing: 4.0, runSpacing: 4.0, children: D.wineCommands.asMap().entries.map<Widget>(
583-
(e) {
584-
return OutlinedButton(style: D.commandButtonStyle, child: Text(e.value["name"]!), onPressed: () {
585-
Util.termWrite("${e.value["command"]!} &");
586-
G.pageIndex.value = 0;
587-
});
588-
}
589-
).toList()),
582+
Wrap(
583+
alignment: WrapAlignment.center,
584+
spacing: 4.0,
585+
runSpacing: 4.0,
586+
children: (Localizations.localeOf(context).languageCode == 'zh'
587+
? D.wineCommands
588+
: D.wineCommands4En
589+
).asMap().entries.map<Widget>((e) {
590+
return OutlinedButton(
591+
style: D.commandButtonStyle,
592+
child: Text(e.value["name"]!),
593+
onPressed: () {
594+
Util.termWrite("${e.value["command"]!} &");
595+
G.pageIndex.value = 0;
596+
},
597+
);
598+
}).toList(),
599+
),
590600
const SizedBox.square(dimension: 16),
591601
const Divider(height: 2, indent: 8, endIndent: 8),
592602
const SizedBox.square(dimension: 16),
@@ -1263,7 +1273,7 @@ class _FastCommandsState extends State<FastCommands> {
12631273
Navigator.of(context).pop();
12641274
}, child: Text(AppLocalizations.of(context)!.cancel)),
12651275
TextButton(onPressed:() async {
1266-
await Util.setCurrentProp("commands", D.commands);
1276+
await Util.setCurrentProp("commands", Localizations.localeOf(context).languageCode == 'zh' ? D.commands : D.commands4En);
12671277
setState(() {});
12681278
if (!context.mounted) return;
12691279
Navigator.of(context).pop();
@@ -1290,7 +1300,9 @@ class _MyHomePageState extends State<MyHomePage> {
12901300
@override
12911301
void initState() {
12921302
super.initState();
1293-
_initializeWorkflow();
1303+
Future.delayed(Duration.zero,() {
1304+
_initializeWorkflow();
1305+
});
12941306
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky, overlays: []);
12951307
}
12961308

lib/workflow.dart

Lines changed: 67 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,32 @@ rm /tmp/wps.deb"""},
387387
{"name":"???", "command":"timeout 8 cmatrix"}
388388
];
389389

390+
//默认快捷指令,英文版本
391+
static const commands4En = [{"name":"Update Packages", "command":"sudo dpkg --configure -a && sudo apt update && sudo apt full-upgrade -y && sudo apt autoremove -y"},
392+
{"name":"System Info", "command":"neofetch -L && neofetch --off"},
393+
{"name":"Clear", "command":"clear"},
394+
{"name":"Interrupt", "command":"\x03"},
395+
{"name":"Install Painting Program Krita", "command":"sudo apt update && sudo apt install -y krita krita-l10n"},
396+
{"name":"Uninstall Krita", "command":"sudo apt autoremove --purge -y krita krita-l10n"},
397+
{"name":"Install KDE Non-Linear Video Editor", "command":"sudo apt update && sudo apt install -y kdenlive"},
398+
{"name":"Uninstall Kdenlive", "command":"sudo apt autoremove --purge -y kdenlive"},
399+
{"name":"Install LibreOffice", "command":"sudo apt update && sudo apt install -y libreoffice"},
400+
{"name":"Uninstall LibreOffice", "command":"sudo apt autoremove --purge -y libreoffice"},
401+
{"name":"Install WPS", "command":r"""cat << 'EOF' | sh && sudo dpkg --configure -a && sudo apt update && sudo apt install -y /tmp/wps.deb
402+
wget https://github.com/tiny-computer/third-party-archives/releases/download/archives/wps-office_11.1.0.11720_arm64.deb -O /tmp/wps.deb
403+
EOF
404+
rm /tmp/wps.deb"""},
405+
{"name":"Uninstall WPS", "command":"sudo apt autoremove --purge -y wps-office"},
406+
{"name":"Install CAJViewer", "command":"wget https://download.cnki.net/net.cnki.cajviewer_1.3.20-1_arm64.deb -O /tmp/caj.deb && sudo apt update && sudo apt install -y /tmp/caj.deb && bash /home/tiny/.local/share/tiny/caj/postinst; rm /tmp/caj.deb"},
407+
{"name":"Uninstall CAJViewer", "command":"sudo apt autoremove --purge -y net.cnki.cajviewer && bash /home/tiny/.local/share/tiny/caj/postrm"},
408+
{"name":"Install EdrawMax", "command":"wget https://cc-download.wondershare.cc/business/prd/edrawmax_13.1.0-1_arm64_binner.deb -O /tmp/edraw.deb && sudo apt update && sudo apt install -y /tmp/edraw.deb && bash /home/tiny/.local/share/tiny/edraw/postinst; rm /tmp/edraw.deb"},
409+
{"name":"Uninstall EdrawMax", "command":"sudo apt autoremove --purge -y edrawmax libldap-2.4-2"},
410+
{"name":"Enable Recycle Bin", "command":"sudo apt update && sudo apt install -y gvfs && echo 'Restart the app to use Recycle Bin.'"},
411+
{"name":"Clean Package Cache", "command":"sudo apt clean"},
412+
{"name":"Power Off", "command":"stopvnc\nexit\nexit"},
413+
{"name":"???", "command":"timeout 8 cmatrix"}
414+
];
415+
390416
//默认wine快捷指令
391417
static const wineCommands = [{"name":"Wine配置", "command":"winecfg"},
392418
{"name":"修复方块字", "command":"regedit Z:\\\\home\\\\tiny\\\\.local\\\\share\\\\tiny\\\\extra\\\\chn_fonts.reg && wine reg delete \"HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion\\FontSubstitutes\" /va /f"},
@@ -412,6 +438,31 @@ WINEDLLOVERRIDES="d3d8=b,d3d9=b,d3d10core=b,d3d11=b,dxgi=b" wine reg add 'HKEY_C
412438
{"name":"强制关闭Wine", "command":"wineserver -k"}
413439
];
414440

441+
//默认wine快捷指令,英文版本
442+
static const wineCommands4En = [{"name":"Wine Configuration", "command":"winecfg"},
443+
{"name":"Fix CJK Characters", "command":"regedit Z:\\\\home\\\\tiny\\\\.local\\\\share\\\\tiny\\\\extra\\\\chn_fonts.reg && wine reg delete \"HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion\\FontSubstitutes\" /va /f"},
444+
{"name":"Start Menu Dir", "command":"wine explorer \"C:\\\\ProgramData\\\\Microsoft\\\\Windows\\\\Start Menu\\\\Programs\""},
445+
{"name":"Enable DXVK", "command":"""WINEDLLOVERRIDES="d3d8=n,d3d9=n,d3d10core=n,d3d11=n,dxgi=n" wine reg add 'HKEY_CURRENT_USER\\Software\\Wine\\DllOverrides' /v d3d8 /d native /f >/dev/null 2>&1
446+
WINEDLLOVERRIDES="d3d8=n,d3d9=n,d3d10core=n,d3d11=n,dxgi=n" wine reg add 'HKEY_CURRENT_USER\\Software\\Wine\\DllOverrides' /v d3d9 /d native /f >/dev/null 2>&1
447+
WINEDLLOVERRIDES="d3d8=n,d3d9=n,d3d10core=n,d3d11=n,dxgi=n" wine reg add 'HKEY_CURRENT_USER\\Software\\Wine\\DllOverrides' /v d3d10core /d native /f >/dev/null 2>&1
448+
WINEDLLOVERRIDES="d3d8=n,d3d9=n,d3d10core=n,d3d11=n,dxgi=n" wine reg add 'HKEY_CURRENT_USER\\Software\\Wine\\DllOverrides' /v d3d11 /d native /f >/dev/null 2>&1
449+
WINEDLLOVERRIDES="d3d8=n,d3d9=n,d3d10core=n,d3d11=n,dxgi=n" wine reg add 'HKEY_CURRENT_USER\\Software\\Wine\\DllOverrides' /v dxgi /d native /f >/dev/null 2>&1"""},
450+
{"name":"Disable DXVK", "command":"""WINEDLLOVERRIDES="d3d8=b,d3d9=b,d3d10core=b,d3d11=b,dxgi=b" wine reg add 'HKEY_CURRENT_USER\\Software\\Wine\\DllOverrides' /v d3d8 /d builtin /f >/dev/null 2>&1
451+
WINEDLLOVERRIDES="d3d8=b,d3d9=b,d3d10core=b,d3d11=b,dxgi=b" wine reg add 'HKEY_CURRENT_USER\\Software\\Wine\\DllOverrides' /v d3d9 /d builtin /f >/dev/null 2>&1
452+
WINEDLLOVERRIDES="d3d8=b,d3d9=b,d3d10core=b,d3d11=b,dxgi=b" wine reg add 'HKEY_CURRENT_USER\\Software\\Wine\\DllOverrides' /v d3d10core /d builtin /f >/dev/null 2>&1
453+
WINEDLLOVERRIDES="d3d8=b,d3d9=b,d3d10core=b,d3d11=b,dxgi=b" wine reg add 'HKEY_CURRENT_USER\\Software\\Wine\\DllOverrides' /v d3d11 /d builtin /f >/dev/null 2>&1
454+
WINEDLLOVERRIDES="d3d8=b,d3d9=b,d3d10core=b,d3d11=b,dxgi=b" wine reg add 'HKEY_CURRENT_USER\\Software\\Wine\\DllOverrides' /v dxgi /d builtin /f >/dev/null 2>&1"""},
455+
{"name":"Explorer", "command":"wine explorer"},
456+
{"name":"Notepad", "command":"notepad"},
457+
{"name":"Minesweeper", "command":"winemine"},
458+
{"name":"Regedit", "command":"regedit"},
459+
{"name":"Control Panel", "command":"wine control"},
460+
{"name":"File Manager", "command":"winefile"},
461+
{"name":"Task Manager", "command":"wine taskmgr"},
462+
{"name":"IE Explorer", "command":"wine iexplore"},
463+
{"name":"Kill Wine Process", "command":"wineserver -k"}
464+
];
465+
415466
//默认小键盘
416467
static const termCommands = [
417468
{"name": "Esc", "key": TerminalKey.escape},
@@ -557,10 +608,10 @@ chmod 1777 tmp
557608
//初次启动要做的事情
558609
static Future<void> initForFirstTime() async {
559610
//首先设置bootstrap
560-
G.updateText.value = "正在安装引导包";
611+
G.updateText.value = AppLocalizations.of(G.homePageStateContext)!.installingBootPackage;
561612
await setupBootstrap();
562613

563-
G.updateText.value = "正在复制容器系统";
614+
G.updateText.value = AppLocalizations.of(G.homePageStateContext)!.copyingContainerSystem;
564615
//存放容器的文件夹0和存放硬链接的文件夹.l2s
565616
Util.createDirFromString("${G.dataPath}/containers/0/.l2s");
566617
//这个是容器rootfs,被split命令分成了xa*,放在assets里
@@ -569,7 +620,7 @@ chmod 1777 tmp
569620
await Util.copyAsset("assets/$name", "${G.dataPath}/$name");
570621
}
571622
//-J
572-
G.updateText.value = "正在安装容器系统";
623+
G.updateText.value = AppLocalizations.of(G.homePageStateContext)!.installingContainerSystem;
573624
await Util.execute(
574625
"""
575626
export DATA_DIR=${G.dataPath}
@@ -599,18 +650,19 @@ cat tmp3 | while read -r group_name group_id; do
599650
fi
600651
done
601652
\$DATA_DIR/bin/busybox rm -rf xa* tmp1 tmp2 tmp3
653+
${Localizations.localeOf(G.homePageStateContext).languageCode == 'zh' ? "" : "echo 'LANG=en_US.UTF-8' > \$CONTAINER_DIR/usr/local/etc/tmoe-linux/locale.txt"}
602654
""");
603655
//一些数据初始化
604656
//$DATA_DIR是数据文件夹, $CONTAINER_DIR是容器根目录
605657
//Termux:X11的启动命令并不在这里面,而是写死了。这下成💩山代码了:P
606658
await G.prefs.setStringList("containersInfo", ["""{
607659
"name":"Debian Bookworm",
608-
"boot":"${D.boot}",
660+
"boot":"${Localizations.localeOf(G.homePageStateContext).languageCode == 'zh' ? D.boot : D.boot.replaceFirst('LANG=zh_CN.UTF-8', 'LANG=en_US.UTF-8').replaceFirst('公共', 'Public').replaceFirst('图片', 'Pictures').replaceFirst('音乐', 'Music').replaceFirst('视频', 'Videos').replaceFirst('下载', 'Downloads').replaceFirst('文档', 'Documents').replaceFirst('照片', 'Photos')}",
609661
"vnc":"startnovnc &",
610662
"vncUrl":"http://localhost:36082/vnc.html?host=localhost&port=36082&autoconnect=true&resize=remote&password=12345678",
611-
"commands":${jsonEncode(D.commands)}
663+
"commands":${jsonEncode(Localizations.localeOf(G.homePageStateContext).languageCode == 'zh' ? D.commands : D.commands4En)}
612664
}"""]);
613-
G.updateText.value = "安装完成";
665+
G.updateText.value = AppLocalizations.of(G.homePageStateContext)!.installationComplete;
614666
}
615667

616668
static Future<void> initData() async {
@@ -634,13 +686,21 @@ done
634686
final String h = (min(s.width, s.height) * 0.75).round().toString();
635687
G.postCommand = """sed -i -E "s@(geometry)=.*@\\1=${w}x${h}@" /etc/tigervnc/vncserver-config-tmoe
636688
sed -i -E "s@^(VNC_RESOLUTION)=.*@\\1=${w}x${h}@" \$(command -v startvnc)""";
689+
if (Localizations.localeOf(G.homePageStateContext).languageCode != 'zh') {
690+
G.postCommand += "\nlocale-gen";
691+
// For English users, assume they need to enable terminal write
692+
await G.prefs.setBool("isTerminalWriteEnabled", true);
693+
await G.prefs.setBool("isTerminalCommandsEnabled", true);
694+
await G.prefs.setBool("isStickyKey", false);
695+
await G.prefs.setBool("wakelock", true);
696+
}
637697
await G.prefs.setBool("getifaddrsBridge", (await DeviceInfoPlugin().androidInfo).version.sdkInt >= 31);
638698
}
639699
G.currentContainer = Util.getGlobal("defaultContainer") as int;
640700

641701
//是否需要重新安装引导包?
642702
if (Util.getGlobal("reinstallBootstrap")) {
643-
G.updateText.value = "正在重新安装引导包";
703+
G.updateText.value = AppLocalizations.of(G.homePageStateContext)!.reinstallingBootPackage;
644704
await setupBootstrap();
645705
G.prefs.setBool("reinstallBootstrap", false);
646706
}

0 commit comments

Comments
 (0)