public ValueTranslatorFilter(ITranslatorService translatorService, Func <string> getClientNameMethod)
 {
     InternalContract.RequireNotNull(translatorService, nameof(translatorService));
     InternalContract.RequireNotNull(getClientNameMethod, nameof(getClientNameMethod));
     TranslatorService    = translatorService;
     _getClientNameMethod = getClientNameMethod;
 }
Example #2
0
 public GenresController(
     IGameService gameService,
     ITranslatorService translatorService)
 {
     _gameService       = gameService;
     _translatorService = translatorService;
 }
 public GatewayCheckoutService(IWebAPIClient webApiClient, ITranslatorService translatorService, IHttpContextService httpContextService, IRepository repository)
 {
     _webApiClient       = webApiClient;
     _translatorService  = translatorService;
     _httpContextService = httpContextService;
     _repository         = repository;
 }
 public VisionService(IOptions <VisionSetting> visionSetting, ITranslatorService translatorService, ILogger logger)
 {
     this.VisionServiceClient = new VisionServiceClient(
         visionSetting.Value.APIKey,
         visionSetting.Value.Endpoint);
     this.TranslatorService = translatorService;
     this.Logger            = logger;
 }
Example #5
0
 public JobsController(IJobsRepo jobsRepo, IJobScheduler jobScheduler, ISendMessageToQueue sendMessageToQueue, IBuddiesRepo buddiesRepo, ITranslatorService translatorService)
 {
     _jobsRepo           = jobsRepo;
     _jobScheduler       = jobScheduler;
     _sendMessageToQueue = sendMessageToQueue;
     _buddiesRepo        = buddiesRepo;
     _translatorService  = translatorService;
 }
Example #6
0
 /// <summary>
 /// Set up a new client translator.
 /// </summary>
 /// <param name="idConceptName">The <see cref="IdConceptName"/>.</param>
 /// <param name="getClientNameMethod">The <see cref="GetClientNameMethod"/>.</param>
 /// <param name="translatorService">The <see cref="TranslatorService"/>.</param>
 protected ClientTranslatorBase(string idConceptName, System.Func <string> getClientNameMethod, ITranslatorService translatorService)
 {
     InternalContract.RequireNotNullOrWhiteSpace(idConceptName, nameof(idConceptName));
     InternalContract.RequireNotNull(getClientNameMethod, nameof(getClientNameMethod));
     InternalContract.RequireNotNull(translatorService, nameof(translatorService));
     IdConceptName       = idConceptName;
     GetClientNameMethod = getClientNameMethod;
     TranslatorService   = translatorService;
 }
Example #7
0
 public GamesController(
     IGameService gameService,
     ITranslatorService translatorService,
     IClasificationTableService clasificationTableService)
 {
     _clasificationTableService = clasificationTableService;
     _gameService       = gameService;
     _translatorService = translatorService;
 }
        public TranslatorServiceHelper(string url = null, string key = null, string lang = "uk")
        {// урл і ключ не можна витягнути з веб-конфіга, якщо запускається консольний проект
            if (string.IsNullOrEmpty(url)) url = System.Web.Configuration.WebConfigurationManager.AppSettings["url"];
            if (string.IsNullOrEmpty(key)) key = System.Web.Configuration.WebConfigurationManager.AppSettings["key"];

            // створюєм транслятор, відразу ж підгружаємо список всіх доступних мов та напрямків перекладу
            translator = new YandexTranslatorService(url, key);
            allLangs = translator.GetAvailableLangs(lang);
            availableTranslateDirs = translator.GetTranslateDir();
        }
Example #9
0
 public TranslatorController(ICurrentUserService currentUserService,
                             ITranslatorService translatorService,
                             ITranslatorGroupService translatorGroupService,
                             IBus publisher)
 {
     this.currentUserService     = currentUserService;
     this.translatorService      = translatorService;
     this.translatorGroupService = translatorGroupService;
     this.publisher = publisher;
 }
Example #10
0
        public MainViewModel(IStreamingService streamingService, VisionServiceClient visionServiceClient, ITranslatorService translatorService,
                             ISpeechService speechService)
        {
            this.streamingService    = streamingService;
            this.visionServiceClient = visionServiceClient;
            this.translatorService   = translatorService;
            this.speechService       = speechService;

            this.CreateCommands();
        }
 /// <summary>
 /// A translator for a specific <paramref name="clientName"/> that will use the <paramref name="service"/> for the actual translations.
 /// </summary>
 public Translator(string clientName, ITranslatorService service)
 {
     InternalContract.RequireNotNullOrWhiteSpace(clientName, nameof(clientName));
     InternalContract.RequireNotNull(service, nameof(service));
     _clientName        = clientName;
     _service           = service;
     _conceptValues     = new HashSet <string>();
     _translations      = new Dictionary <string, string>();
     _conceptValueRegex = new Regex(@"\(([^!]+)!([^!]+)!(.+)\)", RegexOptions.Compiled);
     _conceptValueAndNothingElseInStringRegex = new Regex("\"" + @"(\(([^!]+)!([^!]+)!(?:(?!\)" + "\"" + @").)+\))" + "\"", RegexOptions.Compiled);
 }
Example #12
0
        public void AddRegion(Scene scene)
        {
            scene.RegisterModuleInterface <ITranslatorModule> (this);
            gridUserService = scene.RequestModuleInterface <IGridUserService> ();
            lock (queuelock) {
                if (service == null)
                {
                    service = new TranslatorServiceGoogle();  // TranslatorServiceMyMemory (scene);

                    // make dictionary of all language codes we accept
                    // accept both the two-letter name and the full name
                    // map both those cases to the two-letter code
                    string[] lcs = service.AllLangCodes;
                    allLangCodes    = new string[lcs.Length + 1];
                    allLangCodes[0] = NOTRANSLATE + " DISABLE";
                    Array.Copy(lcs, 0, allLangCodes, 1, lcs.Length);

                    Dictionary <string, string> lcd = new Dictionary <string, string> ();
                    foreach (string alc in allLangCodes)
                    {
                        string alclo  = alc.ToLowerInvariant();
                        int    i      = alclo.IndexOf(' ');
                        string twolet = alclo.Substring(0, i);
                        lcd.Add(twolet, twolet);
                        lcd.Add(alclo.Substring(++i), twolet);
                    }
                    langcodedict = lcd;
                }

                if (++numregions == 1)
                {
                    runthread = true;
                    Thread thread = new Thread(TranslatorThread);
                    thread.Name     = "translator";
                    thread.Priority = ThreadPriority.Normal;

                    Watchdog.ThreadWatchdogInfo info = new Watchdog.ThreadWatchdogInfo(thread, WD_TIMEOUT_MS, thread.Name);
                    Watchdog.AddThread(info, thread.Name, true);

                    thread.Start();
                }

                MainConsole.Instance.Commands.AddCommand(
                    "translator",
                    false,
                    "translator",
                    "translator [...|help|...]",
                    "run translator commands",
                    ConsoleCommand
                    );
            }
        }
Example #13
0
        public OCRViewModel(ISettingsService settingsService = null)
        {
            this.settingsService = settingsService ?? DependencyService.Get <ISettingsService>();

            /*
             * var handler = new HttpClientHandler
             * {
             *  UseProxy = true,
             *  Proxy = new WebProxy("http://localhost:8888", false) // Or whatever Charles is set up as
             * };
             * var client = new HttpClient(handler)
             * {
             *  BaseAddress = new Uri(this.settingsService.TextRecognitionEndPoint)
             * };*/

            this.ocrService        = RestService.For <IOCRTextService>(this.settingsService.TextRecognitionEndPoint);
            this.translatorService = RestService.For <ITranslatorService>(this.settingsService.TranslatorEndPoint);
            this.luisService       = RestService.For <ILUISService>(this.settingsService.LuisEndPoint);
            this.ToggleTranslateVisibilityCommand = new Command(this.OnToggleTranslateVisibility);

            this.TranslationInterfaceVisibility = true;
        }
 /// <inheritdoc />
 public ManyToOneToServerTranslator(ICrudable <TModel, string> service, string idConceptName,
                                    System.Func <string> getServerNameMethod, ITranslatorService translatorService)
     : base(service, idConceptName, getServerNameMethod, translatorService)
 {
 }
Example #15
0
 private void InitializeServices()
 {
     this.visionService     = ViewModelLocator.VisionServiceClient;
     this.translatorService = ViewModelLocator.TranslatorService;
 }
Example #16
0
 public TranslateController(ITranslatorService translatorService)
 {
     _translatorService = translatorService;
 }
 /// <inheritdoc />
 public SlaveToMasterToServerTranslator(ICrudable <TModel, string> service,
                                        System.Func <string> getServerNameMethod, ITranslatorService translatorService)
     : base(service, getServerNameMethod, translatorService)
 {
 }
 /// <summary>
 /// Constructor
 /// </summary>
 public ConsentServerTranslatorTo(IGdprCapability gdprCapability, System.Func <string> getServerNameMethod, ITranslatorService translatorService)
     : base(gdprCapability.ConsentService, "consent.id", getServerNameMethod, translatorService)
 {
 }
 /// <summary>
 /// Set up a new client translator.
 /// </summary>
 /// <param name="idConceptName">The <see cref="IdConceptName"/>.</param>
 /// <param name="getServerNameMethod">The <see cref="GetServerNameMethod"/>.</param>
 /// <param name="translatorService">The <see cref="TranslatorService"/>. Originally expected to be null for translators from the server, but FakeTranslatorService was added for these obsolete classes.</param>
 protected ServerTranslatorBase(string idConceptName, System.Func <string> getServerNameMethod, ITranslatorService translatorService)
 {
     IdConceptName       = idConceptName;
     GetServerNameMethod = getServerNameMethod;
     TranslatorService   = translatorService;
 }
 /// <inheritdoc />
 public ServerTranslatorTo(IGdprCapability capablity, System.Func <string> getServerNameMethod, ITranslatorService translatorService)
 {
     PersonService        = new PersonServerTranslatorTo(capablity, getServerNameMethod, translatorService);
     ConsentService       = new ConsentServerTranslatorTo(capablity, getServerNameMethod, translatorService);
     PersonConsentService = new PersonConsentServerTranslatorTo(capablity, getServerNameMethod, translatorService);
     ConsentPersonService = new ConsentPersonServerTranslatorTo(capablity, getServerNameMethod, translatorService);
 }
        public static async Task <TranslationOrchestrationContext> TranslateDocument([ActivityTrigger] TranslationOrchestrationContext context, [Inject] ITranslatorService service, ILogger log)
        {
            context.TranslatedText = await service.TranslateAsync(context.SourceText, context.Language);

            return(context);
        }
 /// <inheritdoc />
 public CrudClientTranslator(ICrudable service, string idConceptName,
                             System.Func <string> getClientNameMethod, ITranslatorService translatorService)
     : base(service, idConceptName, getClientNameMethod, translatorService)
 {
 }
Example #23
0
 public TranslatorController(ITranslatorService service)
 {
     this.translatorService = service;
 }
Example #24
0
 public TranslatorController(ITranslatorService translatorService, ILogger <TranslatorController> logger)
 {
     _translatorService = translatorService ?? throw new ArgumentNullException(nameof(translatorService));
     _logger            = logger ?? throw new ArgumentNullException(nameof(logger));
 }
 public CarController(ICarService carService, ITranslatorService translatorService)
 {
     // Adding right service
     _carService        = carService;
     _translatorService = translatorService;
 }
Example #26
0
 public HomeController(ILogger <HomeController> logger, ITranslatorService translatorService)
 {
     _logger            = logger;
     _translatorService = translatorService;
 }
 public GatewayRefundService(IWebAPIClient webApiClient, ITranslatorService translatorService)
 {
     _webApiClient      = webApiClient;
     _translatorService = translatorService;
 }
Example #28
0
 /// <summary>
 /// Constructor
 /// </summary>
 public PersonConsentClientTranslator(IGdprCapability gdprCapability, System.Func <string> getclientNameMethod, ITranslatorService translatorService)
     : base(gdprCapability.PersonConsentService, "person.id", "consent.id", getclientNameMethod, translatorService)
 {
 }
Example #29
0
 /// <inheritdoc />
 public SlaveToMasterClientTranslator(ICrudable <TModel, string> service,
                                      string masterIdConceptName, string slaveIdConceptName, System.Func <string> getClientNameMethod,
                                      ITranslatorService translatorService)
     : base(service, masterIdConceptName, slaveIdConceptName, getClientNameMethod, translatorService)
 {
 }
Example #30
0
 public CognitiveClient(IVisionSettingsProvider visionSettingsProvider = null)
 {
     VisionSettingsProvider = visionSettingsProvider;
     translatorService      = new TranslatorService();
 }
 public ValueTranslatorFilterConfigureOptions(ITranslatorService translatorService)
 {
     _translatorService = translatorService;
 }