def convertLangChangeCommand( self, command: LangChangeCommand) -> Optional[speechXml.SetAttrCommand]: lcid = languageHandler.localeNameToWindowsLCID(command.lang) if lcid is languageHandler.LCID_NONE: log.debugWarning(f"Invalid language: {command.lang}") return None normalizedLanguage = command.lang.lower().replace("-", "_") normalizedLanguageWithoutLocale = normalizedLanguage.split("_")[0] if (normalizedLanguage not in self.lowerCaseAvailableLanguages and normalizedLanguageWithoutLocale not in self.availableLanguagesWithoutLocale): log.warning( f"Language {command.lang} not supported ({self.lowerCaseAvailableLanguages})" ) return None return super().convertLangChangeCommand(command)
def test_invalidLocale(self): lcid = languageHandler.localeNameToWindowsLCID("zzzz") self.assertEqual(lcid, LCID_NONE)
def convertLangChangeCommand(self, command): lcid = languageHandler.localeNameToWindowsLCID(command.lang) if lcid is languageHandler.LCID_NONE: log.debugWarning("Invalid language: %s" % command.lang) return None return super(_OcSsmlConverter, self).convertLangChangeCommand(command)
def test_windowsUnknownLocale(self): # "an" is the locale name for Aragonese, but Windows doesn't know about it. lcid = languageHandler.localeNameToWindowsLCID("an") self.assertEqual(lcid, LCID_NONE)
def test_nonStandardLocale(self): lcid = languageHandler.localeNameToWindowsLCID("us") self.assertEqual(lcid, LCID_NONE)
def convertLangChangeCommand(self, command): lcid = languageHandler.localeNameToWindowsLCID(command.lang) if lcid is languageHandler.LCID_NONE: log.debugWarning(f"Invalid language: {command.lang}") return None return super().convertLangChangeCommand(command)
def test_knownLocale(self): lcid = languageHandler.localeNameToWindowsLCID("en") self.assertEqual(lcid, LCID_ENGLISH_US)
def convertLangChangeCommand(self, command): lcid = languageHandler.localeNameToWindowsLCID(command.lang) if lcid is languageHandler.LCID_NONE: log.debugWarning("Invalid language: %s" % command.lang) return None return super(_OcSsmlConverter, self).convertLangChangeCommand(command)
def test_invalidLocale(self): lcid = languageHandler.localeNameToWindowsLCID("zzzz") self.assertEqual(lcid, LCID_NONE)
def test_nonStandardLocale(self): lcid = languageHandler.localeNameToWindowsLCID("us") self.assertEqual(lcid, LCID_NONE)
def test_windowsUnknownLocale(self): # "an" is the locale name for Aragonese, but Windows doesn't know about it. lcid = languageHandler.localeNameToWindowsLCID("an") self.assertEqual(lcid, LCID_NONE)
def test_knownLocale(self): lcid = languageHandler.localeNameToWindowsLCID("en") self.assertEqual(lcid, LCID_ENGLISH_US)