public ProcessingService(ILogger <ProcessingService> logger, ProcessingManager processingManager, TranslatorManager translatorManager) { this.logger = logger; this.processingManager = processingManager; this.translatorManager = translatorManager; Parameters = new ProcessingServiceParameters(); }
public HttpResponseMessage GetTermsForMobile() { var TranslatorMgr = new TranslatorManager(); var result = TranslatorMgr.GetTermsForMobile(Language); return(OkResponse(result)); }
public HttpResponseMessage GetDalalAdditionalWarning() { var TranslatorMgr = new TranslatorManager(); var result = TranslatorMgr.GetDalalAdditionalWarning(Language); return(OkResponse <string>(result)); }
private int WriteAssemblyInfo(IAssembly assembly, ILanguageWriterConfiguration configuration) { ILanguage language = LanguageManager.ActiveLanguage; ITranslator translator = TranslatorManager.CreateDisassembler("Xml", null); int exceptions = 0; using (StreamWriter streamWriter = CreateFile(string.Empty, "AssemblyInfo")) { TextFormatter formatter = new TextFormatter(); try { ILanguageWriter writer = language.GetWriter(formatter, configuration); assembly = translator.TranslateAssembly(assembly, false); writer.WriteAssembly(assembly); foreach (IModule module in assembly.Modules) { IModule visitedModule = translator.TranslateModule(module, false); writer.WriteModule(visitedModule); foreach (IAssemblyReference assemblyReference in module.AssemblyReferences) { IAssemblyReference visitedAssemblyReference = translator.TranslateAssemblyReference(assemblyReference); writer.WriteAssemblyReference(visitedAssemblyReference); } foreach (IModuleReference moduleReference in module.ModuleReferences) { IModuleReference visitedModuleReference = translator.TranslateModuleReference(moduleReference); writer.WriteModuleReference(visitedModuleReference); } } foreach (IResource resource in assembly.Resources) { writer.WriteResource(resource); } } catch (Exception exception) { streamWriter.WriteLine(exception.ToString()); WriteLine(exception.ToString()); exceptions++; } string output = formatter.ToString().Replace("\r\n", "\n").Replace("\n", "\r\n"); streamWriter.WriteLine(output); } return(exceptions); }
// Use this for initialization void Start() { selectedFish = UIGameManager.instance.selectedFish; selectedFishData = ItemManager.instance.GetItemFishDataById(selectedFish.itemFish.baseId); tm = TranslatorManager.instance; itemName.text = tm.GetTranslationById("fish_name_" + selectedFishData.id); //selectedFishData.fishName; itemLength.text = selectedFish.itemFish.length.ToString() + " " + tm.GetTranslationById("measurement_inches"); itemWeight.text = selectedFish.itemFish.weight.ToString() + " " + tm.GetTranslationById("measurement_pounds"); itemRarity.text = tm.GetTranslationById("rarity_" + selectedFishData.rarity); itemImage.sprite = selectedFishData.fishPortraitImage; itemImage.preserveAspect = true; imageHeight = selectedFish.transform.parent.gameObject.GetComponent <RectTransform>().rect.height; transform.position = new Vector3(selectedFish.transform.position.x, selectedFish.transform.position.y + (Screen.height / 100) * 5, 0); }
public AssetService(ILogger <AssetService> logger, RoutersManager routersManager, SupplierManager suppliersManager, TranslatorManager translatorManager, CarrierManager carrierManager, ICredentials credentials) { this.logger = logger; this.routersManager = routersManager; this.suppliersManager = suppliersManager; this.translatorManager = translatorManager; this.carrierManager = carrierManager; this.credentials = credentials; }
private int WriteTypeDeclaration(ITypeDeclaration typeDeclaration, ILanguageWriterConfiguration configuration) { ILanguage language = LanguageManager.ActiveLanguage; ITranslator translator = TranslatorManager.CreateDisassembler("Xml", null); int exceptions = 0; using (StreamWriter streamWriter = CreateTypeDeclarationFile(typeDeclaration)) { INamespace namespaceItem = new Namespace(); namespaceItem.Name = typeDeclaration.Namespace; try { if (language.Translate) { typeDeclaration = translator.TranslateTypeDeclaration(typeDeclaration, true, true); } namespaceItem.Types.Add(typeDeclaration); } catch (Exception ex) { streamWriter.WriteLine(ex.ToString()); WriteLine(ex.ToString()); exceptions++; } TextFormatter formatter = new TextFormatter(); ILanguageWriter writer = language.GetWriter(formatter, configuration); try { writer.WriteNamespace(namespaceItem); } catch (Exception exception) { streamWriter.WriteLine(exception.ToString()); WriteLine(exception.ToString()); } string output = formatter.ToString().Replace("\r\n", "\n").Replace("\n", "\r\n"); streamWriter.WriteLine(output); } return(exceptions); }
private void BuildUI() { Table = new DataTable(); var keyColumn = Table.Columns.Add("Key"); keyColumn.ReadOnly = true; allKeys = new List <string>(); foreach (var language in TranslatorManager.AvailableLanguages) { var translator = TranslatorManager.GetTranslator(language.Name); Table.Columns.Add(translator.Language.Name); foreach (var key in translator.Dictionary.Keys) { if (!allKeys.Contains(key.ToString())) { allKeys.Add(key.ToString()); } } } allKeys.Sort(); foreach (var key in allKeys) { var cols = new List <string> { key }; foreach (var language in TranslatorManager.AvailableLanguages) { string languageValue = null; var translator = TranslatorManager.GetTranslator(language.Name); if (translator.Dictionary.ContainsKey(key)) { languageValue = translator.Dictionary[key].ToString(); } cols.Add(languageValue); } var row = Table.Rows.Add(cols.ToArray()); } }
//Awake is always called before any Start functions void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); baseUITranslation.AddRange(Resources.LoadAll <UITranslation>("Translations Data")); for (int i = 0; i < baseUITranslation.Count; i++) { for (int j = 0; j < baseUITranslation[0].dataArray.Length; j++) { uiTranslation.Add(baseUITranslation[0].dataArray[j].Id, baseUITranslation[0].dataArray[j]); } } }
public void Dispose() { m_translatorManager = null; m_InfoCache.Clear(); }
private void DataProcess(object sender, HookParam hp) { // Refresh gameViewModel.AppendTextList.Clear(); // User define RegExp var pattern = GameConfig.RegExp; if (!string.IsNullOrEmpty(pattern)) { var list = Regex.Split(hp.Text, pattern); hp.Text = string.Join("", list); } // Clear ascii control characters hp.Text = new string(hp.Text.Select(c => c < ' ' ? '_' : c).ToArray()).Replace("_", string.Empty); // Linebreak // Full-width space hp.Text = hp.Text.Replace(" ", string.Empty); // Ruby like <.*?> if (hp.Text.Length > 120) { gameViewModel.TextControl.SourceTextCollection.Clear(); AppendDataEvent?.Invoke(typeof(GameViewDataService), Language.Strings.GameView_MaxLenthTip, string.Empty); return; } // DeepL Extension if (DataRepository.PasteToDeepL) { Process[] temp = Process.GetProcessesByName("DeepL"); if (temp.Length != 0) { IntPtr handle = temp[0].MainWindowHandle; NativeMethods.SwitchToThisWindow(handle); // Do SetText and Paste both new DeepLHelper(DataFormats.Text, hp.Text).Go(); if (NativeMethods.GetForegroundWindow() != handle) { // Better use Toast in win10 Application.Current.Dispatcher.InvokeAsync(() => ModernWpf.MessageBox.Show( "Didn't find DeepL client in front, will turn off DeepL extension..", "Eroge Helper")); DataRepository.PasteToDeepL = false; } } } gameViewModel.SourceTextArchiver.Enqueue(hp.Text); gameViewModel.TextControl.CardControl.TotalText = hp.Text; // Process source japanese text if (mecabViewModel.MecabToggle) { var collect = Utils.BindableTextMaker(mecabHelper.IpaDicParser(hp.Text)); SourceDataEvent?.Invoke(typeof(GameViewDataService), collect); } if (Utils.NetIsConnected) { foreach (var translator in TranslatorManager.GetEnabled()) { Task.Run(async() => { Stopwatch sw = new(); sw.Start(); var result = await translator.TranslateAsync(hp.Text, DataRepository.TransSrcLanguage, DataRepository.TransTargetLanguage); sw.Stop(); if (!result.Equals(string.Empty)) { Log.Debug($"{translator.Name}: {result}"); AppendDataEvent?.Invoke(typeof(GameViewDataService), result, $"{translator.Name} {sw.ElapsedMilliseconds}ms"); } }); } } // hard code for sakura no uta //if (GameConfig.MD5.Equals("BAB61FB3BD98EF1F1538EE47A8A46A26")) //{ // string result = sakuraNoUtaHelper.QueryText(hp.Text); // if (!string.IsNullOrWhiteSpace(result)) // AppendDataEvent?.Invoke(typeof(GameViewDataService), result, "人工字幕 by luki"); //} }