mirror of
https://github.com/wgh136/pixes.git
synced 2025-09-27 04:57:23 +00:00
translation
This commit is contained in:
@@ -7,6 +7,7 @@ import "package:pixes/foundation/log.dart";
|
||||
import "package:pixes/network/app_dio.dart";
|
||||
import "package:pixes/pages/main_page.dart";
|
||||
import "package:pixes/utils/app_links.dart";
|
||||
import "package:pixes/utils/translation.dart";
|
||||
import "package:window_manager/window_manager.dart";
|
||||
import 'package:system_theme/system_theme.dart';
|
||||
|
||||
@@ -20,6 +21,7 @@ void main() async {
|
||||
await SystemTheme.accentColor.load();
|
||||
await App.init();
|
||||
await appdata.readData();
|
||||
await Translation.init();
|
||||
handleLinks();
|
||||
SystemTheme.onChange.listen((event) {
|
||||
StateController.findOrNull(tag: "MyApp")?.update();
|
||||
|
@@ -22,6 +22,7 @@ import "package:pixes/utils/translation.dart";
|
||||
import "package:window_manager/window_manager.dart";
|
||||
|
||||
import "../components/page_route.dart";
|
||||
import "../utils/debug.dart";
|
||||
import "downloading_page.dart";
|
||||
|
||||
double get _appBarHeight => App.isDesktop ? 36.0 : 48.0;
|
||||
@@ -203,9 +204,19 @@ class _MainPageState extends State<MainPage> with WindowListener {
|
||||
padding: EdgeInsets.only(bottom: 4),
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional.centerStart,
|
||||
child: Text(
|
||||
"Pixes",
|
||||
style: TextStyle(fontSize: 13),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
"Pixes",
|
||||
style: TextStyle(fontSize: 13),
|
||||
),
|
||||
Spacer(),
|
||||
if(kDebugMode)
|
||||
Padding(
|
||||
padding: EdgeInsets.only(right: 138),
|
||||
child: Button(onPressed: debug, child: Text("Debug")),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
4
lib/utils/debug.dart
Normal file
4
lib/utils/debug.dart
Normal file
@@ -0,0 +1,4 @@
|
||||
/// function used for debug
|
||||
void debug() {
|
||||
|
||||
}
|
@@ -1,3 +1,6 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:pixes/foundation/app.dart';
|
||||
|
||||
extension Translation on String {
|
||||
@@ -7,8 +10,10 @@ extension Translation on String {
|
||||
this;
|
||||
}
|
||||
|
||||
static const translation = <String, Map<String, String>>{
|
||||
"zh_CN": {},
|
||||
"zh_TW": {},
|
||||
};
|
||||
static late final Map<String, Map<String, dynamic>> translation;
|
||||
|
||||
static Future<void> init() async{
|
||||
var data = await rootBundle.loadString("assets/tr.json");
|
||||
translation = Map<String, Map<String, dynamic>>.from(jsonDecode(data));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user