Skip to content

Commit 7f249f8

Browse files
committed
new settings for hardcoded anu la
1 parent 4a8f18d commit 7f249f8

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

dist/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ <h1>
125125
Allow X ala X partial parsing</label>
126126
<label><input type="checkbox" id="separate-repeated-modifiers" />
127127
Allow separate repeated modifiers</label>
128+
<label><input type="checkbox" id="hardcoded-anu-la" checked />
129+
Use hardcoded "anu la" translation</label>
128130
</details>
129131
<div>
130132
<button id="reset-button">Reset to default</button>

src/parser/filter.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,9 @@ export const PREPOSITION_RULE: ReadonlyArray<(phrase: Preposition) => boolean> =
233233
export const CONTEXT_CLAUSE_RULE: ReadonlyArray<
234234
(contextClause: ContextClause) => boolean
235235
> = [
236+
// Only allow "anu la" when allowed by the settings
237+
(clause) => clause.type !== "anu" || settings.hardcodedAnuLa,
238+
236239
// Prevent "anu ala anu la"
237240
(clause) =>
238241
clause.type !== "anu" || clause.anu.type !== "x ala x" ||

src/settings.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ export type Settings = {
99
tense: RedundancySettings;
1010
xAlaXPartialParsing: boolean;
1111
separateRepeatedModifiers: boolean;
12+
hardcodedAnuLa: boolean;
1213
};
13-
// the default value may change
14+
// the default value may change, also change `index.html`
1415
export const defaultSettings: Readonly<Settings> = Object.freeze({
1516
teloMisikeke: true,
1617
randomize: false,
@@ -19,6 +20,7 @@ export const defaultSettings: Readonly<Settings> = Object.freeze({
1920
tense: "both",
2021
xAlaXPartialParsing: false,
2122
separateRepeatedModifiers: false,
23+
hardcodedAnuLa: true,
2224
});
2325
// This global constant is mutable
2426
export const settings: Settings = Object.seal({ ...defaultSettings });

src/settings_frontend.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ const UPDATERS: Readonly<{ [K in keyof Settings]: Updater<Settings[K]> }> = {
5151
tense: REDUNDANCY_UPDATER,
5252
xAlaXPartialParsing: BOOL_UPDATER,
5353
separateRepeatedModifiers: BOOL_UPDATER,
54+
hardcodedAnuLa: BOOL_UPDATER,
5455
};
5556
const KEYS = Object.keys(UPDATERS) as ReadonlyArray<keyof Settings>;
5657

0 commit comments

Comments
 (0)