@@ -11,7 +11,11 @@ import {
1111 checkIfFailedDueToMinBurst ,
1212 checkIfFinished ,
1313} from "../helpers/fail-or-finish" ;
14- import { areCharactersVisuallyEqual , isSpace } from "../../utils/strings" ;
14+ import {
15+ areCharactersVisuallyEqual ,
16+ isSpace ,
17+ removeLanguageSize ,
18+ } from "../../utils/strings" ;
1519import * as TestState from "../../test/test-state" ;
1620import * as TestLogic from "../../test/test-logic" ;
1721import {
@@ -44,6 +48,10 @@ const charOverrides = new Map<string, string>([
4448 // ["æ", "ae"],
4549] ) ;
4650
51+ const languageCharOverrides = new Map < string , [ string , string ] [ ] > ( [
52+ [ "dutch" , [ [ "ij" , "ij" ] ] ] ,
53+ ] ) ;
54+
4755type OnInsertTextParams = {
4856 // might need later?
4957 // inputType: SupportedInputType;
@@ -95,6 +103,29 @@ export async function onInsertText(options: OnInsertTextParams): Promise<void> {
95103 return ;
96104 }
97105
106+ const languageOverrides = languageCharOverrides . get (
107+ removeLanguageSize ( Config . language ) ,
108+ ) ;
109+ if ( languageOverrides !== undefined ) {
110+ for ( const [ targetChar , overrideChar ] of languageOverrides ) {
111+ if (
112+ options . data === targetChar &&
113+ TestWords . words . getCurrentText ( ) [ getCurrentInput ( ) . length ] !==
114+ options . data
115+ ) {
116+ // replace the data with the override
117+ setInputElementValue (
118+ inputValue . slice ( 0 , - options . data . length ) + overrideChar ,
119+ ) ;
120+ await onInsertText ( {
121+ ...options ,
122+ data : overrideChar ,
123+ } ) ;
124+ return ;
125+ }
126+ }
127+ }
128+
98129 // input and target word
99130 const testInput = getCurrentInput ( ) ;
100131 const currentWord = TestWords . words . getCurrentText ( ) ;
0 commit comments