Exemplo n.º 1
0
        public ITranslationProvider CreateTranslationProvider(Uri translationProviderUri, string translationProviderState, ITranslationProviderCredentialStore credentialStore)
        {
            if (!SupportsTranslationProviderUri(translationProviderUri))
            {
                throw new Exception("Cannot handle URI.");
            }

            var tp = new TausTranslationProvider(new TausTranslationOptions(translationProviderUri));

            return(tp);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Show the plug-in settings form when the user is adding the translation provider plug-in
        /// through the GUI of SDL Trados Studio
        /// </summary>
        /// <param name="owner"></param>
        /// <param name="languagePairs"></param>
        /// <param name="credentialStore"></param>
        /// <returns></returns>
        #region "Browse"
        public ITranslationProvider[] Browse(IWin32Window owner, LanguagePair[] languagePairs, ITranslationProviderCredentialStore credentialStore)
        {
            var dialog = new TausProviderConfDialog(new TausTranslationOptions());

            if (dialog.ShowDialog(owner) != DialogResult.OK)
            {
                return(null);
            }
            var testProvider = new TausTranslationProvider(dialog.Options);

            return(new ITranslationProvider[] { testProvider });
        }
Exemplo n.º 3
0
        public TausTranslationProviderLanguageDirection(TausTranslationProvider provider, LanguagePair languages)
        {
            _provider          = provider;
            _languageDirection = languages;
            _options           = _provider.Options;
            _visitor           = new TausTranslationProviderElementVisitor(_options);



            //#region "CompileCollection"

            //_listOfTranslations = new Dictionary<string, string>();

            //// Load the content of the specified list file and fill it
            //// into the multiple identical sources are not allowed
            //using (StreamReader sourceFile = new StreamReader(_options.ListFileName))
            //{
            //    sourceFile.ReadLine(); // Skip the first line as it contains the language direction.

            //    char fileDelimiter = Convert.ToChar(_options.Delimiter);
            //    while (!sourceFile.EndOfStream)
            //    {
            //        string[] currentPair = sourceFile.ReadLine().Split(fileDelimiter);
            //        if (currentPair.Count<string>() != 2)
            //        {
            //            // The current line does not contain a proper source/target segment pair.
            //            continue;
            //        }

            //        // Add the source/target segment pair to the collection
            //        // after checking that the current source segment does not
            //        // already exist in the Dictionary.
            //        if (!_listOfTranslations.ContainsKey(currentPair[0]))
            //        {
            //            _listOfTranslations.Add(currentPair[0] ,currentPair[1]);
            //        }
            //    }
            //    sourceFile.Close();
            //}
            //#endregion
        }