Skip to content

Commit

Permalink
add oe diphtong
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanVukovic99 committed Jan 8, 2025
1 parent 5657217 commit 7f9ac8c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
10 changes: 4 additions & 6 deletions ext/js/language/la/latin-text-preprocessors.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,18 @@
*/

/** @type {import('language').BidirectionalConversionPreprocessor} */
export const processDiphtongAE = {
export const processDiphtongs = {
name: 'Convert æ to ae',
description: 'æ → ae, Æ → AE, aeæ, AEÆ',
description: 'æ → ae, Æ → AE, œoe, ŒOE',
options: ['off', 'direct', 'inverse'],
process: (str, setting) => {
switch (setting) {
case 'off':
return str;
case 'direct':
return str.replace(/æ/g, 'ae').replace(/Æ/g, 'AE');
return str.replace(/æ/g, 'ae').replace(/Æ/g, 'AE').replace(/œ/g, 'oe').replace(/Œ/g, 'OE');

Check failure on line 28 in ext/js/language/la/latin-text-preprocessors.js

View workflow job for this annotation

GitHub Actions / JavaScript

Expected line break before `.replace`
case 'inverse':
return str.replace(/ae/g, 'æ').replace(/AE/g, 'Æ');
return str.replace(/ae/g, 'æ').replace(/AE/g, 'Æ').replace(/oe/g, 'œ').replace(/OE/g, 'Œ');

Check failure on line 30 in ext/js/language/la/latin-text-preprocessors.js

View workflow job for this annotation

GitHub Actions / JavaScript

Expected line break before `.replace`
}
},


};
4 changes: 2 additions & 2 deletions ext/js/language/language-descriptors.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import {japaneseTransforms} from './ja/japanese-transforms.js';
import {isStringPartiallyJapanese} from './ja/japanese.js';
import {disassembleHangul, reassembleHangul} from './ko/korean-text-processors.js';
import {koreanTransforms} from './ko/korean-transforms.js';
import {processDiphtongAE} from './la/latin-text-preprocessors.js';
import {processDiphtongs} from './la/latin-text-preprocessors.js';
import {latinTransforms} from './la/latin-transforms.js';
import {removeRussianDiacritics, yoToE} from './ru/russian-text-preprocessors.js';
import {oldIrishTransforms} from './sga/old-irish-transforms.js';
Expand Down Expand Up @@ -207,7 +207,7 @@ const languageDescriptors = [
textPreprocessors: {
...capitalizationPreprocessors,
removeAlphabeticDiacritics,
processDiphtongAE,
processDiphtongs,
},
languageTransforms: latinTransforms,
},
Expand Down
2 changes: 1 addition & 1 deletion types/ext/language-descriptors.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ type AllTextProcessors = {
};
la: {
pre: CapitalizationPreprocessors & AlphabeticDiacriticsProcessor & {
processDiphtongAE: BidirectionalConversionPreprocessor;
processDiphtongs: BidirectionalConversionPreprocessor;
};
};
lo: Record<string, never>;
Expand Down

0 comments on commit 7f9ac8c

Please sign in to comment.