-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Add - support Tifinagh
- Loading branch information
Showing
16 changed files
with
520 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { Ar } from './letters' | ||
import { Ti } from '../tifinagh/letters' | ||
import { IConverter } from '../IConverter' | ||
import { Abjad } from '../types' | ||
|
||
export class ArabicToTifinaghConverter implements IConverter { | ||
public readonly from = Abjad.Arabic | ||
public readonly to = Abjad.Tifinagh | ||
|
||
private map = new Map<string, string>( | ||
[ | ||
[' ', ' '], | ||
[Ar.Hamza, Ti.Ya], /** ء -> ⴰ */ | ||
[Ar.AlefMadda, Ti.Ya], /** ا -> ⴰ */ | ||
[Ar.AlefHamza, Ti.Ya], /** أ -> ⴰ*/ | ||
[Ar.WawHamza, Ti.Yu], /** ؤ -> ⵓ */ | ||
[Ar.AlefHamzaMaksura, Ti.Ya], /** ى -> ⴰ */ | ||
[Ar.Alef, Ti.Ya], /** ا -> ⴰ */ | ||
[Ar.Ba, Ti.Yab], /** ب -> ⴱ */ | ||
[Ar.TaMarbuta, Ti.Ya], /** ة -> ⴰ */ | ||
[Ar.Ta, Ti.Yat], /** ت -> ⵜ */ | ||
[Ar.Tha, Ti.Yath], /** ث -> ⵝ */ | ||
[Ar.Jeem, Ti.Yazh], /** ج -> ⵊ */ | ||
[Ar.H7aa, Ti.Yahh], /** ح -> ⵃ */ | ||
[Ar.Khaa, Ti.Yakh], /** خ -> ⵅ */ | ||
[Ar.Dal, Ti.Yad], /** د -> ⴷ */ | ||
[Ar.Thal, Ti.Yadh], /** ذ -> ⴸ */ | ||
[Ar.Ra, Ti.Yar], /** ر -> ⵔ */ | ||
[Ar.Zay, Ti.Ya], /** ز -> ⴰ */ | ||
[Ar.Seen, Ti.Yas], /** س -> ⵙ */ | ||
[Ar.Sheen, Ti.Yash], /** ش -> ⵛ */ | ||
[Ar.Sad, Ti.Yat], /** ص -> ⵜ */ | ||
[Ar.Dad, Ti.Yadd], /** ض -> ⴹ */ | ||
[Ar.TTa, Ti.Yatt], /** ط -> ⵟ */ | ||
[Ar.THa, Ti.Yaddh], /** ظ -> ⴺ */ | ||
[Ar.Ayn, Ti.Yaa], /** ع -> ⵄ */ | ||
[Ar.Ghayn, Ti.Yagh], /** غ -> ⵖ */ | ||
[Ar.Fa, Ti.Yaf], /** ف -> ⴼ */ | ||
[Ar.Qaf, Ti.Yaq], /** ق -> ⵇ */ | ||
[Ar.Kaf, Ti.Yak], /** ك -> ⴽ */ | ||
[Ar.Lam, Ti.Yal], /** ل -> ⵍ */ | ||
[Ar.Meem, Ti.Yam], /** م -> ⵎ */ | ||
[Ar.Noon, Ti.Yan], /** ن -> ⵏ */ | ||
[Ar.Ha, Ti.Yey], /** ه -> ⴻ */ | ||
[Ar.Waw, Ti.Yu], /** و -> ⵓ */ | ||
[Ar.AlefMaksura, Ti.Ya], /** ى -> ⴰ */ | ||
[Ar.Yaa, Ti.Yi], /** ي -> ⵉ */ | ||
] | ||
) | ||
|
||
public convert(text: string): string { | ||
let result = '' | ||
for (const letter of text) { | ||
const u = this.map.get(letter) ?? '' | ||
result += u | ||
} | ||
return result | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Oops, something went wrong.