Skip to content

Commit

Permalink
fix: full english support
Browse files Browse the repository at this point in the history
  • Loading branch information
Plat committed Sep 14, 2022
1 parent c489658 commit 7e3bde6
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 29 deletions.
10 changes: 6 additions & 4 deletions assets/translations/en-US.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"label": {
"inputImage": "Original image file",
"outputImage": "Output image path",
"outputPath": "Output image path",
"imageSelect": "Select file",
"denoise": "Denoise:",
"scale": "Scale:",
"format": "Format:",
"start": "Start scale up",
"cancel": "Cancel"
"cancel": "Cancel",
"close": "Close"
},
"denoise": {
"none": "None",
Expand All @@ -28,9 +29,10 @@
},
"message": {
"completed": "Image saved successfully.",
"close": "Close",
"canceled": "Canceled scaling up image.",
"failed": "Failed to scale up image.",
"errorLog": "Log:\n{}"
"errorLog": "Log:\n{}",
"noInputImage": "Please select an image file.",
"noOutputPath": "Please select an output path."
}
}
10 changes: 6 additions & 4 deletions assets/translations/ja-JP.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"label": {
"inputImage": "拡大元の画像ファイル",
"outputImage": "保存先のファイル",
"outputPath": "保存先のファイル",
"imageSelect": "ファイルを選択",
"denoise": "デノイズ:",
"scale": "拡大率:",
"format": "保存形式:",
"start": "拡大開始",
"cancel": "キャンセル"
"cancel": "キャンセル",
"close": "閉じる"
},
"denoise": {
"none": "なし",
Expand All @@ -28,9 +29,10 @@
},
"message": {
"completed": "拡大した画像を保存しました。",
"close": "閉じる",
"canceled": "画像の拡大をキャンセルしました。",
"failed": "画像の拡大に失敗しました。",
"errorLog": "実行ログ:\n{}"
"errorLog": "実行ログ:\n{}",
"noInputImage": "拡大元の画像ファイルが指定されていません!",
"noOutputPath": "保存先のファイルが指定されていません!"
}
}
30 changes: 9 additions & 21 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'package:path/path.dart' as path;
import 'package:window_size/window_size.dart';

const _projectTitle = 'Real-CUGAN-GUI';
const _projectVersion = '1.0.3';
const _projectVersion = '1.1.0';

void main() async {
// おまじない
Expand Down Expand Up @@ -169,9 +169,9 @@ class _MainWindowPageState extends State<MainWindowPage> {
// バリデーション
if (inputFile == null) {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: const Text('拡大元の画像ファイルが指定されていません!'),
content: const Text('message.noInputImage').tr(),
action: SnackBarAction(
label: '閉じる',
label: 'label.close'.tr(),
onPressed: () {
ScaffoldMessenger.of(context).hideCurrentSnackBar();
},
Expand All @@ -181,9 +181,9 @@ class _MainWindowPageState extends State<MainWindowPage> {
}
if (outputFileController.text == '') {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: const Text('保存先のファイルが指定されていません!'),
content: const Text('message.noOutputPath').tr(),
action: SnackBarAction(
label: '閉じる',
label: 'label.close'.tr(),
onPressed: () {
ScaffoldMessenger.of(context).hideCurrentSnackBar();
},
Expand Down Expand Up @@ -242,19 +242,7 @@ class _MainWindowPageState extends State<MainWindowPage> {
// 標準エラー出力を受け取ったとき
List<String> lines = []; // すべてのログを貯めるリスト
process.stderr.transform(utf8.decoder).forEach((line) {
// // 22.00% みたいな進捗ログを取得
// var progressMatch = RegExp(r'([0-9]+\.[0-9]+)%').firstMatch(line);

// // プログレスバーを更新 (進捗ログを取得できたときのみ)
// if (progressMatch != null) {
// setState(() {
// progress = double.parse(progressMatch.group(1) ?? '0');
// });

// // 失敗したときにエラーログを表示するために受け取ったログを貯めておく
// } else {
lines.add(line);
// }
});

// realesrgan-ncnn-vulkan の終了を待つ
Expand All @@ -277,7 +265,7 @@ class _MainWindowPageState extends State<MainWindowPage> {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: const Text('message.completed').tr(),
action: SnackBarAction(
label: 'message.close'.tr(),
label: 'label.close'.tr(),
onPressed: () {
ScaffoldMessenger.of(context).hideCurrentSnackBar();
},
Expand All @@ -293,7 +281,7 @@ class _MainWindowPageState extends State<MainWindowPage> {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: const Text('message.cancelled').tr(),
action: SnackBarAction(
label: 'message.close'.tr(),
label: 'label.close'.tr(),
onPressed: () {
ScaffoldMessenger.of(context).hideCurrentSnackBar();
},
Expand All @@ -313,7 +301,7 @@ class _MainWindowPageState extends State<MainWindowPage> {
),
duration: const Duration(seconds: 20), // 10秒間表示
action: SnackBarAction(
label: 'message.close'.tr(),
label: 'label.close'.tr(),
onPressed: () {
ScaffoldMessenger.of(context).hideCurrentSnackBar();
},
Expand Down Expand Up @@ -408,7 +396,7 @@ class _MainWindowPageState extends State<MainWindowPage> {
controller: outputFileController,
decoration: InputDecoration(
border: const OutlineInputBorder(),
labelText: 'label.outputImage'.tr(),
labelText: 'label.outputPath'.tr(),
),
),
const SizedBox(height: 28),
Expand Down

0 comments on commit 7e3bde6

Please sign in to comment.