Esempio n. 1
0
    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)
Esempio n. 3
0
 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)
Esempio n. 6
0
 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)
Esempio n. 8
0
	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)
Esempio n. 9
0
	def test_invalidLocale(self):
		lcid = languageHandler.localeNameToWindowsLCID("zzzz")
		self.assertEqual(lcid, LCID_NONE)
Esempio n. 10
0
	def test_nonStandardLocale(self):
		lcid = languageHandler.localeNameToWindowsLCID("us")
		self.assertEqual(lcid, LCID_NONE)
Esempio n. 11
0
	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)
Esempio n. 12
0
	def test_knownLocale(self):
		lcid = languageHandler.localeNameToWindowsLCID("en")
		self.assertEqual(lcid, LCID_ENGLISH_US)