@@ -47,6 +47,45 @@ export class PlainTextDiff extends Widget implements Git.Diff.IDiffWidget {
4747 this . _model = model ;
4848 this . _trans = translator ?? nullTranslator . load ( 'jupyterlab_git' ) ;
4949
50+ // The list of internal strings is available at https://codemirror.net/examples/translate/
51+ this . _translations = {
52+ // @codemirror /view
53+ 'Control character' : this . _trans . __ ( 'Control character' ) ,
54+ // @codemirror /commands
55+ 'Selection deleted' : this . _trans . __ ( 'Selection deleted' ) ,
56+ // @codemirror /language
57+ 'Folded lines' : this . _trans . __ ( 'Folded lines' ) ,
58+ 'Unfolded lines' : this . _trans . __ ( 'Unfolded lines' ) ,
59+ to : this . _trans . __ ( 'to' ) ,
60+ 'folded code' : this . _trans . __ ( 'folded code' ) ,
61+ unfold : this . _trans . __ ( 'unfold' ) ,
62+ 'Fold line' : this . _trans . __ ( 'Fold line' ) ,
63+ 'Unfold line' : this . _trans . __ ( 'Unfold line' ) ,
64+ // @codemirror /search
65+ 'Go to line' : this . _trans . __ ( 'Go to line' ) ,
66+ go : this . _trans . __ ( 'go' ) ,
67+ Find : this . _trans . __ ( 'Find' ) ,
68+ Replace : this . _trans . __ ( 'Replace' ) ,
69+ next : this . _trans . __ ( 'next' ) ,
70+ previous : this . _trans . __ ( 'previous' ) ,
71+ all : this . _trans . __ ( 'all' ) ,
72+ 'match case' : this . _trans . __ ( 'match case' ) ,
73+ replace : this . _trans . __ ( 'replace' ) ,
74+ 'replace all' : this . _trans . __ ( 'replace all' ) ,
75+ close : this . _trans . __ ( 'close' ) ,
76+ 'current match' : this . _trans . __ ( 'current match' ) ,
77+ 'replaced $ matches' : this . _trans . __ ( 'replaced $ matches' ) ,
78+ 'replaced match on line $' : this . _trans . __ ( 'replaced match on line $' ) ,
79+ 'on line' : this . _trans . __ ( 'on line' ) ,
80+ // From https://codemirror.net/5/addon/merge/merge.js
81+ 'Identical text collapsed. Click to expand.' : this . _trans . __ (
82+ 'Identical text collapsed. Click to expand.'
83+ ) ,
84+ 'Toggle locked scrolling' : this . _trans . __ ( 'Toggle locked scrolling' ) ,
85+ 'Push to left' : this . _trans . __ ( 'Push to left' ) ,
86+ 'Revert chunk' : this . _trans . __ ( 'Revert chunk' )
87+ } ;
88+
5089 // Load file content early
5190 Promise . all ( [
5291 this . _model . reference . content ( ) ,
@@ -124,6 +163,7 @@ export class PlainTextDiff extends Widget implements Git.Diff.IDiffWidget {
124163 this . createDiffView (
125164 this . _challenger ,
126165 this . _reference ,
166+ this . _translations ,
127167 this . _hasConflict ? this . _base : null
128168 ) ;
129169 }
@@ -166,6 +206,7 @@ export class PlainTextDiff extends Widget implements Git.Diff.IDiffWidget {
166206 this . createDiffView (
167207 this . _challenger ,
168208 this . _reference ,
209+ this . _translations ,
169210 this . _hasConflict ? this . _base : null
170211 ) ;
171212
@@ -205,6 +246,7 @@ export class PlainTextDiff extends Widget implements Git.Diff.IDiffWidget {
205246 protected async createDiffView (
206247 challengerContent : string ,
207248 referenceContent : string ,
249+ translations : Record < string , string > ,
208250 baseContent ?: string
209251 ) : Promise < void > {
210252 if ( ! this . _mergeView ) {
@@ -216,6 +258,7 @@ export class PlainTextDiff extends Widget implements Git.Diff.IDiffWidget {
216258 value : challengerContent ,
217259 orig : referenceContent ,
218260 mode : mode . mime ,
261+ phrases : translations ,
219262 ...this . getDefaultOptions ( )
220263 } ;
221264
@@ -276,6 +319,7 @@ export class PlainTextDiff extends Widget implements Git.Diff.IDiffWidget {
276319 protected _mergeView : MergeView . MergeViewEditor ;
277320 protected _model : Git . Diff . IModel ;
278321 protected _trans : TranslationBundle ;
322+ protected _translations : Record < string , string > ;
279323
280324 private _reference : string | null = null ;
281325 private _challenger : string | null = null ;
0 commit comments