-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
242 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
// 使用 IntelliSense 了解相关属性。 | ||
// 悬停以查看现有属性的描述。 | ||
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "devtoys", | ||
"request": "launch", | ||
"type": "dart" | ||
}, | ||
{ | ||
"name": "devtoys (profile mode)", | ||
"request": "launch", | ||
"type": "dart", | ||
"flutterMode": "profile" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
arb-dir: lib/l10n | ||
template-arb-file: app_en.arb | ||
output-localization-file: s.dart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"appName": "DevToys", | ||
"@appName": { | ||
"description": "name of app" | ||
}, | ||
"configuration": "configuration", | ||
"conversion": "Conversion", | ||
"selectConversion": "Select whitch conversion mode you want to use", | ||
"encode": "Encode", | ||
"decode": "Decode", | ||
"input": "input", | ||
"output": "output" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"appName": "DevToys", | ||
"configuration": "配置", | ||
"conversion": "转换", | ||
"selectConversion": "选择您想使用的转换格式", | ||
"encode": "编码", | ||
"decode": "解码", | ||
"input": "输入", | ||
"output": "输出" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
import 'package:fluent_ui/fluent_ui.dart'; | ||
import 'package:flutter/foundation.dart'; | ||
|
||
class ZhFluentLocalization implements FluentLocalizations { | ||
const ZhFluentLocalization(); | ||
|
||
@override | ||
String get backButtonTooltip => 'Back'; | ||
|
||
@override | ||
String get closeButtonLabel => 'Close'; | ||
|
||
@override | ||
String get searchLabel => 'Search'; | ||
|
||
@override | ||
String get closeNavigationTooltip => 'Close Navigation'; | ||
|
||
@override | ||
String get openNavigationTooltip => 'Open Navigation'; | ||
|
||
@override | ||
String get clickToSearch => 'Click to search'; | ||
|
||
@override | ||
String get modalBarrierDismissLabel => 'Dismiss'; | ||
|
||
@override | ||
String get minimizeWindowTooltip => 'Minimze'; | ||
|
||
@override | ||
String get restoreWindowTooltip => 'Restore'; | ||
|
||
@override | ||
String get closeWindowTooltip => 'Close'; | ||
|
||
@override | ||
String get dialogLabel => 'Dialog'; | ||
|
||
@override | ||
String get cutButtonLabel => 'Cut'; | ||
|
||
@override | ||
String get copyButtonLabel => 'Copy'; | ||
|
||
@override | ||
String get pasteButtonLabel => 'Paste'; | ||
|
||
@override | ||
String get selectAllButtonLabel => 'Select all'; | ||
|
||
@override | ||
String get newTabLabel => 'Add new tab'; | ||
|
||
@override | ||
String get closeTabLabel => 'Close tab (Ctrl+F4)'; | ||
|
||
@override | ||
String get scrollTabBackwardLabel => 'Scroll tab list backward'; | ||
|
||
@override | ||
String get scrollTabForwardLabel => 'Scroll tab list forward'; | ||
|
||
@override | ||
String get noResultsFoundLabel => '找不到结果'; | ||
|
||
/// Creates an object that provides US English resource values for the material | ||
/// library widgets. | ||
/// | ||
/// The [locale] parameter is ignored. | ||
/// | ||
/// This method is typically used to create a [LocalizationsDelegate]. | ||
/// The [MaterialApp] does so by default. | ||
static Future<FluentLocalizations> load(Locale locale) { | ||
return SynchronousFuture(lookupAppLocalizations(locale)); | ||
} | ||
|
||
static const LocalizationsDelegate<FluentLocalizations> delegate = | ||
_CustomFluentLocalizationsDelegate(); | ||
|
||
static FluentLocalizations lookupAppLocalizations(Locale locale) { | ||
// Lookup logic when only language code is specified. | ||
switch (locale.languageCode) { | ||
case 'en': | ||
return const DefaultFluentLocalizations(); | ||
case 'zh': | ||
return const ZhFluentLocalization(); | ||
} | ||
|
||
throw FlutterError( | ||
'AppLocalizations.delegate failed to load unsupported locale "$locale". This is likely ' | ||
'an issue with the localizations generation tool. Please file an issue ' | ||
'on GitHub with a reproducible sample app and the gen-l10n configuration ' | ||
'that was used.'); | ||
} | ||
} | ||
|
||
class _CustomFluentLocalizationsDelegate | ||
extends LocalizationsDelegate<FluentLocalizations> { | ||
const _CustomFluentLocalizationsDelegate(); | ||
|
||
@override | ||
bool isSupported(Locale locale) => | ||
locale.languageCode == 'en' || locale.languageCode == 'zh'; | ||
|
||
@override | ||
Future<FluentLocalizations> load(Locale locale) => | ||
ZhFluentLocalization.load(locale); | ||
|
||
@override | ||
bool shouldReload(_CustomFluentLocalizationsDelegate old) => false; | ||
|
||
@override | ||
String toString() => 'DefaultFluentLocalizations.delegate(en_US)'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_gen/gen_l10n/s.dart'; | ||
|
||
class S { | ||
static AppLocalizations of(BuildContext context) { | ||
return AppLocalizations.of(context) ?? | ||
lookupAppLocalizations(const Locale('zh')); | ||
} | ||
|
||
static List<LocalizationsDelegate> get localizationsDelegates => | ||
AppLocalizations.localizationsDelegates; | ||
|
||
static List<Locale> get supportedLocales => AppLocalizations.supportedLocales; | ||
|
||
static LocalizationsDelegate<AppLocalizations> get delegate => | ||
AppLocalizations.delegate; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.