コード例 #1
0
        // Check if LanguageDirection is supported (if true, the provider is added in Studio)
        // 'IsInvalidServerMessage' is used to check if any server error was returned in the first call, if yes, then is no need to make the second call to
        // the server to verify if language pairs are supported. (2 calls of SupportsLanguageDirection() are made because of twice instantiation of DeepLTranslationProviderConnecter.
        public bool SupportsLanguageDirection(LanguagePair languageDirection)
        {
            if (!Helpers.IsInvalidServerMessage)
            {
                return(DeepLTranslationProviderConnecter.IsLanguagePairSupported(languageDirection.SourceCulture, languageDirection.TargetCulture));
            }

            return(false);
        }
コード例 #2
0
        public bool SupportsLanguageDirection(LanguagePair languageDirection)
        {
            try
            {
                return(DeepLTranslationProviderConnecter.IsLanguagePairSupported(languageDirection.SourceCulture, languageDirection.TargetCulture));
            }
            catch (Exception e)
            {
                _logger.Error($"Error for following LP: source {languageDirection.SourceCultureName} and target {languageDirection.TargetCultureName}");
                _logger.Error(e);
            }

            return(false);
        }
コード例 #3
0
 private void GetSupportedTargetLanguages(LanguagePair[] languagePairs)
 {
     foreach (var languagePair in languagePairs)
     {
         var targetLanguage = languagePair.TargetCulture.TwoLetterISOLanguageName.ToUpper();
         if (DeepLTranslationProviderConnecter.IsLanguagePairSupported(languagePair.SourceCulture, languagePair.TargetCulture) && !Options.LanguagesSupported.ContainsKey(targetLanguage))
         {
             if (!Options.LanguagesSupported.ContainsKey(languagePair.TargetCultureName))
             {
                 Options.LanguagesSupported.Add(languagePair.TargetCultureName, "DeepLTranslator");
             }
         }
     }
 }
コード例 #4
0
 public bool SupportsLanguageDirection(LanguagePair languageDirection)
 {
     return(DeepLTranslationProviderConnecter.IsLanguagePairSupported(languageDirection.SourceCulture,
                                                                      languageDirection.TargetCulture));
 }