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

            OpenNmtProvider tp = new OpenNmtProvider(new OpenNMTTranslationOptions(translationProviderUri));

            return(tp);
        }
        /// <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)
        {
            OpenNMTConfDialog dialog = new OpenNMTConfDialog(new OpenNMTTranslationOptions(), languagePairs);

            if (dialog.ShowDialog(owner) == DialogResult.OK)
            {
                OpenNmtProvider testProvider = new OpenNmtProvider(dialog.Options);
                return(new ITranslationProvider[] { testProvider });
            }
            return(null);
        }
Esempio n. 3
0
        /// <summary>
        /// Instantiates the variables and fills the list file content into
        /// a Dictionary collection object.
        /// </summary>
        /// <param name="provider"></param>
        /// <param name="languages"></param>
        #region "ListTranslationProviderLanguageDirection"
        public ListTranslationProviderLanguageDirection(OpenNmtProvider provider, LanguagePair languages)
        {
            #region "Instantiate"
            // UT.LogMessageToFile("Init ListTranslationProviderLanguageDirection");
            _provider          = provider;
            _languageDirection = languages;
            _options           = _provider.Options;

            _visitor            = new ListTranslationProviderElementVisitor(_options);
            _listOfTranslations = new Dictionary <string, string>();
            #endregion
        }
        /// <summary>
        /// If the plug-in settings can be changed by the user,
        /// SDL Trados Studio will display a Settings button.
        /// By clicking this button, users raise the plug-in user interface,
        /// in which they can modify any applicable settings.
        /// </summary>
        /// <param name="owner"></param>
        /// <param name="translationProvider"></param>
        /// <param name="languagePairs"></param>
        /// <param name="credentialStore"></param>
        /// <returns></returns>
        #region "Edit"
        public bool Edit(IWin32Window owner, ITranslationProvider translationProvider, LanguagePair[] languagePairs, ITranslationProviderCredentialStore credentialStore)
        {
            OpenNmtProvider editProvider = translationProvider as OpenNmtProvider;

            if (editProvider == null)
            {
                return(false);
            }

            OpenNMTConfDialog dialog = new OpenNMTConfDialog(editProvider.Options, languagePairs);

            if (dialog.ShowDialog(owner) == DialogResult.OK)
            {
                editProvider.Options = dialog.Options;
                return(true);
            }

            return(false);
        }