Skip to content

Commit

Permalink
Added y orthographies
Browse files Browse the repository at this point in the history
  • Loading branch information
fbanados committed Jul 4, 2024
1 parent c5c2a76 commit 3c45242
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
2 changes: 2 additions & 0 deletions frontend/js/orthography.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ const AVAILABLE_ORTHOGRAPHIES = new Set([
"Cans",
"Latn",
"Latn-x-macron",
"Latn-y",
"Latn-x-macron-y",
"CMRO",
]);

Expand Down
12 changes: 12 additions & 0 deletions src/CreeDictionary/CreeDictionary/orthography.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,26 @@
from cree_sro_syllabics import sro2syllabics

CIRCUMFLEX_TO_MACRON = str.maketrans("êîôâ", "ēīōā")
ACCENTED_Y_TO_Y = str.maketrans("ý", "y")

def to_y(latn_accented_y: str) -> str:
"""
Translate SRO with accented y to normal y
"""
return latn_accented_y.translate(ACCENTED_Y_TO_Y)

def to_macrons(sro_circumflex: str) -> str:
"""
Transliterate SRO to macrons.
"""
return sro_circumflex.translate(CIRCUMFLEX_TO_MACRON)

def to_macrons_with_y(sro_circumflex: str) -> str:
"""
Transliterate SRO to macrons with normal y
"""
return sro_circumflex.translate(CIRCUMFLEX_TO_MACRON).translate(ACCENTED_Y_TO_Y)


def to_syllabics(sro_circumflex: str) -> str:
"""
Expand Down
12 changes: 10 additions & 2 deletions src/crkeng/site/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,17 @@
"default": "Latn",
"available": {
# 'Latn' is Okimāsis/Wolvegrey's SRO
"Latn": {"name": "SRO (êîôâ)"},
"Latn-y": {
"name": "SRO (êîôâ) with y",
"converter": "CreeDictionary.CreeDictionary.orthography.to_y"
},
"Latn": {"name": "SRO (êîôâ) with ý"},
"Latn-x-macron-y": {
"name": "SRO (ēīōā) with y",
"converter": "CreeDictionary.CreeDictionary.orthography.to_macrons_with_y",
},
"Latn-x-macron": {
"name": "SRO (ēīōā)",
"name": "SRO (ēīōā) with ý",
"converter": "CreeDictionary.CreeDictionary.orthography.to_macrons",
},
"Cans": {
Expand Down

0 comments on commit 3c45242

Please sign in to comment.