Skip to content

Commit 13c15ed

Browse files
committed
Added some language name changes for two Chinese espeak voices (cmn, yue) that don't fit MathCAT's current language format (lang-region).
1 parent a02e6bb commit 13c15ed

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

addon/globalPlugins/MathCAT/MathCAT.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,13 @@ def __init__(self):
426426
def getSpeechForMathMl(self, mathml: str):
427427
try:
428428
self._language = getLanguageToUse(mathml)
429+
# MathCAT should probably be extended to accept "extlang" tagging, but it uses lang-region tagging at the moment
430+
if self._language == "cmn":
431+
self._language = "zh-cmn"
432+
elif self._language == "yue":
433+
self._language = "zh-yue"
434+
# needs to be set before the MathML for DecimalSeparator canonicalization
435+
libmathcat.SetPreference("Language", self._language)
429436
libmathcat.SetMathML(mathml)
430437
except Exception as e:
431438
log.error(e)
@@ -446,7 +453,7 @@ def getSpeechForMathMl(self, mathml: str):
446453
"CapitalLetters_UseWord",
447454
"true" if synthConfig["sayCapForCapitals"] else "false",
448455
)
449-
# log.info(f"Speech text: {libmathcat.GetSpokenText()}")
456+
# log.info(f"Speech text ({self._language}): {libmathcat.GetSpokenText()}")
450457
if PitchCommand in supported_commands:
451458
libmathcat.SetPreference("CapitalLetters_Pitch", str(synthConfig["capPitchChange"]))
452459
if self._add_sounds():

0 commit comments

Comments
 (0)