Skip to content

Commit

Permalink
chore: translate commands (#687)
Browse files Browse the repository at this point in the history
* feat: translate commands descriptions

* feat: allow for commands without description
  • Loading branch information
jpenna authored Jan 30, 2024
1 parent 7d8147c commit 84e5adc
Show file tree
Hide file tree
Showing 39 changed files with 958 additions and 108 deletions.
2 changes: 1 addition & 1 deletion documentation/translation.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class _HomePageState extends State<HomePage> {
void toggleLocale() {
final locale = Intl.getCurrentLocale();
if (locale == 'en_US') {
if (locale.startsWith('en')) {
// Change to the locale you want to test
AppFlowyEditorLocalizations.load(const Locale('pt', 'BR'));
} else {
Expand Down
68 changes: 60 additions & 8 deletions lib/l10n/intl_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,64 @@
"textAlignLeft": "Align Left",
"textAlignCenter": "Align Center",
"textAlignRight": "Align Right",
"cmdDontAddNewLineInTableCell": "Don't add new line in table cell",
"cmdMoveToLeftCellIfItsAtStartOfCurrentCell": "Move to left cell if its at start of current cell",
"cmdMoveToRightCellIfItsAtTheEndOfCurrentCell": "Move to right cell if its at the end of current cell",
"cmdMoveToUpCellAtSameOffset": "Move to up cell at same offset",
"cmdMoveToDownCellAtSameOffset": "Move to down cell at same offset",
"cmdNavigateAroundTheCellsAtSameOffset": "Navigate around the cells at same offset",
"cmdNavigateAroundTheCellsAtSameOffsetInReverse": "Navigate around the cells at same offset in reverse",
"cmdStopAtTheBeginningOfTheCell": "Stop at the beginning of the cell"
"cmdConvertToLink": "Convert to link",
"cmdConvertToParagraph": "convert to paragraph",
"cmdCopySelection": "Copy selection",
"cmdCutSelection": "Cut selection",
"cmdDeleteLeft": "Delete character to the left",
"cmdDeleteLineLeft": "Delete to beginning of line",
"cmdDeleteRight": "Delete character to the right",
"cmdDeleteWordLeft": "delete word at left",
"cmdDeleteWordRight": "delete word at right",
"cmdExitEditing": "exit editing mode",
"cmdIndent": "indent",
"cmdMoveCursorBottom": "move cursor to the bottom",
"cmdMoveCursorBottomSelect": "Select all until end of file",
"cmdMoveCursorDown": "move cursor down",
"cmdMoveCursorDownSelect": "Select downward",
"cmdMoveCursorLeft": "move cursor left",
"cmdMoveCursorLeftSelect": "Select left",
"cmdMoveCursorLineEnd": "move cursor to the end of line",
"cmdMoveCursorLineEndSelect": "Select to end of line",
"cmdMoveCursorLineStart": "move cursor to start of line",
"cmdMoveCursorLineStartSelect": "Select to start of line",
"cmdMoveCursorRight": "move cursor right",
"cmdMoveCursorRightSelect": "Select right",
"cmdMoveCursorTop": "move cursor to the top",
"cmdMoveCursorTopSelect": "Select all until start of file",
"cmdMoveCursorUp": "move cursor up",
"cmdMoveCursorUpSelect": "Select upward",
"cmdMoveCursorWordLeft": "move cursor to word on the left",
"cmdMoveCursorWordLeftSelect": "Select word to the left",
"cmdMoveCursorWordRight": "move cursor to word on the right",
"cmdMoveCursorWordRightSelect": "Select word to the right",
"cmdOpenFind": "Open Find",
"cmdOpenFindAndReplace": "Open Find and Replace",
"cmdOpenLink": "open link",
"cmdOpenLinks": "open links",
"cmdOutdent": "outdent",
"cmdPasteContent": "paste content",
"cmdPasteContentAsPlainText": "paste content as plain text",
"cmdRedo": "redo",
"cmdScrollPageDown": "scroll page down",
"cmdScrollPageUp": "scroll page up",
"cmdScrollToBottom": "scroll to bottom",
"cmdScrollToTop": "scroll to top",
"cmdSelectAll": "select all",
"cmdTableLineBreak": "Table: add line break",
"cmdTableMoveToDownCellAtSameOffset": "Move to down cell at same offset",
"cmdTableMoveToLeftCellIfItsAtStartOfCurrentCell": "Move to left cell if its at start of current cell",
"cmdTableMoveToRightCellIfItsAtTheEndOfCurrentCell": "Move to right cell if its at the end of current cell",
"cmdTableMoveToUpCellAtSameOffset": "Move to up cell at same offset",
"cmdTableNavigateCells": "Navigate around the cells at same offset",
"cmdTableNavigateCellsReverse": "Navigate around the cells at same offset in reverse",
"cmdTableStopAtTheBeginningOfTheCell": "Stop at the beginning of the cell",
"cmdToggleBold": "toggle bold",
"cmdToggleCode": "toggle code",
"cmdToggleHighlight": "toggle highlight",
"cmdToggleItalic": "toggle italic",
"cmdToggleStrikethrough": "toggle strikethrough",
"cmdToggleTodoList": "toggle the todo list",
"cmdToggleUnderline": "toggle underline",
"cmdUndo": "undo"
}
70 changes: 61 additions & 9 deletions lib/l10n/intl_pt_BR.arb
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,66 @@
"chooseImage": "Selecionar imagem",
"clearHighlightColor": "Limpar cor de destaque",
"closeFind": "Fechar",
"cmdDontAddNewLineInTableCell": "Não adicionar nova linha na célula",
"cmdMoveToDownCellAtSameOffset": "Mover para a célula abaixo na mesma posição",
"cmdMoveToLeftCellIfItsAtStartOfCurrentCell": "Mover para a célula à esquerda se estiver no início da célula atual",
"cmdMoveToRightCellIfItsAtTheEndOfCurrentCell": "Mover para a célula à direita se estiver no final da célula atual",
"cmdMoveToUpCellAtSameOffset": "Mover para a célula acima na mesma posição",
"cmdNavigateAroundTheCellsAtSameOffset": "Navegar pelas células na mesma posição",
"cmdNavigateAroundTheCellsAtSameOffsetInReverse": "Navegar pelas células na mesma posição (reverso)",
"cmdStopAtTheBeginningOfTheCell": "Parar no início da célula",
"cmdConvertToLink": "Converter para link",
"cmdConvertToParagraph": "converter para parágrafo",
"cmdCopySelection": "Copiar seleção",
"cmdCutSelection": "Cortar seleção",
"cmdDeleteLeft": "Deletar caractere à esquerda",
"cmdDeleteLineLeft": "Deletar até o início da linha",
"cmdDeleteRight": "Deletar caractere à direita",
"cmdDeleteWordLeft": "Deletar palavra à esquerda",
"cmdDeleteWordRight": "Deletar palavra à direita",
"cmdExitEditing": "sair do modo de edição",
"cmdIndent": "indentar",
"cmdMoveCursorBottom": "mover cursor para o final do arquivo",
"cmdMoveCursorBottomSelect": "Selecionar tudo até o final do arquivo",
"cmdMoveCursorDown": "mover cursor para baixo",
"cmdMoveCursorDownSelect": "Selecionar para baixo",
"cmdMoveCursorLeft": "mover cursor para a esquerda",
"cmdMoveCursorLeftSelect": "Selecionar à esquerda",
"cmdMoveCursorLineEnd": "mover cursor para o final da linha",
"cmdMoveCursorLineEndSelect": "Selecionar até o final da linha",
"cmdMoveCursorLineStart": "mover cursor para o início da linha",
"cmdMoveCursorLineStartSelect": "Selecionar até o início da linha",
"cmdMoveCursorRight": "mover cursor para a direita",
"cmdMoveCursorRightSelect": "Selecionar à direita",
"cmdMoveCursorTop": "mover cursor para o topo",
"cmdMoveCursorTopSelect": "Selecionar tudo até o início do arquivo",
"cmdMoveCursorUp": "mover cursor para cima",
"cmdMoveCursorUpSelect": "Selecionar para cima",
"cmdMoveCursorWordLeft": "mover cursor para a palavra à esquerda",
"cmdMoveCursorWordLeftSelect": "Selecionar palavra à esquerda",
"cmdMoveCursorWordRight": "mover cursor para a palavra à direita",
"cmdMoveCursorWordRightSelect": "Selecionar palavra à direita",
"cmdOpenFind": "Abrir Localizar",
"cmdOpenFindAndReplace": "Abrir Localizar e Substituir",
"cmdOpenLink": "abrir link",
"cmdOpenLinks": "abrir links",
"cmdOutdent": "desindentar",
"cmdPasteContent": "colar conteúdo",
"cmdPasteContentAsPlainText": "colar conteúdo como texto simples",
"cmdRedo": "refazer",
"cmdScrollPageDown": "rolar página para baixo",
"cmdScrollPageUp": "rolar página para cima",
"cmdScrollToBottom": "rolar para o fim",
"cmdScrollToTop": "rolar para o topo",
"cmdSelectAll": "selecionar tudo",
"cmdTableLineBreak": "Não adicionar nova linha na célula",
"cmdTableMoveToDownCellAtSameOffset": "Mover para a célula abaixo na mesma posição",
"cmdTableMoveToLeftCellIfItsAtStartOfCurrentCell": "Mover para a célula à esquerda se estiver no início da célula atual",
"cmdTableMoveToRightCellIfItsAtTheEndOfCurrentCell": "Mover para a célula à direita se estiver no final da célula atual",
"cmdTableMoveToUpCellAtSameOffset": "Mover para a célula acima na mesma posição",
"cmdTableNavigateCells": "Navegar pelas células na mesma posição",
"cmdTableNavigateCellsReverse": "Navegar pelas células na mesma posição (reverso)",
"cmdTableStopAtTheBeginningOfTheCell": "Parar no início da célula",
"cmdToggleBold": "alternar negrito",
"cmdToggleCode": "alternar código",
"cmdToggleHighlight": "alternar destaque",
"cmdToggleItalic": "alternar itálico",
"cmdToggleStrikethrough": "alternar tachado",
"cmdToggleTodoList": "alternar lista de tarefas",
"cmdToggleUnderline": "alternar sublinhado",
"cmdUndo": "desfazer",
"colAddAfter": "Inserir à direita",
"colAddBefore": "Inserir à esquerda",
"colClear": "Limpar coluna",
Expand Down Expand Up @@ -79,7 +131,6 @@
"linkText": "Texto",
"linkTextHint": "Insira o rótulo",
"listItemPlaceholder": "Item de lista",
"toDoPlaceholder": "Tarefa a fazer",
"loading": "Carregando",
"ltr": "Esquerda para Direita",
"mobileHeading1": "Cabeçalho 1",
Expand Down Expand Up @@ -122,6 +173,7 @@
"tint7": "Matiz 7",
"tint8": "Matiz 8",
"tint9": "Matiz 9",
"toDoPlaceholder": "Tarefa a fazer",
"underline": "Sublinhar",
"upload": "Enviar",
"uploadImage": "Enviar",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ final convertibleBlockTypes = [
/// convert the current block to paragraph.
final CommandShortcutEvent convertToParagraphCommand = CommandShortcutEvent(
key: 'convert to paragraph',
getDescription: () => AppFlowyEditorL10n.current.cmdConvertToParagraph,
command: 'backspace',
handler: _convertToParagraphCommandHandler,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ final indentableBlockTypes = {
///
final CommandShortcutEvent indentCommand = CommandShortcutEvent(
key: 'indent',
getDescription: () => AppFlowyEditorL10n.current.cmdIndent,
command: 'tab',
handler: _indentCommandHandler,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:flutter/material.dart';
///
final CommandShortcutEvent outdentCommand = CommandShortcutEvent(
key: 'outdent',
getDescription: () => AppFlowyEditorL10n.current.cmdOutdent,
command: 'shift+tab',
handler: _outdentCommandHandler,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,62 +15,61 @@ final List<CommandShortcutEvent> tableCommands = [

final CommandShortcutEvent _enterInTableCell = CommandShortcutEvent(
key: 'Don\'t add new line in table cell',
getDescription: () => AppFlowyEditorL10n.current.cmdDontAddNewLineInTableCell,
getDescription: () => AppFlowyEditorL10n.current.cmdTableLineBreak,
command: 'enter',
handler: _enterInTableCellHandler,
);

final CommandShortcutEvent _leftInTableCell = CommandShortcutEvent(
key: 'Move to left cell if its at start of current cell',
getDescription: () =>
AppFlowyEditorL10n.current.cmdMoveToLeftCellIfItsAtStartOfCurrentCell,
getDescription: () => AppFlowyEditorL10n
.current.cmdTableMoveToLeftCellIfItsAtStartOfCurrentCell,
command: 'arrow left',
handler: _leftInTableCellHandler,
);

final CommandShortcutEvent _rightInTableCell = CommandShortcutEvent(
key: 'Move to right cell if its at the end of current cell',
getDescription: () =>
AppFlowyEditorL10n.current.cmdMoveToRightCellIfItsAtTheEndOfCurrentCell,
getDescription: () => AppFlowyEditorL10n
.current.cmdTableMoveToRightCellIfItsAtTheEndOfCurrentCell,
command: 'arrow right',
handler: _rightInTableCellHandler,
);

final CommandShortcutEvent _upInTableCell = CommandShortcutEvent(
key: 'Move to up cell at same offset',
getDescription: () => AppFlowyEditorL10n.current.cmdMoveToUpCellAtSameOffset,
getDescription: () =>
AppFlowyEditorL10n.current.cmdTableMoveToUpCellAtSameOffset,
command: 'arrow up',
handler: _upInTableCellHandler,
);

final CommandShortcutEvent _downInTableCell = CommandShortcutEvent(
key: 'Move to down cell at same offset',
getDescription: () =>
AppFlowyEditorL10n.current.cmdMoveToDownCellAtSameOffset,
AppFlowyEditorL10n.current.cmdTableMoveToDownCellAtSameOffset,
command: 'arrow down',
handler: _downInTableCellHandler,
);

final CommandShortcutEvent _tabInTableCell = CommandShortcutEvent(
key: 'Navigate around the cells at same offset',
getDescription: () =>
AppFlowyEditorL10n.current.cmdNavigateAroundTheCellsAtSameOffset,
getDescription: () => AppFlowyEditorL10n.current.cmdTableNavigateCells,
command: 'tab',
handler: _tabInTableCellHandler,
);

final CommandShortcutEvent _shiftTabInTableCell = CommandShortcutEvent(
key: 'Navigate around the cells at same offset in reverse',
getDescription: () =>
AppFlowyEditorL10n.current.cmdNavigateAroundTheCellsAtSameOffsetInReverse,
getDescription: () => AppFlowyEditorL10n.current.cmdTableNavigateCellsReverse,
command: 'shift+tab',
handler: _shiftTabInTableCellHandler,
);

final CommandShortcutEvent _backSpaceInTableCell = CommandShortcutEvent(
key: 'Stop at the beginning of the cell',
getDescription: () =>
AppFlowyEditorL10n.current.cmdStopAtTheBeginningOfTheCell,
AppFlowyEditorL10n.current.cmdTableStopAtTheBeginningOfTheCell,
command: 'backspace',
handler: _backspaceInTableCellHandler,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import 'package:flutter/material.dart';
// toggle the todo list
final CommandShortcutEvent toggleTodoListCommand = CommandShortcutEvent(
key: 'toggle the todo list',
getDescription: () => AppFlowyEditorL10n.current.cmdToggleTodoList,
command: 'ctrl+enter',
macOSCommand: 'cmd+enter',
handler: _toggleTodoListCommandHandler,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ final List<CommandShortcutEvent> arrowDownKeys = [
// move the cursor downward vertically
final CommandShortcutEvent moveCursorDownCommand = CommandShortcutEvent(
key: 'move the cursor downward',
getDescription: () => AppFlowyEditorL10n.current.cmdMoveCursorDown,
command: 'arrow down',
handler: _moveCursorDownCommandHandler,
);
Expand All @@ -42,6 +43,7 @@ CommandShortcutEventHandler _moveCursorDownCommandHandler = (editorState) {
/// move the cursor to the bottommost position of the document and select everything in between
CommandShortcutEvent moveCursorBottomSelectCommand = CommandShortcutEvent(
key: 'move cursor to end of file and select all',
getDescription: () => AppFlowyEditorL10n.current.cmdMoveCursorBottomSelect,
command: 'ctrl+shift+arrow down',
macOSCommand: 'cmd+shift+arrow down',
handler: _moveCursorBottomSelectCommandHandler,
Expand Down Expand Up @@ -73,6 +75,7 @@ CommandShortcutEventHandler _moveCursorBottomSelectCommandHandler =
/// move the cursor to the bottommost position of the document
CommandShortcutEvent moveCursorBottomCommand = CommandShortcutEvent(
key: 'move cursor to end of file',
getDescription: () => AppFlowyEditorL10n.current.cmdMoveCursorBottom,
command: 'ctrl+arrow down',
macOSCommand: 'cmd+arrow down',
handler: _moveCursorBottomCommandHandler,
Expand Down Expand Up @@ -103,6 +106,7 @@ CommandShortcutEventHandler _moveCursorBottomCommandHandler = (editorState) {
/// moves vertically down one line and selects everything between
CommandShortcutEvent moveCursorDownSelectCommand = CommandShortcutEvent(
key: 'move cursor down and select one line',
getDescription: () => AppFlowyEditorL10n.current.cmdMoveCursorDownSelect,
command: 'shift+arrow down',
macOSCommand: 'shift+arrow down',
handler: _moveCursorDownSelectCommandHandler,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ final List<CommandShortcutEvent> arrowLeftKeys = [
// arrow left key
// move the cursor forward one character
final CommandShortcutEvent moveCursorLeftCommand = CommandShortcutEvent(
key: 'move the cursor forward one character',
key: 'move the cursor backward one character',
getDescription: () => AppFlowyEditorL10n.current.cmdMoveCursorLeft,
command: 'arrow left',
handler: _arrowLeftCommandHandler,
);
Expand All @@ -42,6 +43,7 @@ CommandShortcutEventHandler _arrowLeftCommandHandler = (editorState) {
// move the cursor to the beginning of the block
final CommandShortcutEvent moveCursorToBeginCommand = CommandShortcutEvent(
key: 'move the cursor at the start of line',
getDescription: () => AppFlowyEditorL10n.current.cmdMoveCursorLineStart,
command: 'home',
macOSCommand: 'cmd+arrow left',
handler: _moveCursorToBeginCommandHandler,
Expand All @@ -64,6 +66,7 @@ CommandShortcutEventHandler _moveCursorToBeginCommandHandler = (editorState) {
// move the cursor to the left word
final CommandShortcutEvent moveCursorToLeftWordCommand = CommandShortcutEvent(
key: 'move the cursor to the left word',
getDescription: () => AppFlowyEditorL10n.current.cmdMoveCursorWordLeft,
command: 'ctrl+arrow left',
macOSCommand: 'alt+arrow left',
handler: _moveCursorToLeftWordCommandHandler,
Expand Down Expand Up @@ -123,6 +126,7 @@ CommandShortcutEventHandler _moveCursorToLeftWordCommandHandler =
final CommandShortcutEvent moveCursorLeftWordSelectCommand =
CommandShortcutEvent(
key: 'move the cursor to select the left word',
getDescription: () => AppFlowyEditorL10n.current.cmdMoveCursorWordLeftSelect,
command: 'ctrl+shift+arrow left',
macOSCommand: 'alt+shift+arrow left',
handler: _moveCursorLeftWordSelectCommandHandler,
Expand Down Expand Up @@ -157,6 +161,7 @@ CommandShortcutEventHandler _moveCursorLeftWordSelectCommandHandler =
// selects only one character
final CommandShortcutEvent moveCursorLeftSelectCommand = CommandShortcutEvent(
key: 'move the cursor left select',
getDescription: () => AppFlowyEditorL10n.current.cmdMoveCursorLeftSelect,
command: 'shift+arrow left',
handler: _moveCursorLeftSelectCommandHandler,
);
Expand Down Expand Up @@ -185,6 +190,7 @@ CommandShortcutEventHandler _moveCursorLeftSelectCommandHandler =
//
final CommandShortcutEvent moveCursorBeginSelectCommand = CommandShortcutEvent(
key: 'move cursor to select till start of line',
getDescription: () => AppFlowyEditorL10n.current.cmdMoveCursorLineStartSelect,
command: 'shift+home',
macOSCommand: 'cmd+shift+arrow left',
handler: _moveCursorBeginSelectCommandHandler,
Expand Down
Loading

0 comments on commit 84e5adc

Please sign in to comment.