mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-21 09:38:01 +02:00
Desktop: Allow Markdown editor search dialog to be localised (#11219)
This commit is contained in:
parent
4580c63ac7
commit
e77fa19fea
@ -284,6 +284,7 @@ packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v5/utils/useScrollUtils.
|
||||
packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v6/CodeMirror.js
|
||||
packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v6/Editor.js
|
||||
packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v6/useEditorCommands.js
|
||||
packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v6/utils/localisation.js
|
||||
packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v6/utils/useKeymap.js
|
||||
packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v6/utils/useRefocusOnVisiblePaneChange.js
|
||||
packages/app-desktop/gui/NoteEditor/NoteBody/PlainEditor/PlainEditor.js
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -261,6 +261,7 @@ packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v5/utils/useScrollUtils.
|
||||
packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v6/CodeMirror.js
|
||||
packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v6/Editor.js
|
||||
packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v6/useEditorCommands.js
|
||||
packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v6/utils/localisation.js
|
||||
packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v6/utils/useKeymap.js
|
||||
packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v6/utils/useRefocusOnVisiblePaneChange.js
|
||||
packages/app-desktop/gui/NoteEditor/NoteBody/PlainEditor/PlainEditor.js
|
||||
|
@ -14,6 +14,7 @@ import useKeymap from './utils/useKeymap';
|
||||
import useEditorSearch from '../utils/useEditorSearchExtension';
|
||||
import CommandService from '@joplin/lib/services/CommandService';
|
||||
import { SearchMarkers } from '../../../utils/useSearchMarkers';
|
||||
import localisation from './utils/localisation';
|
||||
|
||||
interface Props extends EditorProps {
|
||||
style: React.CSSProperties;
|
||||
@ -98,6 +99,7 @@ const Editor = (props: Props, ref: ForwardedRef<CodeMirrorControl>) => {
|
||||
|
||||
const editorProps: EditorProps = {
|
||||
...props,
|
||||
localisations: localisation(),
|
||||
onEvent: event => onEventRef.current(event),
|
||||
onLogMessage: message => onLogMessageRef.current(message),
|
||||
};
|
||||
|
@ -0,0 +1,28 @@
|
||||
import { _ } from '@joplin/lib/locale';
|
||||
|
||||
// See https://codemirror.net/examples/translate/
|
||||
export default () => ({
|
||||
// @codemirror/view
|
||||
'Control character': _('Control character'),
|
||||
|
||||
// @codemirror/commands
|
||||
'Selection deleted': _('Selection deleted'),
|
||||
|
||||
// @codemirror/search
|
||||
'Go to line': _('Go to line'),
|
||||
'go': _('go'),
|
||||
'Find': _('Find'),
|
||||
'Replace': _('Replace'),
|
||||
'next': _('next'),
|
||||
'previous': _('previous'),
|
||||
'all': _('all'),
|
||||
'match case': _('match case'),
|
||||
'by word': _('by word'),
|
||||
'replace': _('replace'),
|
||||
'replace all': _('replace all'),
|
||||
'close': _('close'),
|
||||
'current match': _('current match'),
|
||||
'replaced $ matches': _('replaced $ matches'),
|
||||
'replaced match on line $': _('replaced match on line $'),
|
||||
'on line': _('on line'),
|
||||
});
|
@ -255,6 +255,8 @@ const createEditor = (
|
||||
decoratorExtension,
|
||||
biDirectionalTextExtension,
|
||||
|
||||
props.localisations ? EditorState.phrases.of(props.localisations) : [],
|
||||
|
||||
// Adds additional CSS classes to tokens (the default CSS classes are
|
||||
// auto-generated and thus unstable).
|
||||
syntaxHighlighting(classHighlighter),
|
||||
|
@ -173,9 +173,15 @@ export type OnEventCallback = (event: EditorEvent)=> void;
|
||||
export type PasteFileCallback = (data: File)=> Promise<void>;
|
||||
type OnScrollPastBeginningCallback = ()=> void;
|
||||
|
||||
interface Localisations {
|
||||
[editorString: string]: string;
|
||||
}
|
||||
|
||||
export interface EditorProps {
|
||||
settings: EditorSettings;
|
||||
initialText: string;
|
||||
// Used mostly for internal editor library strings
|
||||
localisations?: Localisations;
|
||||
|
||||
// If null, paste and drag-and-drop will not work for resources unless handled elsewhere.
|
||||
onPasteFile: PasteFileCallback|null;
|
||||
|
Loading…
Reference in New Issue
Block a user