mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
chore: enable more editor text to be translated (#4426)
This commit is contained in:
parent
47d321b8c2
commit
3171712380
@ -39,17 +39,12 @@ class _DocumentPageState extends State<DocumentPage> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
// The appflowy editor use Intl as localization, set the default language as fallback.
|
|
||||||
Intl.defaultLocale = 'en_US';
|
|
||||||
|
|
||||||
EditorNotification.addListener(_onEditorNotification);
|
EditorNotification.addListener(_onEditorNotification);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
EditorNotification.removeListener(_onEditorNotification);
|
EditorNotification.removeListener(_onEditorNotification);
|
||||||
|
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
|
import 'package:appflowy/generated/locale_keys.g.dart';
|
||||||
import 'package:appflowy/plugins/document/presentation/editor_plugins/plugins.dart';
|
import 'package:appflowy/plugins/document/presentation/editor_plugins/plugins.dart';
|
||||||
import 'package:appflowy_editor/appflowy_editor.dart';
|
import 'package:appflowy_editor/appflowy_editor.dart';
|
||||||
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
final List<CommandShortcutEvent> customTextAlignCommands = [
|
final List<CommandShortcutEvent> customTextAlignCommands = [
|
||||||
@ -19,7 +21,7 @@ final List<CommandShortcutEvent> customTextAlignCommands = [
|
|||||||
final CommandShortcutEvent customTextLeftAlignCommand = CommandShortcutEvent(
|
final CommandShortcutEvent customTextLeftAlignCommand = CommandShortcutEvent(
|
||||||
key: 'Align text to the left',
|
key: 'Align text to the left',
|
||||||
command: 'ctrl+shift+l',
|
command: 'ctrl+shift+l',
|
||||||
getDescription: () => 'Align text to the left',
|
getDescription: LocaleKeys.settings_shortcuts_commands_textAlignLeft.tr,
|
||||||
handler: (editorState) => _textAlignHandler(editorState, leftAlignmentKey),
|
handler: (editorState) => _textAlignHandler(editorState, leftAlignmentKey),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -34,7 +36,7 @@ final CommandShortcutEvent customTextLeftAlignCommand = CommandShortcutEvent(
|
|||||||
final CommandShortcutEvent customTextCenterAlignCommand = CommandShortcutEvent(
|
final CommandShortcutEvent customTextCenterAlignCommand = CommandShortcutEvent(
|
||||||
key: 'Align text to the center',
|
key: 'Align text to the center',
|
||||||
command: 'ctrl+shift+e',
|
command: 'ctrl+shift+e',
|
||||||
getDescription: () => 'Align text to the center',
|
getDescription: LocaleKeys.settings_shortcuts_commands_textAlignCenter.tr,
|
||||||
handler: (editorState) => _textAlignHandler(editorState, centerAlignmentKey),
|
handler: (editorState) => _textAlignHandler(editorState, centerAlignmentKey),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -49,7 +51,7 @@ final CommandShortcutEvent customTextCenterAlignCommand = CommandShortcutEvent(
|
|||||||
final CommandShortcutEvent customTextRightAlignCommand = CommandShortcutEvent(
|
final CommandShortcutEvent customTextRightAlignCommand = CommandShortcutEvent(
|
||||||
key: 'Align text to the right',
|
key: 'Align text to the right',
|
||||||
command: 'ctrl+shift+r',
|
command: 'ctrl+shift+r',
|
||||||
getDescription: () => 'Align text to the right',
|
getDescription: LocaleKeys.settings_shortcuts_commands_textAlignRight.tr,
|
||||||
handler: (editorState) => _textAlignHandler(editorState, rightAlignmentKey),
|
handler: (editorState) => _textAlignHandler(editorState, rightAlignmentKey),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
|
import 'package:appflowy/generated/locale_keys.g.dart' show LocaleKeys;
|
||||||
import 'package:appflowy/generated/locale_keys.g.dart';
|
import 'package:appflowy/generated/locale_keys.g.dart';
|
||||||
import 'package:appflowy_editor/appflowy_editor.dart';
|
import 'package:appflowy_editor/appflowy_editor.dart';
|
||||||
|
import 'package:easy_localization/easy_localization.dart'
|
||||||
|
show StringTranslateExtension;
|
||||||
import 'package:easy_localization/easy_localization.dart' hide TextDirection;
|
import 'package:easy_localization/easy_localization.dart' hide TextDirection;
|
||||||
import 'package:flowy_infra/theme_extension.dart';
|
import 'package:flowy_infra/theme_extension.dart';
|
||||||
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
||||||
@ -49,7 +52,7 @@ Node calloutNode({
|
|||||||
|
|
||||||
// defining the callout block menu item in selection menu
|
// defining the callout block menu item in selection menu
|
||||||
SelectionMenuItem calloutItem = SelectionMenuItem.node(
|
SelectionMenuItem calloutItem = SelectionMenuItem.node(
|
||||||
getName: () => LocaleKeys.document_plugins_callout.tr(),
|
getName: LocaleKeys.document_plugins_callout.tr,
|
||||||
iconData: Icons.note,
|
iconData: Icons.note,
|
||||||
keywords: [CalloutBlockKeys.type],
|
keywords: [CalloutBlockKeys.type],
|
||||||
nodeBuilder: (editorState, context) =>
|
nodeBuilder: (editorState, context) =>
|
||||||
|
@ -107,7 +107,7 @@ Node codeBlockNode({
|
|||||||
|
|
||||||
// defining the callout block menu item for selection
|
// defining the callout block menu item for selection
|
||||||
SelectionMenuItem codeBlockItem = SelectionMenuItem.node(
|
SelectionMenuItem codeBlockItem = SelectionMenuItem.node(
|
||||||
getName: () => LocaleKeys.document_selectionMenu_codeBlock.tr(),
|
getName: LocaleKeys.document_selectionMenu_codeBlock.tr,
|
||||||
iconData: Icons.abc,
|
iconData: Icons.abc,
|
||||||
keywords: ['code', 'codeblock'],
|
keywords: ['code', 'codeblock'],
|
||||||
nodeBuilder: (editorState, _) => codeBlockNode(),
|
nodeBuilder: (editorState, _) => codeBlockNode(),
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
|
import 'package:appflowy/generated/locale_keys.g.dart';
|
||||||
import 'package:appflowy/plugins/document/presentation/editor_plugins/plugins.dart';
|
import 'package:appflowy/plugins/document/presentation/editor_plugins/plugins.dart';
|
||||||
import 'package:appflowy_editor/appflowy_editor.dart';
|
import 'package:appflowy_editor/appflowy_editor.dart';
|
||||||
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
final List<CharacterShortcutEvent> codeBlockCharacterEvents = [
|
final List<CharacterShortcutEvent> codeBlockCharacterEvents = [
|
||||||
@ -59,7 +61,8 @@ final CommandShortcutEvent insertNewParagraphNextToCodeBlockCommand =
|
|||||||
CommandShortcutEvent(
|
CommandShortcutEvent(
|
||||||
key: 'insert a new paragraph next to the code block',
|
key: 'insert a new paragraph next to the code block',
|
||||||
command: 'shift+enter',
|
command: 'shift+enter',
|
||||||
getDescription: () => 'Insert a new paragraph next to the code block',
|
getDescription:
|
||||||
|
LocaleKeys.settings_shortcuts_commands_codeBlockNewParagraph.tr,
|
||||||
handler: _insertNewParagraphNextToCodeBlockCommandHandler,
|
handler: _insertNewParagraphNextToCodeBlockCommandHandler,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -72,7 +75,8 @@ final CommandShortcutEvent tabToInsertSpacesInCodeBlockCommand =
|
|||||||
CommandShortcutEvent(
|
CommandShortcutEvent(
|
||||||
key: 'tab to insert two spaces at the line start in code block',
|
key: 'tab to insert two spaces at the line start in code block',
|
||||||
command: 'tab',
|
command: 'tab',
|
||||||
getDescription: () => 'Insert two spaces at the line start in code block',
|
getDescription:
|
||||||
|
LocaleKeys.settings_shortcuts_commands_codeBlockAddTwoSpaces.tr,
|
||||||
handler: _tabToInsertSpacesInCodeBlockCommandHandler,
|
handler: _tabToInsertSpacesInCodeBlockCommandHandler,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -85,7 +89,8 @@ final CommandShortcutEvent tabToDeleteSpacesInCodeBlockCommand =
|
|||||||
CommandShortcutEvent(
|
CommandShortcutEvent(
|
||||||
key: 'shift + tab to delete two spaces at the line start in code block',
|
key: 'shift + tab to delete two spaces at the line start in code block',
|
||||||
command: 'shift+tab',
|
command: 'shift+tab',
|
||||||
getDescription: () => 'Delete two spaces at the line start in code block',
|
getDescription:
|
||||||
|
LocaleKeys.settings_shortcuts_commands_codeBlockDeleteTwoSpaces.tr,
|
||||||
handler: _tabToDeleteSpacesInCodeBlockCommandHandler,
|
handler: _tabToDeleteSpacesInCodeBlockCommandHandler,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -98,7 +103,7 @@ final CommandShortcutEvent selectAllInCodeBlockCommand = CommandShortcutEvent(
|
|||||||
key: 'ctrl + a to select all content inside a code block',
|
key: 'ctrl + a to select all content inside a code block',
|
||||||
command: 'ctrl+a',
|
command: 'ctrl+a',
|
||||||
macOSCommand: 'meta+a',
|
macOSCommand: 'meta+a',
|
||||||
getDescription: () => 'Select all content inside a code block',
|
getDescription: LocaleKeys.settings_shortcuts_commands_codeBlockSelectAll.tr,
|
||||||
handler: _selectAllInCodeBlockCommandHandler,
|
handler: _selectAllInCodeBlockCommandHandler,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -111,7 +116,7 @@ final CommandShortcutEvent pasteInCodeblock = CommandShortcutEvent(
|
|||||||
key: 'paste in codeblock',
|
key: 'paste in codeblock',
|
||||||
command: 'ctrl+v',
|
command: 'ctrl+v',
|
||||||
macOSCommand: 'cmd+v',
|
macOSCommand: 'cmd+v',
|
||||||
getDescription: () => 'Paste text in codeblock',
|
getDescription: LocaleKeys.settings_shortcuts_commands_codeBlockPasteText.tr,
|
||||||
handler: _pasteInCodeBlock,
|
handler: _pasteInCodeBlock,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -6,15 +6,15 @@ import 'package:easy_localization/easy_localization.dart';
|
|||||||
final List<List<ContextMenuItem>> customContextMenuItems = [
|
final List<List<ContextMenuItem>> customContextMenuItems = [
|
||||||
[
|
[
|
||||||
ContextMenuItem(
|
ContextMenuItem(
|
||||||
getName: () => LocaleKeys.document_plugins_contextMenu_copy.tr(),
|
getName: LocaleKeys.document_plugins_contextMenu_copy.tr,
|
||||||
onPressed: (editorState) => customCopyCommand.execute(editorState),
|
onPressed: (editorState) => customCopyCommand.execute(editorState),
|
||||||
),
|
),
|
||||||
ContextMenuItem(
|
ContextMenuItem(
|
||||||
getName: () => LocaleKeys.document_plugins_contextMenu_paste.tr(),
|
getName: LocaleKeys.document_plugins_contextMenu_paste.tr,
|
||||||
onPressed: (editorState) => customPasteCommand.execute(editorState),
|
onPressed: (editorState) => customPasteCommand.execute(editorState),
|
||||||
),
|
),
|
||||||
ContextMenuItem(
|
ContextMenuItem(
|
||||||
getName: () => LocaleKeys.document_plugins_contextMenu_cut.tr(),
|
getName: LocaleKeys.document_plugins_contextMenu_cut.tr,
|
||||||
onPressed: (editorState) => customCutCommand.execute(editorState),
|
onPressed: (editorState) => customCutCommand.execute(editorState),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -13,8 +13,8 @@ import 'package:flutter/material.dart';
|
|||||||
/// - mobile
|
/// - mobile
|
||||||
///
|
///
|
||||||
final CommandShortcutEvent customCopyCommand = CommandShortcutEvent(
|
final CommandShortcutEvent customCopyCommand = CommandShortcutEvent(
|
||||||
key: 'copy the selected content (with formatting)',
|
key: 'copy the selected content',
|
||||||
getDescription: () => 'copy the selected content (with formatting)',
|
getDescription: () => AppFlowyEditorL10n.current.cmdCopySelection,
|
||||||
command: 'ctrl+c',
|
command: 'ctrl+c',
|
||||||
macOSCommand: 'cmd+c',
|
macOSCommand: 'cmd+c',
|
||||||
handler: _copyCommandHandler,
|
handler: _copyCommandHandler,
|
||||||
|
@ -11,8 +11,8 @@ import 'package:flutter/material.dart';
|
|||||||
/// - mobile
|
/// - mobile
|
||||||
///
|
///
|
||||||
final CommandShortcutEvent customCutCommand = CommandShortcutEvent(
|
final CommandShortcutEvent customCutCommand = CommandShortcutEvent(
|
||||||
key: 'cut the selected content (with formatting)',
|
key: 'cut the selected content',
|
||||||
getDescription: () => 'cut the selected content (with formatting)',
|
getDescription: () => AppFlowyEditorL10n.current.cmdCutSelection,
|
||||||
command: 'ctrl+x',
|
command: 'ctrl+x',
|
||||||
macOSCommand: 'cmd+x',
|
macOSCommand: 'cmd+x',
|
||||||
handler: _cutCommandHandler,
|
handler: _cutCommandHandler,
|
||||||
|
@ -18,8 +18,8 @@ import 'package:string_validator/string_validator.dart';
|
|||||||
/// - mobile
|
/// - mobile
|
||||||
///
|
///
|
||||||
final CommandShortcutEvent customPasteCommand = CommandShortcutEvent(
|
final CommandShortcutEvent customPasteCommand = CommandShortcutEvent(
|
||||||
key: 'paste the content (with formatting)',
|
key: 'paste the content',
|
||||||
getDescription: () => 'paste the content (with formatting)',
|
getDescription: () => AppFlowyEditorL10n.current.cmdPasteContent,
|
||||||
command: 'ctrl+v',
|
command: 'ctrl+v',
|
||||||
macOSCommand: 'cmd+v',
|
macOSCommand: 'cmd+v',
|
||||||
handler: _pasteCommandHandler,
|
handler: _pasteCommandHandler,
|
||||||
|
@ -10,7 +10,7 @@ import 'package:easy_localization/easy_localization.dart';
|
|||||||
|
|
||||||
SelectionMenuItem inlineGridMenuItem(DocumentBloc documentBloc) =>
|
SelectionMenuItem inlineGridMenuItem(DocumentBloc documentBloc) =>
|
||||||
SelectionMenuItem(
|
SelectionMenuItem(
|
||||||
getName: () => LocaleKeys.document_slashMenu_grid_createANewGrid.tr(),
|
getName: LocaleKeys.document_slashMenu_grid_createANewGrid.tr,
|
||||||
icon: (editorState, onSelected, style) => SelectableSvgWidget(
|
icon: (editorState, onSelected, style) => SelectableSvgWidget(
|
||||||
data: FlowySvgs.grid_s,
|
data: FlowySvgs.grid_s,
|
||||||
isSelected: onSelected,
|
isSelected: onSelected,
|
||||||
@ -31,7 +31,7 @@ SelectionMenuItem inlineGridMenuItem(DocumentBloc documentBloc) =>
|
|||||||
|
|
||||||
SelectionMenuItem inlineBoardMenuItem(DocumentBloc documentBloc) =>
|
SelectionMenuItem inlineBoardMenuItem(DocumentBloc documentBloc) =>
|
||||||
SelectionMenuItem(
|
SelectionMenuItem(
|
||||||
getName: () => LocaleKeys.document_slashMenu_board_createANewBoard.tr(),
|
getName: LocaleKeys.document_slashMenu_board_createANewBoard.tr,
|
||||||
icon: (editorState, onSelected, style) => SelectableSvgWidget(
|
icon: (editorState, onSelected, style) => SelectableSvgWidget(
|
||||||
data: FlowySvgs.board_s,
|
data: FlowySvgs.board_s,
|
||||||
isSelected: onSelected,
|
isSelected: onSelected,
|
||||||
@ -52,8 +52,7 @@ SelectionMenuItem inlineBoardMenuItem(DocumentBloc documentBloc) =>
|
|||||||
|
|
||||||
SelectionMenuItem inlineCalendarMenuItem(DocumentBloc documentBloc) =>
|
SelectionMenuItem inlineCalendarMenuItem(DocumentBloc documentBloc) =>
|
||||||
SelectionMenuItem(
|
SelectionMenuItem(
|
||||||
getName: () =>
|
getName: LocaleKeys.document_slashMenu_calendar_createANewCalendar.tr,
|
||||||
LocaleKeys.document_slashMenu_calendar_createANewCalendar.tr(),
|
|
||||||
icon: (editorState, onSelected, style) => SelectableSvgWidget(
|
icon: (editorState, onSelected, style) => SelectableSvgWidget(
|
||||||
data: FlowySvgs.date_s,
|
data: FlowySvgs.date_s,
|
||||||
isSelected: onSelected,
|
isSelected: onSelected,
|
||||||
|
@ -9,7 +9,7 @@ import 'package:easy_localization/easy_localization.dart';
|
|||||||
// Document Reference
|
// Document Reference
|
||||||
|
|
||||||
SelectionMenuItem referencedDocumentMenuItem = SelectionMenuItem(
|
SelectionMenuItem referencedDocumentMenuItem = SelectionMenuItem(
|
||||||
getName: () => LocaleKeys.document_plugins_referencedDocument.tr(),
|
getName: LocaleKeys.document_plugins_referencedDocument.tr,
|
||||||
icon: (editorState, onSelected, style) => SelectableSvgWidget(
|
icon: (editorState, onSelected, style) => SelectableSvgWidget(
|
||||||
data: FlowySvgs.document_s,
|
data: FlowySvgs.document_s,
|
||||||
isSelected: onSelected,
|
isSelected: onSelected,
|
||||||
@ -23,7 +23,7 @@ SelectionMenuItem referencedDocumentMenuItem = SelectionMenuItem(
|
|||||||
// Database References
|
// Database References
|
||||||
|
|
||||||
SelectionMenuItem referencedGridMenuItem = SelectionMenuItem(
|
SelectionMenuItem referencedGridMenuItem = SelectionMenuItem(
|
||||||
getName: () => LocaleKeys.document_plugins_referencedGrid.tr(),
|
getName: LocaleKeys.document_plugins_referencedGrid.tr,
|
||||||
icon: (editorState, onSelected, style) => SelectableSvgWidget(
|
icon: (editorState, onSelected, style) => SelectableSvgWidget(
|
||||||
data: FlowySvgs.grid_s,
|
data: FlowySvgs.grid_s,
|
||||||
isSelected: onSelected,
|
isSelected: onSelected,
|
||||||
@ -35,7 +35,7 @@ SelectionMenuItem referencedGridMenuItem = SelectionMenuItem(
|
|||||||
);
|
);
|
||||||
|
|
||||||
SelectionMenuItem referencedBoardMenuItem = SelectionMenuItem(
|
SelectionMenuItem referencedBoardMenuItem = SelectionMenuItem(
|
||||||
getName: () => LocaleKeys.document_plugins_referencedBoard.tr(),
|
getName: LocaleKeys.document_plugins_referencedBoard.tr,
|
||||||
icon: (editorState, onSelected, style) => SelectableSvgWidget(
|
icon: (editorState, onSelected, style) => SelectableSvgWidget(
|
||||||
data: FlowySvgs.board_s,
|
data: FlowySvgs.board_s,
|
||||||
isSelected: onSelected,
|
isSelected: onSelected,
|
||||||
@ -47,7 +47,7 @@ SelectionMenuItem referencedBoardMenuItem = SelectionMenuItem(
|
|||||||
);
|
);
|
||||||
|
|
||||||
SelectionMenuItem referencedCalendarMenuItem = SelectionMenuItem(
|
SelectionMenuItem referencedCalendarMenuItem = SelectionMenuItem(
|
||||||
getName: () => LocaleKeys.document_plugins_referencedCalendar.tr(),
|
getName: LocaleKeys.document_plugins_referencedCalendar.tr,
|
||||||
icon: (editorState, onSelected, style) => SelectableSvgWidget(
|
icon: (editorState, onSelected, style) => SelectableSvgWidget(
|
||||||
data: FlowySvgs.date_s,
|
data: FlowySvgs.date_s,
|
||||||
isSelected: onSelected,
|
isSelected: onSelected,
|
||||||
|
@ -36,7 +36,7 @@ Node mathEquationNode({
|
|||||||
|
|
||||||
// defining the callout block menu item for selection
|
// defining the callout block menu item for selection
|
||||||
SelectionMenuItem mathEquationItem = SelectionMenuItem.node(
|
SelectionMenuItem mathEquationItem = SelectionMenuItem.node(
|
||||||
getName: () => LocaleKeys.document_plugins_mathEquation_name.tr(),
|
getName: LocaleKeys.document_plugins_mathEquation_name.tr,
|
||||||
iconData: Icons.text_fields_rounded,
|
iconData: Icons.text_fields_rounded,
|
||||||
keywords: ['tex, latex, katex', 'math equation', 'formula'],
|
keywords: ['tex, latex, katex', 'math equation', 'formula'],
|
||||||
nodeBuilder: (editorState, _) => mathEquationNode(),
|
nodeBuilder: (editorState, _) => mathEquationNode(),
|
||||||
|
@ -5,7 +5,7 @@ import 'package:appflowy_editor/appflowy_editor.dart';
|
|||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
|
|
||||||
SelectionMenuItem dateMenuItem = SelectionMenuItem(
|
SelectionMenuItem dateMenuItem = SelectionMenuItem(
|
||||||
getName: () => LocaleKeys.document_plugins_date.tr(),
|
getName: LocaleKeys.document_plugins_insertDate.tr,
|
||||||
icon: (_, isSelected, style) => FlowySvg(
|
icon: (_, isSelected, style) => FlowySvg(
|
||||||
FlowySvgs.date_s,
|
FlowySvgs.date_s,
|
||||||
color: isSelected
|
color: isSelected
|
||||||
|
@ -43,7 +43,7 @@ Node autoCompletionNode({
|
|||||||
}
|
}
|
||||||
|
|
||||||
SelectionMenuItem autoGeneratorMenuItem = SelectionMenuItem.node(
|
SelectionMenuItem autoGeneratorMenuItem = SelectionMenuItem.node(
|
||||||
getName: () => LocaleKeys.document_plugins_autoGeneratorMenuItemName.tr(),
|
getName: LocaleKeys.document_plugins_autoGeneratorMenuItemName.tr,
|
||||||
iconData: Icons.generating_tokens,
|
iconData: Icons.generating_tokens,
|
||||||
keywords: ['ai', 'openai' 'writer', 'autogenerator'],
|
keywords: ['ai', 'openai' 'writer', 'autogenerator'],
|
||||||
nodeBuilder: (editorState, _) {
|
nodeBuilder: (editorState, _) {
|
||||||
|
@ -19,7 +19,7 @@ class OutlineBlockKeys {
|
|||||||
|
|
||||||
// defining the callout block menu item for selection
|
// defining the callout block menu item for selection
|
||||||
SelectionMenuItem outlineItem = SelectionMenuItem.node(
|
SelectionMenuItem outlineItem = SelectionMenuItem.node(
|
||||||
getName: () => LocaleKeys.document_selectionMenu_outline.tr(),
|
getName: LocaleKeys.document_selectionMenu_outline.tr,
|
||||||
iconData: Icons.list_alt,
|
iconData: Icons.list_alt,
|
||||||
keywords: ['outline', 'table of contents'],
|
keywords: ['outline', 'table of contents'],
|
||||||
nodeBuilder: (editorState, _) => outlineBlockNode(),
|
nodeBuilder: (editorState, _) => outlineBlockNode(),
|
||||||
|
@ -46,7 +46,7 @@ Node toggleListBlockNode({
|
|||||||
|
|
||||||
// defining the toggle list block menu item
|
// defining the toggle list block menu item
|
||||||
SelectionMenuItem toggleListBlockItem = SelectionMenuItem.node(
|
SelectionMenuItem toggleListBlockItem = SelectionMenuItem.node(
|
||||||
getName: () => LocaleKeys.document_plugins_toggleList.tr(),
|
getName: LocaleKeys.document_plugins_toggleList.tr,
|
||||||
iconData: Icons.arrow_right,
|
iconData: Icons.arrow_right,
|
||||||
keywords: ['collapsed list', 'toggle list', 'list'],
|
keywords: ['collapsed list', 'toggle list', 'list'],
|
||||||
nodeBuilder: (editorState, _) => toggleListBlockNode(),
|
nodeBuilder: (editorState, _) => toggleListBlockNode(),
|
||||||
|
@ -110,7 +110,7 @@ CharacterShortcutEvent insertChildNodeInsideToggleList = CharacterShortcutEvent(
|
|||||||
// toggle the todo list
|
// toggle the todo list
|
||||||
final CommandShortcutEvent toggleToggleListCommand = CommandShortcutEvent(
|
final CommandShortcutEvent toggleToggleListCommand = CommandShortcutEvent(
|
||||||
key: 'toggle the toggle list',
|
key: 'toggle the toggle list',
|
||||||
getDescription: () => 'Toggle the toggle list',
|
getDescription: () => AppFlowyEditorL10n.current.cmdToggleTodoList,
|
||||||
command: 'ctrl+enter',
|
command: 'ctrl+enter',
|
||||||
macOSCommand: 'cmd+enter',
|
macOSCommand: 'cmd+enter',
|
||||||
handler: _toggleToggleListCommandHandler,
|
handler: _toggleToggleListCommandHandler,
|
||||||
|
@ -10,6 +10,8 @@ import 'package:appflowy/workspace/application/settings/appearance/base_appearan
|
|||||||
import 'package:appflowy_backend/log.dart';
|
import 'package:appflowy_backend/log.dart';
|
||||||
import 'package:appflowy_backend/protobuf/flowy-user/date_time.pbenum.dart';
|
import 'package:appflowy_backend/protobuf/flowy-user/date_time.pbenum.dart';
|
||||||
import 'package:appflowy_backend/protobuf/flowy-user/user_setting.pb.dart';
|
import 'package:appflowy_backend/protobuf/flowy-user/user_setting.pb.dart';
|
||||||
|
import 'package:appflowy_editor/appflowy_editor.dart'
|
||||||
|
show AppFlowyEditorLocalizations;
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:flowy_infra/theme.dart';
|
import 'package:flowy_infra/theme.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@ -193,6 +195,9 @@ class AppearanceSettingsCubit extends Cubit<AppearanceSettingsState> {
|
|||||||
Log.warn('Catch error in setLocale: $e}');
|
Log.warn('Catch error in setLocale: $e}');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Sync the app's locale with the editor (initialization and update)
|
||||||
|
AppFlowyEditorLocalizations.load(newLocale);
|
||||||
|
|
||||||
if (state.locale != newLocale) {
|
if (state.locale != newLocale) {
|
||||||
_appearanceSettings.locale.languageCode = newLocale.languageCode;
|
_appearanceSettings.locale.languageCode = newLocale.languageCode;
|
||||||
_appearanceSettings.locale.countryCode = newLocale.countryCode ?? "";
|
_appearanceSettings.locale.countryCode = newLocale.countryCode ?? "";
|
||||||
|
@ -39,8 +39,10 @@ class ShortcutsCubit extends Cubit<ShortcutsState> {
|
|||||||
commandShortcutEvents,
|
commandShortcutEvents,
|
||||||
customizeShortcuts,
|
customizeShortcuts,
|
||||||
);
|
);
|
||||||
|
|
||||||
//sort the shortcuts
|
//sort the shortcuts
|
||||||
commandShortcutEvents.sort((a, b) => a.key.compareTo(b.key));
|
commandShortcutEvents.sort((a, b) => a.key.compareTo(b.key));
|
||||||
|
|
||||||
emit(
|
emit(
|
||||||
state.copyWith(
|
state.copyWith(
|
||||||
status: ShortcutsStatus.success,
|
status: ShortcutsStatus.success,
|
||||||
|
@ -8,7 +8,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
SelectionMenuItem emojiMenuItem = SelectionMenuItem(
|
SelectionMenuItem emojiMenuItem = SelectionMenuItem(
|
||||||
getName: () => LocaleKeys.document_plugins_emoji.tr(),
|
getName: LocaleKeys.document_plugins_emoji.tr,
|
||||||
icon: (editorState, onSelected, style) => SelectableIconWidget(
|
icon: (editorState, onSelected, style) => SelectableIconWidget(
|
||||||
icon: Icons.emoji_emotions_outlined,
|
icon: Icons.emoji_emotions_outlined,
|
||||||
isSelected: onSelected,
|
isSelected: onSelected,
|
||||||
|
@ -117,7 +117,7 @@ class ShortcutsListTile extends StatelessWidget {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: FlowyText.medium(
|
child: FlowyText.medium(
|
||||||
key: Key(shortcutEvent.key),
|
key: Key(shortcutEvent.key),
|
||||||
shortcutEvent.key.capitalize(),
|
shortcutEvent.description!.capitalize(),
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -514,7 +514,17 @@
|
|||||||
"shortcutIsAlreadyUsed": "This shortcut is already used for: {conflict}",
|
"shortcutIsAlreadyUsed": "This shortcut is already used for: {conflict}",
|
||||||
"resetToDefault": "Reset to default keybindings",
|
"resetToDefault": "Reset to default keybindings",
|
||||||
"couldNotLoadErrorMsg": "Could not load shortcuts, Try again",
|
"couldNotLoadErrorMsg": "Could not load shortcuts, Try again",
|
||||||
"couldNotSaveErrorMsg": "Could not save shortcuts, Try again"
|
"couldNotSaveErrorMsg": "Could not save shortcuts, Try again",
|
||||||
|
"commands": {
|
||||||
|
"codeBlockNewParagraph": "Insert a new paragraph next to the code block",
|
||||||
|
"codeBlockAddTwoSpaces": "Insert two spaces at the line start in code block",
|
||||||
|
"codeBlockDeleteTwoSpaces": "Delete two spaces at the line start in code block",
|
||||||
|
"codeBlockSelectAll": "Select all content inside a code block",
|
||||||
|
"codeBlockPasteText": "Paste text in codeblock",
|
||||||
|
"textAlignLeft": "Align text to the left",
|
||||||
|
"textAlignCenter": "Align text to the center",
|
||||||
|
"textAlignRight": "Align text to the right"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"mobile": {
|
"mobile": {
|
||||||
"personalInfo": "Personal Information",
|
"personalInfo": "Personal Information",
|
||||||
@ -835,6 +845,8 @@
|
|||||||
"discardResponse": "Do you want to discard the AI responses?",
|
"discardResponse": "Do you want to discard the AI responses?",
|
||||||
"createInlineMathEquation": "Create equation",
|
"createInlineMathEquation": "Create equation",
|
||||||
"fonts": "Fonts",
|
"fonts": "Fonts",
|
||||||
|
"insertDate": "Insert date",
|
||||||
|
"emoji": "Emoji",
|
||||||
"toggleList": "Toggle list",
|
"toggleList": "Toggle list",
|
||||||
"quoteList": "Quote list",
|
"quoteList": "Quote list",
|
||||||
"numberedList": "Numbered list",
|
"numberedList": "Numbered list",
|
||||||
|
@ -434,7 +434,17 @@
|
|||||||
"shortcutIsAlreadyUsed": "Este atalho já é usado para: {conflict}",
|
"shortcutIsAlreadyUsed": "Este atalho já é usado para: {conflict}",
|
||||||
"resetToDefault": "Redefinir para atalhos de teclado padrão",
|
"resetToDefault": "Redefinir para atalhos de teclado padrão",
|
||||||
"couldNotLoadErrorMsg": "Não foi possível carregar os atalhos. Tente novamente",
|
"couldNotLoadErrorMsg": "Não foi possível carregar os atalhos. Tente novamente",
|
||||||
"couldNotSaveErrorMsg": "Não foi possível salvar os atalhos. Tente novamente"
|
"couldNotSaveErrorMsg": "Não foi possível salvar os atalhos. Tente novamente",
|
||||||
|
"commands": {
|
||||||
|
"codeBlockNewParagraph": "Bloco de código: insirir um novo parágrafo",
|
||||||
|
"codeBlockAddTwoSpaces": "Bloco de código: insirir dois espaços no início da linha",
|
||||||
|
"codeBlockDeleteTwoSpaces": "Bloco de código: excluir dois espaços no início da linha",
|
||||||
|
"codeBlockSelectAll": "Bloco de código: selecionar tudo",
|
||||||
|
"codeBlockPasteText": "Bloco de códito: Colar texto",
|
||||||
|
"textAlignLeft": "Alinhar texto à esquerda",
|
||||||
|
"textAlignCenter": "Alinhar texto ao centro",
|
||||||
|
"textAlignRight": "Alinhar texto à direita"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"mobile": {
|
"mobile": {
|
||||||
"personalInfo": "Informações pessoais",
|
"personalInfo": "Informações pessoais",
|
||||||
@ -677,9 +687,9 @@
|
|||||||
"codeBlock": "Bloco de código"
|
"codeBlock": "Bloco de código"
|
||||||
},
|
},
|
||||||
"plugins": {
|
"plugins": {
|
||||||
"referencedBoard": "Quadro vinculado",
|
"referencedBoard": "Quadro referenciado",
|
||||||
"referencedGrid": "Grade vinculado",
|
"referencedGrid": "Grade referenciada",
|
||||||
"referencedCalendar": "calendário referenciado",
|
"referencedCalendar": "Calendário referenciado",
|
||||||
"referencedDocument": "Referenciar um documento",
|
"referencedDocument": "Referenciar um documento",
|
||||||
"autoGeneratorMenuItemName": "Gerar nome automaticamente",
|
"autoGeneratorMenuItemName": "Gerar nome automaticamente",
|
||||||
"autoGeneratorTitleName": "Gerar por IA",
|
"autoGeneratorTitleName": "Gerar por IA",
|
||||||
@ -707,6 +717,8 @@
|
|||||||
"bulletedList": "Lista com marcadores",
|
"bulletedList": "Lista com marcadores",
|
||||||
"todoList": "Lista de afazeres",
|
"todoList": "Lista de afazeres",
|
||||||
"callout": "Destacar",
|
"callout": "Destacar",
|
||||||
|
"insertDate": "Inserir data",
|
||||||
|
"emoji": "Emoji",
|
||||||
"cover": {
|
"cover": {
|
||||||
"changeCover": "Mudar capa",
|
"changeCover": "Mudar capa",
|
||||||
"colors": "cores",
|
"colors": "cores",
|
||||||
|
Loading…
Reference in New Issue
Block a user