chore: update l10n and fix selection_menu_widget_test

This commit is contained in:
Lucas.Xu 2022-10-05 21:07:45 +08:00
parent 3e620ed335
commit 2501c15a8f
10 changed files with 154 additions and 56 deletions

View File

@ -45,7 +45,7 @@ ShortcutEventHandler _ignorekHandler = (editorState, event) {
};
SelectionMenuItem codeBlockItem = SelectionMenuItem(
name: 'Code Block',
name: () => 'Code Block',
icon: const Icon(Icons.abc),
keywords: ['code block'],
handler: (editorState, _, __) {

View File

@ -16,6 +16,7 @@ import 'package:intl/message_lookup_by_library.dart';
import 'package:intl/src/intl_helpers.dart';
import 'messages_ca.dart' as messages_ca;
import 'messages_cs-CZ.dart' as messages_cs_cz;
import 'messages_de-DE.dart' as messages_de_de;
import 'messages_en.dart' as messages_en;
import 'messages_es-VE.dart' as messages_es_ve;
@ -25,6 +26,7 @@ import 'messages_hu-HU.dart' as messages_hu_hu;
import 'messages_id-ID.dart' as messages_id_id;
import 'messages_it-IT.dart' as messages_it_it;
import 'messages_ja-JP.dart' as messages_ja_jp;
import 'messages_nl-NL.dart' as messages_nl_nl;
import 'messages_pl-PL.dart' as messages_pl_pl;
import 'messages_pt-BR.dart' as messages_pt_br;
import 'messages_pt-PT.dart' as messages_pt_pt;
@ -36,6 +38,7 @@ import 'messages_zh-TW.dart' as messages_zh_tw;
typedef Future<dynamic> LibraryLoader();
Map<String, LibraryLoader> _deferredLibraries = {
'ca': () => new Future.value(null),
'cs_CZ': () => new Future.value(null),
'de_DE': () => new Future.value(null),
'en': () => new Future.value(null),
'es_VE': () => new Future.value(null),
@ -45,6 +48,7 @@ Map<String, LibraryLoader> _deferredLibraries = {
'id_ID': () => new Future.value(null),
'it_IT': () => new Future.value(null),
'ja_JP': () => new Future.value(null),
'nl_NL': () => new Future.value(null),
'pl_PL': () => new Future.value(null),
'pt_BR': () => new Future.value(null),
'pt_PT': () => new Future.value(null),
@ -58,6 +62,8 @@ MessageLookupByLibrary? _findExact(String localeName) {
switch (localeName) {
case 'ca':
return messages_ca.messages;
case 'cs_CZ':
return messages_cs_cz.messages;
case 'de_DE':
return messages_de_de.messages;
case 'en':
@ -76,6 +82,8 @@ MessageLookupByLibrary? _findExact(String localeName) {
return messages_it_it.messages;
case 'ja_JP':
return messages_ja_jp.messages;
case 'nl_NL':
return messages_nl_nl.messages;
case 'pl_PL':
return messages_pl_pl.messages;
case 'pt_BR':

View File

@ -0,0 +1,44 @@
// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart
// This is a library that provides messages for a cs_CZ locale. All the
// messages from the main program should be duplicated here with the same
// function name.
// Ignore issues from commonly used lints in this file.
// ignore_for_file:unnecessary_brace_in_string_interps, unnecessary_new
// ignore_for_file:prefer_single_quotes,comment_references, directives_ordering
// ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases
// ignore_for_file:unused_import, file_names, avoid_escaping_inner_quotes
// ignore_for_file:unnecessary_string_interpolations, unnecessary_string_escapes
import 'package:intl/intl.dart';
import 'package:intl/message_lookup_by_library.dart';
final messages = new MessageLookup();
typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
class MessageLookup extends MessageLookupByLibrary {
String get localeName => 'cs_CZ';
final messages = _notInlinedMessages(_notInlinedMessages);
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
"bold": MessageLookupByLibrary.simpleMessage("Tučně"),
"bulletedList":
MessageLookupByLibrary.simpleMessage("Odrážkový seznam"),
"checkbox": MessageLookupByLibrary.simpleMessage("Zaškrtávací políčko"),
"embedCode": MessageLookupByLibrary.simpleMessage("Vložit kód"),
"heading1": MessageLookupByLibrary.simpleMessage("Nadpis 1"),
"heading2": MessageLookupByLibrary.simpleMessage("Nadpis 2"),
"heading3": MessageLookupByLibrary.simpleMessage("Nadpis 3"),
"highlight": MessageLookupByLibrary.simpleMessage("Zvýraznění"),
"image": MessageLookupByLibrary.simpleMessage("Obrázek"),
"italic": MessageLookupByLibrary.simpleMessage("Kurzíva"),
"link": MessageLookupByLibrary.simpleMessage("Odkaz"),
"numberedList":
MessageLookupByLibrary.simpleMessage("Číslovaný seznam"),
"quote": MessageLookupByLibrary.simpleMessage("Citace"),
"strikethrough": MessageLookupByLibrary.simpleMessage("Přeškrtnutí"),
"text": MessageLookupByLibrary.simpleMessage("Text"),
"underline": MessageLookupByLibrary.simpleMessage("Podtržení")
};
}

View File

@ -22,21 +22,21 @@ class MessageLookup extends MessageLookupByLibrary {
final messages = _notInlinedMessages(_notInlinedMessages);
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
"bold": MessageLookupByLibrary.simpleMessage(""),
"bulletedList": MessageLookupByLibrary.simpleMessage(""),
"checkbox": MessageLookupByLibrary.simpleMessage(""),
"embedCode": MessageLookupByLibrary.simpleMessage(""),
"heading1": MessageLookupByLibrary.simpleMessage(""),
"heading2": MessageLookupByLibrary.simpleMessage(""),
"heading3": MessageLookupByLibrary.simpleMessage(""),
"highlight": MessageLookupByLibrary.simpleMessage(""),
"image": MessageLookupByLibrary.simpleMessage(""),
"italic": MessageLookupByLibrary.simpleMessage(""),
"link": MessageLookupByLibrary.simpleMessage(""),
"numberedList": MessageLookupByLibrary.simpleMessage(""),
"quote": MessageLookupByLibrary.simpleMessage(""),
"strikethrough": MessageLookupByLibrary.simpleMessage(""),
"text": MessageLookupByLibrary.simpleMessage(""),
"underline": MessageLookupByLibrary.simpleMessage("")
"bold": MessageLookupByLibrary.simpleMessage("Gras"),
"bulletedList": MessageLookupByLibrary.simpleMessage("List à puces"),
"checkbox": MessageLookupByLibrary.simpleMessage("Case à cocher"),
"embedCode": MessageLookupByLibrary.simpleMessage("Incorporer code"),
"heading1": MessageLookupByLibrary.simpleMessage("Titre 1"),
"heading2": MessageLookupByLibrary.simpleMessage("Titre 2"),
"heading3": MessageLookupByLibrary.simpleMessage("Titre 3"),
"highlight": MessageLookupByLibrary.simpleMessage("Surligné"),
"image": MessageLookupByLibrary.simpleMessage("Image"),
"italic": MessageLookupByLibrary.simpleMessage("Italique"),
"link": MessageLookupByLibrary.simpleMessage("Lien"),
"numberedList": MessageLookupByLibrary.simpleMessage("Liste numérotée"),
"quote": MessageLookupByLibrary.simpleMessage("Citation"),
"strikethrough": MessageLookupByLibrary.simpleMessage("Barré"),
"text": MessageLookupByLibrary.simpleMessage("Texte"),
"underline": MessageLookupByLibrary.simpleMessage("Souligné")
};
}

View File

@ -22,21 +22,21 @@ class MessageLookup extends MessageLookupByLibrary {
final messages = _notInlinedMessages(_notInlinedMessages);
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
"bold": MessageLookupByLibrary.simpleMessage(""),
"bulletedList": MessageLookupByLibrary.simpleMessage(""),
"checkbox": MessageLookupByLibrary.simpleMessage(""),
"embedCode": MessageLookupByLibrary.simpleMessage(""),
"heading1": MessageLookupByLibrary.simpleMessage(""),
"heading2": MessageLookupByLibrary.simpleMessage(""),
"heading3": MessageLookupByLibrary.simpleMessage(""),
"highlight": MessageLookupByLibrary.simpleMessage(""),
"image": MessageLookupByLibrary.simpleMessage(""),
"italic": MessageLookupByLibrary.simpleMessage(""),
"link": MessageLookupByLibrary.simpleMessage(""),
"numberedList": MessageLookupByLibrary.simpleMessage(""),
"quote": MessageLookupByLibrary.simpleMessage(""),
"strikethrough": MessageLookupByLibrary.simpleMessage(""),
"text": MessageLookupByLibrary.simpleMessage(""),
"underline": MessageLookupByLibrary.simpleMessage("")
"bold": MessageLookupByLibrary.simpleMessage("Grassetto"),
"bulletedList": MessageLookupByLibrary.simpleMessage("Elenco puntato"),
"checkbox": MessageLookupByLibrary.simpleMessage("Casella di spunta"),
"embedCode": MessageLookupByLibrary.simpleMessage("Incorpora codice"),
"heading1": MessageLookupByLibrary.simpleMessage("H1"),
"heading2": MessageLookupByLibrary.simpleMessage("H2"),
"heading3": MessageLookupByLibrary.simpleMessage("H3"),
"highlight": MessageLookupByLibrary.simpleMessage("Evidenzia"),
"image": MessageLookupByLibrary.simpleMessage("Immagine"),
"italic": MessageLookupByLibrary.simpleMessage("Corsivo"),
"link": MessageLookupByLibrary.simpleMessage("Collegamento"),
"numberedList": MessageLookupByLibrary.simpleMessage("Elenco numerato"),
"quote": MessageLookupByLibrary.simpleMessage("Cita"),
"strikethrough": MessageLookupByLibrary.simpleMessage("Barrato"),
"text": MessageLookupByLibrary.simpleMessage("Testo"),
"underline": MessageLookupByLibrary.simpleMessage("Sottolineato")
};
}

View File

@ -0,0 +1,43 @@
// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart
// This is a library that provides messages for a nl_NL locale. All the
// messages from the main program should be duplicated here with the same
// function name.
// Ignore issues from commonly used lints in this file.
// ignore_for_file:unnecessary_brace_in_string_interps, unnecessary_new
// ignore_for_file:prefer_single_quotes,comment_references, directives_ordering
// ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases
// ignore_for_file:unused_import, file_names, avoid_escaping_inner_quotes
// ignore_for_file:unnecessary_string_interpolations, unnecessary_string_escapes
import 'package:intl/intl.dart';
import 'package:intl/message_lookup_by_library.dart';
final messages = new MessageLookup();
typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
class MessageLookup extends MessageLookupByLibrary {
String get localeName => 'nl_NL';
final messages = _notInlinedMessages(_notInlinedMessages);
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
"bold": MessageLookupByLibrary.simpleMessage("Vet"),
"bulletedList":
MessageLookupByLibrary.simpleMessage("Opsommingstekens"),
"checkbox": MessageLookupByLibrary.simpleMessage("Selectievakje"),
"embedCode": MessageLookupByLibrary.simpleMessage("Invoegcode"),
"heading1": MessageLookupByLibrary.simpleMessage("H1"),
"heading2": MessageLookupByLibrary.simpleMessage("H2"),
"heading3": MessageLookupByLibrary.simpleMessage("H3"),
"highlight": MessageLookupByLibrary.simpleMessage("Highlight"),
"image": MessageLookupByLibrary.simpleMessage("Afbeelding"),
"italic": MessageLookupByLibrary.simpleMessage("Cursief"),
"link": MessageLookupByLibrary.simpleMessage(""),
"numberedList": MessageLookupByLibrary.simpleMessage("Nummering"),
"quote": MessageLookupByLibrary.simpleMessage("Quote"),
"strikethrough": MessageLookupByLibrary.simpleMessage("Doorhalen"),
"text": MessageLookupByLibrary.simpleMessage("Tekst"),
"underline": MessageLookupByLibrary.simpleMessage("Onderstrepen")
};
}

View File

@ -22,21 +22,22 @@ class MessageLookup extends MessageLookupByLibrary {
final messages = _notInlinedMessages(_notInlinedMessages);
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
"bold": MessageLookupByLibrary.simpleMessage(""),
"bulletedList": MessageLookupByLibrary.simpleMessage(""),
"checkbox": MessageLookupByLibrary.simpleMessage(""),
"embedCode": MessageLookupByLibrary.simpleMessage(""),
"heading1": MessageLookupByLibrary.simpleMessage(""),
"heading2": MessageLookupByLibrary.simpleMessage(""),
"heading3": MessageLookupByLibrary.simpleMessage(""),
"highlight": MessageLookupByLibrary.simpleMessage(""),
"image": MessageLookupByLibrary.simpleMessage(""),
"italic": MessageLookupByLibrary.simpleMessage(""),
"link": MessageLookupByLibrary.simpleMessage(""),
"numberedList": MessageLookupByLibrary.simpleMessage(""),
"quote": MessageLookupByLibrary.simpleMessage(""),
"strikethrough": MessageLookupByLibrary.simpleMessage(""),
"text": MessageLookupByLibrary.simpleMessage(""),
"underline": MessageLookupByLibrary.simpleMessage("")
"bold": MessageLookupByLibrary.simpleMessage("Negrito"),
"bulletedList":
MessageLookupByLibrary.simpleMessage("Lista de marcadores"),
"checkbox": MessageLookupByLibrary.simpleMessage("Caixa de seleção"),
"embedCode": MessageLookupByLibrary.simpleMessage("Código incorporado"),
"heading1": MessageLookupByLibrary.simpleMessage("H1"),
"heading2": MessageLookupByLibrary.simpleMessage("H2"),
"heading3": MessageLookupByLibrary.simpleMessage("H3"),
"highlight": MessageLookupByLibrary.simpleMessage("Destacar"),
"image": MessageLookupByLibrary.simpleMessage("Imagem"),
"italic": MessageLookupByLibrary.simpleMessage("Itálico"),
"link": MessageLookupByLibrary.simpleMessage("Link"),
"numberedList": MessageLookupByLibrary.simpleMessage("Lista numerada"),
"quote": MessageLookupByLibrary.simpleMessage("Citar"),
"strikethrough": MessageLookupByLibrary.simpleMessage("Rasurar"),
"text": MessageLookupByLibrary.simpleMessage("Texto"),
"underline": MessageLookupByLibrary.simpleMessage("Sublinhar")
};
}

View File

@ -220,6 +220,7 @@ class AppLocalizationDelegate
return const <Locale>[
Locale.fromSubtags(languageCode: 'en'),
Locale.fromSubtags(languageCode: 'ca'),
Locale.fromSubtags(languageCode: 'cs', countryCode: 'CZ'),
Locale.fromSubtags(languageCode: 'de', countryCode: 'DE'),
Locale.fromSubtags(languageCode: 'es', countryCode: 'VE'),
Locale.fromSubtags(languageCode: 'fr', countryCode: 'CA'),
@ -228,6 +229,7 @@ class AppLocalizationDelegate
Locale.fromSubtags(languageCode: 'id', countryCode: 'ID'),
Locale.fromSubtags(languageCode: 'it', countryCode: 'IT'),
Locale.fromSubtags(languageCode: 'ja', countryCode: 'JP'),
Locale.fromSubtags(languageCode: 'nl', countryCode: 'NL'),
Locale.fromSubtags(languageCode: 'pl', countryCode: 'PL'),
Locale.fromSubtags(languageCode: 'pt', countryCode: 'BR'),
Locale.fromSubtags(languageCode: 'pt', countryCode: 'PT'),

View File

@ -1,7 +1,6 @@
import 'package:appflowy_editor/appflowy_editor.dart';
import 'package:appflowy_editor/src/render/selection_menu/selection_menu_item_widget.dart';
import 'package:appflowy_editor/src/render/selection_menu/selection_menu_service.dart';
import 'package:appflowy_editor/src/render/selection_menu/selection_menu_widget.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import '../../infra/test_editor.dart';
@ -13,8 +12,8 @@ void main() async {
group('selection_menu_widget.dart', () {
for (var i = 0; i < defaultSelectionMenuItems.length; i += 1) {
testWidgets('Selects number.$i item in selection menu with enter', (
tester) async {
testWidgets('Selects number.$i item in selection menu with enter',
(tester) async {
final editor = await _prepare(tester);
for (var j = 0; j < i; j++) {
await editor.pressLogicKey(LogicalKeyboardKey.arrowDown);
@ -30,8 +29,8 @@ void main() async {
}
});
testWidgets('Selects number.$i item in selection menu with click', (
tester) async {
testWidgets('Selects number.$i item in selection menu with click',
(tester) async {
final editor = await _prepare(tester);
await tester.tap(find.byType(SelectionMenuItemWidget).at(i));
@ -59,7 +58,7 @@ void main() async {
await editor.pressLogicKey(LogicalKeyboardKey.backspace);
expect(
find.byType(SelectionMenuItemWidget, skipOffstage: false),
findsNWidgets(4),
findsNWidgets(5),
);
await editor.pressLogicKey(LogicalKeyboardKey.keyE);
expect(
@ -148,7 +147,8 @@ Future<void> _testDefaultSelectionMenuItems(
int index, EditorWidgetTester editor) async {
expect(editor.documentLength, 4);
expect(editor.documentSelection, Selection.single(path: [2], startOffset: 0));
expect((editor.nodeAtPath([1]) as TextNode).toRawString(), 'Welcome to Appflowy 😁');
expect((editor.nodeAtPath([1]) as TextNode).toRawString(),
'Welcome to Appflowy 😁');
final node = editor.nodeAtPath([2]);
final item = defaultSelectionMenuItems[index];
final itemName = item.name();