public void DoWorkTest() { var wordReaderMock = new Mock<IWordReader>(); wordReaderMock.As<IEnumerable<string>>(); wordReaderMock.Setup(x => x.GetEnumerator()).Returns( new List<string> { "t1", "t2" }.GetEnumerator()); var wordWriteMock = new Mock<IWordWriter>(); var translatorMock = new Mock<ITranslator>(); ManualResetEvent mre; var translatorCreatorMock = new Mock<ITranslatorCreator>(); translatorCreatorMock.Setup(x => x.CreateTranslator( It.IsAny<ITranslationManager>(), It.IsAny<string>(), out mre)). Returns(translatorMock.Object); var translator = new TranslationManager( wordReaderMock.Object, wordWriteMock.Object, translatorCreatorMock.Object); translator.DoWork(); wordWriteMock.Verify(x => x.OnComplete(), Times.Once()); translatorMock.Verify(x => x.ThreadPoolCallback(It.IsAny<object>()), Times.Exactly(2)); wordReaderMock.VerifyAll(); wordWriteMock.VerifyAll(); translatorMock.VerifyAll(); translatorCreatorMock.VerifyAll(); }
void Awake() { if (instance != null) { Debug.LogError("Only one 'TranslationManager' per scene allowed."); } instance = this; translateableContents = new List <TranslatableContent>(); translateableContents.Clear(); }
private void SetSceneTranslation() { foreach (Text textLabel in menuTextItems) { if (TranslationManager.GetLocalizationDictionary().ContainsKey(textLabel.name)) { textLabel.text = TranslationManager.GetLocalizationDictionary()[textLabel.name]; } } }
private void InitControlsWithoutParent() { this.msMenu.Visible = true; this.tcBetaData.Location = new System.Drawing.Point(11, 35); this.tcBetaData.Size = new System.Drawing.Size(670, 381); this.lblValueName.Text = TranslationManager.GetManager().Translate("None"); this.btnBrowse.Visible = false; this.btnAction.Click += this.bntAction_Create_Click; this._betaData.DependencyProducts.ListChanged += DependencyProducts_ListChanged; }
public static void Go(Compilation compilation, string outDir, IEnumerable <string> extraTranslation) { TranslationManager.Init(extraTranslation); Compilation = compilation; OutDir = outDir; Utility.Parallel(new Action[] { Build, Generate }, a => a()); }
private void Translate() { this.Text = TranslationManager.GetManager().Translate("Options"); this.btnCancel.Text = TranslationManager.GetManager().Translate("Cancel"); foreach (OptionsTreeNode node in this.tvOptions.Nodes) { node.Text = TranslationManager.GetManager().Translate(node.Name); node.Options.OptionsContainer.Translate(); } }
// Start is called before the first frame update void Start() { TranslationManager.scene = "Profile"; games_won.text = TranslationManager.Get("games_won") != string.Empty ? TranslationManager.Get("games_won") : games_won.text; in_a_row.text = TranslationManager.Get("in_a_row") != string.Empty ? TranslationManager.Get("in_a_row") : in_a_row.text; favourite.text = TranslationManager.Get("favourite") != string.Empty ? TranslationManager.Get("favourite") : favourite.text; verified.text = TranslationManager.Get("verified") != string.Empty ? TranslationManager.Get("verified") : verified.text; pending.text = TranslationManager.Get("pending") != string.Empty ? TranslationManager.Get("pending") : pending.text; unverified.text = TranslationManager.Get("unverified") != string.Empty ? TranslationManager.Get("unverified") : unverified.text; history.text = TranslationManager.Get("history") != string.Empty ? TranslationManager.Get("history") : history.text; }
// public override void UpdateTranslation() { // Static method to access translations. // In this example, a generated constant is used to access the translation (avoids typos and makes refactoring easier). // The path to the generated resources folder is specified in the TranslationManager. // After the translation key, further arguments can be given in the form [key1, value1, key2, value2, ...]. GetComponent <Text>().text = TranslationManager.GetTranslation(R.Messages.sampleScene_staticMethodAccessExample, "city", city, "age", age); }
public void UpdateTranslation() { if (!Application.isPlaying && backButton == null) { SceneInjectionManager.Instance.DoInjection(); } ratePlayersContainer.Q <Label>().text = TranslationManager.GetTranslation(R.Messages.options_ratePlayers); combineDuetScoresContainer.Q <Label>().text = TranslationManager.GetTranslation(R.Messages.options_combineDuetScores); backButton.text = TranslationManager.GetTranslation(R.Messages.back); sceneTitle.text = TranslationManager.GetTranslation(R.Messages.options_game_title); }
public void Continue() { if (SaveSystem.CheckSaveDataExistence()) { SaveSystem.newGame = false; TranslationManager.UnsubscribeDelegates(); FMODPlayer.StopAllSounds(); FMODPlayer.Instance.Play("new game"); loadingPanel.Open("SampleScene"); } }
public string GetNameString() { string name = ""; nameGenderLink ngl = getNameAndGenderFromValue(); if (ngl != null) { name = TranslationManager.translateIfAvail(ngl.name) + " " + getSurnameFromValue(); } return(name); }
public void PrepareSelectedObjectToReceiveBehavior() { if (selectedObject == -1) { DebugMessage.ErrorMessage(TranslationManager.GetMessage("SelectObjectFirst")); PanelLoadBg.AbortLoadStatic(); return; } Debug.Log("Preparing object " + selectedObjectName + " to receive behavior."); PanelLoadBg.SetProgrammableObjectStatic(GetIthObjectInSceneTransform(selectedObject).GetComponent <ProgrammableObject>()); }
private void UpdateFps() { frameCountTime += Time.deltaTime; frameCount++; if (frameCountTime > 1) { int fps = (int)(frameCount / frameCountTime); fpsText.text = TranslationManager.GetTranslation(R.Messages.fps, "value", fps); frameCount = 0; frameCountTime = 0; } }
public void UpdateTranslation() { if (!Application.isPlaying && connectionStatusText == null) { SceneInjectionManager.Instance.DoInjection(); } connectionStatusText.text = TranslationManager.GetTranslation(R.Messages.connecting); sceneTitle.text = TranslationManager.GetTranslation(R.Messages.title); visualizeAudioToggle.label = TranslationManager.GetTranslation(R.Messages.visualizeMicInput); showSongListButton.text = TranslationManager.GetTranslation(R.Messages.songList_show); closeSongListButton.text = TranslationManager.GetTranslation(R.Messages.songList_hide); }
public void UpdateTranslation() { if (!Application.isPlaying && backButton == null) { SceneInjectionManager.Instance.DoInjection(); } showFpsContainer.Q <Label>().text = TranslationManager.GetTranslation(R.Messages.options_showFps); pitchDetectionAlgorithmContainer.Q <Label>().text = TranslationManager.GetTranslation(R.Messages.options_pitchDetectionAlgorithm); analyzeBeatsWithoutTargetNoteContainer.Q <Label>().text = TranslationManager.GetTranslation(R.Messages.options_analyzeBeatsWithoutTargetNote); backButton.text = TranslationManager.GetTranslation(R.Messages.back); sceneTitle.text = TranslationManager.GetTranslation(R.Messages.options_development_title); }
private async Task ProcessCommandAsync(SocketMessage arg) { // Source filter if (arg.Source != MessageSource.User) { return; } var message = (SocketUserMessage)arg; // Get the prefix string pfx; try { pfx = await GetPrefix(arg); } catch (Exception e) { string src = message.Channel is IGuildChannel gc ? $"{gc.Guild.Name} ({gc.Guild.Id})" : $"{message.Channel.Name}"; Logger.GetLogger("Commands").Warning($"Failed to get prefix. {src}", e); return; } // Command check int argPos = 0; if (message.HasStringPrefix(pfx, ref argPos)) { // Refresh the cached prefix if (message.Channel is IGuildChannel c) { pm.RestoreCache(c.GuildId).Release(); } var context = new SocketCommandContext(client, message); // Log message for debugging (doesn't check if the command exists) Logger.GetLogger("Commands").Debug($"Executing command: {GetExecutionInfo(context)}"); // Execute command await commands.ExecuteAsync(context, argPos, services); } else if (message.Content.TrimEnd() == $"{pm.DefaultPrefix}prefix") { // Info var context = new SocketCommandContext(client, message); Logger.GetLogger("Commands").Debug($"Executing prefix get with default prefix: {GetExecutionInfo(context)}"); var ts = await TranslationManager.CreateFor(context.Channel); message.Channel.SendMessageAsync(embed: EmbedFactory.CreateSuccess() .WithTitle(ts.GetMessage("commands/prefix:embed_title")) .WithDescription(MessageFormatter.Format(ts.GetMessage("commands/prefix:my_prefix_is"), PrefixManagerService.PrettyPrefix(pfx))) .Build()).Release(); } }
private void UpdateConnectedClients() { connectedClientList.Clear(); serverSideConnectRequestManager.GetAllConnectedClientHandlers() .ForEach(clientHandler => { connectedClientList.Add(CreateClientEntry(clientHandler)); }); connectedClientCountLabel.text = TranslationManager.GetTranslation(R.Messages.options_connectedClientCount, "count", ServerSideConnectRequestManager.ConnectedClientCount); }
private static void InitializeManagers() { Assembly assembly = Assembly.GetAssembly(typeof(Application)); OptionsManager.GetManager().Initialize(Application.OPTIONS_PATH, assembly); int currentLanguage = (OptionsManager.GetManager().OptionsCollection["GeneralOptions"] as GeneralOptions).Language; TranslationManager.GetManager().Initialize(Application.TRANSLATIONS_PATH, currentLanguage); PerformanceManager.Instance.Initialize(); }
public async Task Purge([Remainder] string args = null) { // Delete message await Context.Message.DeleteAsync(); // Respond var ts = await TranslationManager.CreateFor(Context.Channel); var m = await ReplyAsync(ts.GetMessage("commands/purge:delet_this_success")); m.DeleteAfterDelay(5000).Release(); }
static bool GetTermTranslationPrefix(string Term, string overrideLanguage, ref string __result) { if (overrideLanguage != null && overrideLanguage == "English") { return(true); } if (Term == null) { return(true); } return(!TranslationManager.TryGetTranslation(Term, out __result)); }
public void UpdateTranslation() { if (!Application.isPlaying && backButton == null) { SceneInjectionManager.Instance.DoInjection(); } resolutionContainer.Q <Label>().text = TranslationManager.GetTranslation(R.Messages.options_resolution); fpsContainer.Q <Label>().text = TranslationManager.GetTranslation(R.Messages.options_targetFps); fullscreenContainer.Q <Label>().text = TranslationManager.GetTranslation(R.Messages.options_fullscreenMode); backButton.text = TranslationManager.GetTranslation(R.Messages.back); sceneTitle.text = TranslationManager.GetTranslation(R.Messages.options_graphics_title); }
// Start is called before the first frame update void Start() { TranslationManager.scene = "ResultWin"; you_win.text = TranslationManager.Get("you_win") != string.Empty ? TranslationManager.Get("you_win") : you_win.text; score1.text = TranslationManager.Get("score") != string.Empty ? TranslationManager.Get("score") : score1.text; score2.text = TranslationManager.Get("score") != string.Empty ? TranslationManager.Get("score") : score2.text; victory.text = TranslationManager.Get("victory") != string.Empty ? TranslationManager.Get("victory") : victory.text; congratulation.text = TranslationManager.Get("congratulation") != string.Empty ? TranslationManager.Get("congratulation") : congratulation.text; date.text = TranslationManager.Get("date") != string.Empty ? TranslationManager.Get("date") : date.text; ID.text = TranslationManager.Get("ID") != string.Empty ? TranslationManager.Get("ID") : ID.text; _continue.text = TranslationManager.Get("continue") != string.Empty ? TranslationManager.Get("continue") : _continue.text; }
private void OnTriggerStay(Collider hitCollider) { if (hitCollider.CompareTag("Player") && IsOpenable) { objectHintText.text = ShowHint ? TranslationManager.GetLocalizationDictionary()["DoorHintMeshTextLabel"] : string.Empty; if (Input.GetKey("f")) { OpenDoor(DoorSide); } } }
public void UpdateTranslation() { if (!Application.isPlaying && backButton == null) { SceneInjectionManager.Instance.DoInjection(); } backgroundMusicEnabledLabel.text = TranslationManager.GetTranslation(R.Messages.options_backgroundMusicEnabled); previewVolumeLabel.text = TranslationManager.GetTranslation(R.Messages.options_previewVolume); volumeLabel.text = TranslationManager.GetTranslation(R.Messages.options_volume); backButton.text = TranslationManager.GetTranslation(R.Messages.back); sceneTitle.text = TranslationManager.GetTranslation(R.Messages.options_sound_title); }
public void Install() { string de = "<root><e1>t1</e1><e2>t2</e2><e3>t3</e3><e4>t4</e4></root>"; string de_name = "<root><e1>d1</e1><e2>d2</e2><e3>d3</e3><e4>d4</e4><e5>d5</e5></root>"; string en = "<root><e1>en t1</e1><e2>en t2</e2><e3>t3</e3><e6>en t6</e6></root>"; TranslationManager.CurrentCulture = new System.Globalization.CultureInfo("de"); TranslationManager.Add(de.ToStream(), ".xml", new System.Globalization.CultureInfo("de")); TranslationManager.Add(de_name.ToStream(), ".xml", new System.Globalization.CultureInfo("de"), "name"); TranslationManager.Add(en.ToStream(), ".xml", new System.Globalization.CultureInfo("en")); }
// Start is called before the first frame update void Start() { TranslationManager.scene = "ResultWaiting"; waiting_for.text = TranslationManager.Get("waiting_for") != string.Empty ? TranslationManager.Get("waiting_for") : waiting_for.text; player_2.text = TranslationManager.Get("player_2") != string.Empty ? TranslationManager.Get("player_2") : player_2.text; score.text = TranslationManager.Get("score") != string.Empty ? TranslationManager.Get("score") : score.text; continue_now.text = TranslationManager.Get("continue_now") != string.Empty ? TranslationManager.Get("continue_now") : continue_now.text; and_get_results_later.text = TranslationManager.Get("and_get_results_later") != string.Empty ? TranslationManager.Get("and_get_results_later") : and_get_results_later.text; date.text = TranslationManager.Get("date") != string.Empty ? TranslationManager.Get("date") : date.text; ID.text = TranslationManager.Get("ID") != string.Empty ? TranslationManager.Get("ID") : ID.text; _continue.text = TranslationManager.Get("continue") != string.Empty ? TranslationManager.Get("continue") : _continue.text; }
private async Task CommandExecutedAsync(Optional <CommandInfo> command, ICommandContext ctx, IResult result) { // Some error occured in command execution if (!result.IsSuccess) { var ts = await TranslationManager.CreateFor(ctx.Channel); string message; if (command.IsSpecified) { try { message = ts.GetMessage(result.ErrorReason); } catch (FormatException) { message = ts.GetMessage("errors:command_errored"); } } else { message = ts.GetMessage("command_not_found"); } await ctx.Channel.SendMessageAsync(message) .ContinueWith(t => { if (!t.IsCompletedSuccessfully) { Logger.GetLogger("Commands").Info($"Failed to send error message: {t.Exception.InnerException.Message}"); } else { t.Result.DeleteAfterDelay(5000).GetAwaiter().GetResult(); } }).ConfigureAwait(false); } // Log var sb = new StringBuilder(); if (!command.IsSpecified) { sb.Append("Unspecified command: "); } else { sb.Append("Executed command: "); } sb.AppendLine(GetExecutionInfo(ctx)); Logger.GetLogger("Commands").Info(sb.ToString()); }
public void Calculate() { this.gbStats.Text = "对话统计(计算...)"; this.statsThread = new Thread(() => { float single; int num; int num1; int num2; TranslationManager.GetStats(out single, out num, out num1, out num2); single = (float)((int)Math.Round((double)single * 1000)) / 1000f; int length = 0; char[] chrArray = new char[] { ' ', '\n' }; Dictionary <string, byte> strs = new Dictionary <string, byte>(); foreach (GameData.Item value in this.nav.ou.gameData.items.Values) { if (value.type != itemType.DIALOGUE_LINE) { continue; } foreach (KeyValuePair <string, object> keyValuePair in value) { if (value.getState(keyValuePair.Key) == GameData.State.ORIGINAL || !keyValuePair.Key.StartsWith("text")) { continue; } string str = keyValuePair.Value as string; if (strs.ContainsKey(str)) { continue; } strs.Add(str, 0); length += (int)str.Split(chrArray, StringSplitOptions.RemoveEmptyEntries).Length; } } StreamWriter streamWriter = new StreamWriter(string.Concat(TranslationManager.ActiveTranslation.path, "/translated.txt"), false, Encoding.UTF8); foreach (string key in strs.Keys) { streamWriter.WriteLine(key); } streamWriter.Flush(); streamWriter.Close(); base.BeginInvoke(new MethodInvoker(() => { this.lblCompletePercentage.Text = string.Concat(single.ToString(), "%"); this.lblTranslatedSource.Text = num.ToString(); this.lblWordsTotal.Text = num1.ToString(); this.lblWordsExtra.Text = num2.ToString(); this.lblTranslatedWords.Text = length.ToString(); this.gbStats.Text = "对话统计"; })); }); this.statsThread.Start(); }
public string getGenderText() { if (vs != null) { int index = Mathf.RoundToInt(vs.value); if (index >= genders.Length) { index = genders.Length - 1; } return(TranslationManager.translateIfAvail(genders [index].gender)); } return(null); }
// Start is called before the first frame update void Start() { TranslationManager.scene = "ReplayChallenge"; sorry.text = TranslationManager.Get("sorry") != string.Empty ? TranslationManager.Get("sorry") : sorry.text; bug.text = TranslationManager.Get("bug") != string.Empty ? TranslationManager.Get("bug") : bug.text; replay_now.text = TranslationManager.Get("replay_now") != string.Empty ? TranslationManager.Get("replay_now") : replay_now.text; game_id.text = TranslationManager.Get("game_id") != string.Empty ? TranslationManager.Get("game_id") : game_id.text; date.text = TranslationManager.Get("date") != string.Empty ? TranslationManager.Get("date") : date.text; prize.text = TranslationManager.Get("prize") != string.Empty ? TranslationManager.Get("prize") : prize.text; your_opponent.text = TranslationManager.Get("your_opponent") != string.Empty ? TranslationManager.Get("your_opponent") : your_opponent.text; is_waiting.text = TranslationManager.Get("is_waiting") != string.Empty ? TranslationManager.Get("is_waiting") : is_waiting.text; play_now.text = TranslationManager.Get("play_now") != string.Empty ? TranslationManager.Get("play_now") : play_now.text; }
/* * Load the surname from its value script */ public string getSurnameFromValue() { if (vs_surname != null) { int index = Mathf.RoundToInt(vs_surname.value); if (index >= Countries [getCountryIndexFromValue()].surname.Length) { index = Countries [getCountryIndexFromValue()].surname.Length - 1; } return(TranslationManager.translateIfAvail(Countries [getCountryIndexFromValue()].surname [index])); } return(""); }