/// <summary> /// Create the basic UI button. /// </summary> /// <remarks> /// Hierarchy: /// (root) /// Button /// -Text /// </remarks> /// <param name="resources">The resources to use for creation.</param> /// <returns>The root GameObject of the created element.</returns> public static GameObject CreateButton(Resources resources) { GameObject buttonRoot = CreateUIElementRoot("Button", s_ThickElementSize); GameObject childText = new GameObject("Text"); childText.AddComponent <RectTransform>(); SetParentAndAlign(childText, buttonRoot); Image image = buttonRoot.AddComponent <Image>(); image.sprite = resources.standard; image.type = Image.Type.Sliced; image.color = s_DefaultSelectableColor; Button bt = buttonRoot.AddComponent <Button>(); SetDefaultColorTransitionValues(bt); LanguageText text = childText.AddComponent <LanguageText>(); text.text = "Button"; text.alignment = TextAnchor.MiddleCenter; SetDefaultTextValues(text); RectTransform textRectTransform = childText.GetComponent <RectTransform>(); textRectTransform.anchorMin = Vector2.zero; textRectTransform.anchorMax = Vector2.one; textRectTransform.sizeDelta = Vector2.zero; return(buttonRoot); }
public async Task <IActionResult> PutLanguageText([FromRoute] int id, [FromBody] LanguageText languageText) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != languageText.Id) { return(BadRequest()); } _context.Entry(languageText).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LanguageTextExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public Translation Exec(LanguageText Input, string OutputLanguage) { string OutputText = jGenerator.generate(Input.Text); LanguageText Output = new LanguageText(OutputLanguage, OutputText); return(new Translation(Input, Output)); }
public IActionResult Get( [FromQuery(Name = "text")] string InputText, [FromQuery(Name = "from")] string InputLanguage, [FromQuery(Name = "to")] string OutputLanguage ) { if (InputText is null || InputLanguage is null || OutputLanguage is null) { return(BadRequest("Missing query parameter")); } Translation translation; LanguageText Input = new LanguageText(InputLanguage, InputText); if (OutputLanguage == "Jeringonza") { IJeringonzaGenerator jg = new JeringonzaGenerator(); ITranslateText translate = new ToJeringonza(jg); translation = translate.Exec(Input, OutputLanguage); } else { ITextRepository db = new MockDatabase(); ITranslateText translate = new TranslateText(db); translation = translate.Exec(Input, OutputLanguage); if (translation is null) { return(NotFound("We're sorry - we couldn't find the translation for that")); } } return(Ok(translation)); }
public LanguageText Update(LanguageText updatedLanguageText) { var entity = db.LanguageText.Attach(updatedLanguageText); entity.State = Microsoft.EntityFrameworkCore.EntityState.Modified; return(updatedLanguageText); }
public void DisplayTopicInformation(LanguageText topic) { //make sure that the languagetext is indeed a topic. if (topic.referenceTopic) { //make sure we turn the image off and the textfields on. imageContent.gameObject.SetActive(false); textfieldContent.gameObject.SetActive(true); textfieldTitle.gameObject.SetActive(true); string title = "Unable to find a title for " + topic.name;//the title of this topic string content = "The same principle applies to a metabolic imbalance but in that case the bicarbonate informs us that a metabolic condition exists. Therefore, the CO2 would be compensating/partially compensating for HCO3-.The chart below may be helpful in seeing the number values associated with each imbalance but the numbers are only one part of the picture. The signs and symptoms a patient reports or exhibits are essential for understanding the patient’s condition and deciding upon the medical and nursing care management"; //"Unable to find content for " + topic.name;//the content LanguageManager lm = GetLanguageManager(); if (lm) { title = lm.TextTranslation(topic.xmlReferenceTopicSectionTitle,topic.xmlReferenceTopicID); content = lm.TextTranslation(topic.xmlReferenceTopicSectionContent, topic.xmlReferenceTopicID); } //2.25 x number of characters. layoutelementContent.minHeight = content.Length * 0.5f; textfieldTitle.text = title; textfieldContent.text = content; scrollbarContent.value = 1; Debug.Log(scrollbarContent.value); } }
//Add new Lanuguage internal void Addlanguage() { Console.WriteLine("******************************"); //implicit wait ExtentionHelpers.TurnOnWait(driver); //click on add new button AddNewLanguage.Click(); ExtentionHelpers.TurnOnWait(driver); //enter text in language field LanguageText.SendKeys(ExcelLibHelper.ReadData(3, "Language")); //select level from drop down new SelectElement(driver.FindElement(By.XPath("//select[@class='ui dropdown']"))).SelectByValue(ExcelLibHelper.ReadData(2, "LanguageLevel")); ExtentionHelpers.TurnOnWait(driver); //click on add button AddLanguage.Click(); ExtentionHelpers.TurnOnWait(driver); Console.WriteLine("Language added"); Console.WriteLine("******************************"); }
internal void OnLexiconGlossAdded(Lexeme lexeme, LexiconSense sense, LanguageText gloss) { if (LexiconGlossAdded != null) { LexiconGlossAdded(this, new FdoLexiconGlossAddedEventArgs(lexeme, sense, gloss)); } }
//Add new Lanuguage internal void Addlanguage() { //explicit wait GlobalDefinitions.WaitForClickableElement(driver, By.XPath("//a[text()='Languages']"), 30); //firstly click on language button LanguageButton.Click(); //implicit wait GlobalDefinitions.wait(30); //click on add new button AddNewLanguage.Click(); GlobalDefinitions.wait(30); //enter text in language field LanguageText.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Language")); //select level from drop down new SelectElement(driver.FindElement(By.XPath("//select[@class='ui dropdown']"))).SelectByValue(GlobalDefinitions.ExcelLib.ReadData(2, "LanguageLevel")); GlobalDefinitions.wait(30); //click on add button AddLanguage.Click(); GlobalDefinitions.wait(30); }
// Use this for initialization void Awake() { for (int i = 0; i < objectsToTranslate.Length; i++) { LanguageText.Translate(objectsToTranslate[i], translateToString[i]); } }
string GetText(LanguageText value) { if (_current.ContainsKey(value)) { return _current[value]; } return value.ToString(); }
public IActionResult OnGet(int id) { LanguageText = languageData.GetById(id); if (LanguageText == null) { return(RedirectToPage("./NotFound")); } return(Page()); }
/// <summary> /// Create the basic UI Toggle. /// </summary> /// <remarks> /// Hierarchy: /// (root) /// Toggle /// - Background /// - Checkmark /// - Label /// </remarks> /// <param name="resources">The resources to use for creation.</param> /// <returns>The root GameObject of the created element.</returns> public static GameObject CreateToggle(Resources resources) { // Set up hierarchy GameObject toggleRoot = CreateUIElementRoot("Toggle", s_ThinElementSize); GameObject background = CreateUIObject("Background", toggleRoot); GameObject checkmark = CreateUIObject("Checkmark", background); GameObject childLabel = CreateUIObject("Label", toggleRoot); // Set up components Toggle toggle = toggleRoot.AddComponent <Toggle>(); toggle.isOn = true; Image bgImage = background.AddComponent <Image>(); bgImage.sprite = resources.standard; bgImage.type = Image.Type.Sliced; bgImage.color = s_DefaultSelectableColor; Image checkmarkImage = checkmark.AddComponent <Image>(); checkmarkImage.sprite = resources.checkmark; LanguageText label = childLabel.AddComponent <LanguageText>(); label.text = "Toggle"; SetDefaultTextValues(label); toggle.graphic = checkmarkImage; toggle.targetGraphic = bgImage; SetDefaultColorTransitionValues(toggle); RectTransform bgRect = background.GetComponent <RectTransform>(); bgRect.anchorMin = new Vector2(0f, 1f); bgRect.anchorMax = new Vector2(0f, 1f); bgRect.anchoredPosition = new Vector2(10f, -10f); bgRect.sizeDelta = new Vector2(kThinHeight, kThinHeight); RectTransform checkmarkRect = checkmark.GetComponent <RectTransform>(); checkmarkRect.anchorMin = new Vector2(0.5f, 0.5f); checkmarkRect.anchorMax = new Vector2(0.5f, 0.5f); checkmarkRect.anchoredPosition = Vector2.zero; checkmarkRect.sizeDelta = new Vector2(20f, 20f); RectTransform labelRect = childLabel.GetComponent <RectTransform>(); labelRect.anchorMin = new Vector2(0f, 0f); labelRect.anchorMax = new Vector2(1f, 1f); labelRect.offsetMin = new Vector2(23f, 1f); labelRect.offsetMax = new Vector2(-5f, -2f); return(toggleRoot); }
public LanguageText Update(LanguageText updatedLanguageText) { var languageText = languageTexts.SingleOrDefault(x => x.Id == updatedLanguageText.Id); if (languageText != null) { } return(languageText); }
/// <summary> /// Create the basic UI input field. /// </summary> /// <remarks> /// Hierarchy: /// (root) /// InputField /// - PlaceHolder /// - Text /// </remarks> /// <param name="resources">The resources to use for creation.</param> /// <returns>The root GameObject of the created element.</returns> public static GameObject CreateInputField(Resources resources) { GameObject root = CreateUIElementRoot("InputField", s_ThickElementSize); GameObject childPlaceholder = CreateUIObject("Placeholder", root); GameObject childText = CreateUIObject("Text", root); Image image = root.AddComponent <Image>(); image.sprite = resources.inputField; image.type = Image.Type.Sliced; image.color = s_DefaultSelectableColor; InputField inputField = root.AddComponent <InputField>(); SetDefaultColorTransitionValues(inputField); LanguageText text = childText.AddComponent <LanguageText>(); text.text = ""; text.supportRichText = false; SetDefaultTextValues(text); Text placeholder = childPlaceholder.AddComponent <Text>(); placeholder.text = "Enter text..."; placeholder.fontStyle = FontStyle.Italic; // Make placeholder color half as opaque as normal text color. Color placeholderColor = text.color; placeholderColor.a *= 0.5f; placeholder.color = placeholderColor; RectTransform textRectTransform = childText.GetComponent <RectTransform>(); textRectTransform.anchorMin = Vector2.zero; textRectTransform.anchorMax = Vector2.one; textRectTransform.sizeDelta = Vector2.zero; textRectTransform.offsetMin = new Vector2(10, 6); textRectTransform.offsetMax = new Vector2(-10, -7); RectTransform placeholderRectTransform = childPlaceholder.GetComponent <RectTransform>(); placeholderRectTransform.anchorMin = Vector2.zero; placeholderRectTransform.anchorMax = Vector2.one; placeholderRectTransform.sizeDelta = Vector2.zero; placeholderRectTransform.offsetMin = new Vector2(10, 6); placeholderRectTransform.offsetMax = new Vector2(-10, -7); inputField.textComponent = text; inputField.placeholder = placeholder; return(root); }
/// <summary> /// Create the basic UI Text. /// </summary> /// <remarks> /// Hierarchy: /// (root) /// Text /// </remarks> /// <param name="resources">The resources to use for creation.</param> /// <returns>The root GameObject of the created element.</returns> public static GameObject CreateText(Resources resources) { GameObject go = CreateUIElementRoot("Text", s_ThickElementSize); LanguageText lbl = go.AddComponent <LanguageText>(); lbl.text = "New Text"; SetDefaultTextValues(lbl); return(go); }
public Translation Exec(LanguageText Input, string OutputLanguage) { string OutputText = textRepo.getSibling(Input.Language, Input.Text, OutputLanguage); if (OutputText is null) { return(null); } LanguageText Output = new LanguageText(OutputLanguage, OutputText); return(new Translation(Input, Output)); }
private void ApplyAnimation(string cultureInfo) { DoubleAnimation opacity = new DoubleAnimation(0, new Duration(new TimeSpan(0, 0, 0, 0, 300)), FillBehavior.HoldEnd); opacity.Completed += (send, ev) => { LocalizationManager.Instance.CurrentCulture = new CultureInfo(cultureInfo); var backOpacity = new DoubleAnimation(1, new Duration(new TimeSpan(0, 0, 0, 0, 300)), FillBehavior.HoldEnd); LanguageText.BeginAnimation(OpacityProperty, backOpacity); }; LanguageText.BeginAnimation(OpacityProperty, opacity); }
public async Task <IActionResult> PostLanguageText([FromBody] LanguageText languageText) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.LanguageText.Add(languageText); await _context.SaveChangesAsync(); return(CreatedAtAction("GetLanguageText", new { id = languageText.Id }, languageText)); }
public void DisplayNextSentence() { if (sentences.Count == 0) { EndDialogue(); } else { LanguageText sentence = sentences.Dequeue(); StopAllCoroutines(); StartCoroutine(TypeSentence(sentence.ToString())); } //dialogueText.SetText (sentence); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } LanguageText = await _context.LanguageText.FirstOrDefaultAsync(m => m.Id == id); if (LanguageText == null) { return(NotFound()); } return(Page()); }
private static void SetDefaultTextValues(LanguageText lbl) { // Set text values we want across UI elements in default controls. // Don't set values which are the same as the default values for the Text component, // since there's no point in that, and it's good to keep them as consistent as possible. lbl.color = s_TextColor; //Font font = UnityEngine.Resources.Load<Font>("UI/Fonts/"); lbl.font = UnityEngine.Resources.GetBuiltinResource <Font>("Arial.ttf"); lbl.raycastTarget = false; lbl.supportRichText = false; lbl.alignment = TextAnchor.MiddleCenter; lbl.transform.localPosition = Vector3.zero; // Reset() is not called when playing. We still want the default font to be assigned //lbl.AssignDefaultFont(); }
public LanguageText AddGloss(string language, string text) { LanguageText lexGloss = null; NonUndoableUnitOfWorkHelper.Do(m_gloss.Cache.ActionHandlerAccessor, () => { CoreWritingSystemDefinition ws; if (!m_lexicon.Cache.ServiceLocator.WritingSystemManager.TryGet(language, out ws)) { throw new ArgumentException("The specified language is unrecognized.", "language"); } m_gloss.Form.set_String(ws.Handle, text.Normalize(NormalizationForm.FormD)); lexGloss = new FdoLanguageText(language, text); }); m_lexicon.OnLexiconGlossAdded(new FdoWordformLexeme(m_lexicon, m_lexemeKey), this, lexGloss); return(lexGloss); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } LanguageText = await _context.LanguageText.FindAsync(id); if (LanguageText != null) { _context.LanguageText.Remove(LanguageText); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
private void Awake() { ltTitle = titleGO.GetComponent <LanguageText>(); ltDesc = descGO.GetComponent <LanguageText>(); ltButton = buttonGO.GetComponent <LanguageText>(); transform.Find("bg").gameObject.GetComponent <Button>().onClick.AddListener(delegate() { //this.gameObject.SetActive(false); Debug.Log("PanelManager.closeFrontendPanel 33"); PanelManager.closeFrontendPanel(); }); transform.Find("content/button").gameObject.GetComponent <Button>().onClick.AddListener(delegate() { //this.gameObject.SetActive(false); Debug.Log("PanelManager.closeFrontendPanel 22"); PanelManager.closeFrontendPanel(); }); }
public void WriteLanguageConfigToExcel() { //先清除之前的 LanguageConfigSheet.GetDictionary().Clear(); //加载所有数据 然后从内存写到excel SerializableSet configSet = Resources.Load <SerializableSet>("Config/SerializableSet"); Deserializer.Deserialize(configSet); Resources.UnloadUnusedAssets(); Dictionary <uint, LanguageConfigSheet> sheets = LanguageConfigSheet.GetDictionary(); //找到所有的LanguageText GameObject[] gameObjects = Resources.LoadAll <GameObject>(uiPrefabPath); for (int i = 0; i < gameObjects.Length; i++) { LanguageText[] languageTexts = gameObjects[i].transform.GetComponentsInChildren <LanguageText>(); for (int j = 0; j < languageTexts.Length; j++) { LanguageText languageText = languageTexts[j]; if (languageText.mLanguageId == 0) { continue; } LanguageConfigSheet sheet; if (sheets.TryGetValue(languageText.mLanguageId, out sheet)) { sheet.LanguageID = languageText.mLanguageId; sheet.Text = languageText.text; sheets[languageText.mLanguageId] = sheet; } else { sheet = new LanguageConfigSheet(); sheet.LanguageID = languageText.mLanguageId; sheet.Text = languageText.text; sheets.Add(sheet.LanguageID, sheet); } } } WriteExcel(sheets); }
public void NormalizeStrings() { Lexeme lex = m_lexicon.CreateLexeme(LexemeType.Stem, "Vacaci\u00f3n"); // Uses composed accented letter 'o' m_lexicon.AddLexeme(lex); lex = m_lexicon[new LexemeKey(LexemeType.Stem, "Vacaci\u00f3n").Id]; Assert.IsNotNull(lex); Assert.AreEqual(LexemeType.Stem, lex.Type); Assert.AreEqual("Vacaci\u00f3n", lex.LexicalForm); LexiconSense sense = lex.AddSense(); Assert.IsNotNull(sense); LanguageText gloss = sense.AddGloss("en", "D\u00f3nde"); Lexeme reGetLex = m_lexicon[lex.Id]; Assert.AreEqual(gloss.Text, reGetLex.Senses.First().Glosses.First().Text); }
// Start is called before the first frame update void Start() { languageText = GetComponent <LanguageText>(); text = GetComponent <Text>(); switch (LanguageSwitch.language) { case LanguageSwitch.Language.Japanese: text.font = font0; break; case LanguageSwitch.Language.English: text.font = font0; break; default: text.font = font1; break; } text.text = languageText.TextOutPut().Replace(" ", "\n"); nowlanguage = LanguageSwitch.language; }
public IActionResult OnGet(int?id) { if (id.HasValue) { LanguageText = languageData.GetById(id.Value); ViewData["Title"] = "Edit"; } else { ViewData["Title"] = "Add a word/phrase"; LanguageText = new LanguageText(); LanguageText.LanguageType = LanguageType.YORUBA; } Languages = htmlHelper.GetEnumSelectList <LanguageType>(); if (LanguageText == null) { return(RedirectToPage("./NotFound")); } return(Page()); }
// Start is called before the first frame update IEnumerator Start() { string language_code = PlayerPrefs.GetString("LanguageCode", GameSettings.defaultLanguageCode); if (language_code == "sl") { GameSettings.username = "******"; } else { GameSettings.username = "******"; } GameSettings.GenerateRandomGuest(); GameSettings.localizationManager = new LocalizationManager(); yield return(GameSettings.localizationManager.LoadJsonLanguageData(language_code)); GameSettings.translationLoaded = true; LanguageText.SetNativeLanguages(); }
public FdoLexiconGlossAddedEventArgs(Lexeme lexeme, LexiconSense sense, LanguageText gloss) { m_lexeme = lexeme; m_sense = sense; m_gloss = gloss; }
public LanguageText Add(LanguageText newLanguageText) { db.Add(newLanguageText); return(newLanguageText); }
public LanguageText Add(LanguageText newLanguageText) { languageTexts.Add(newLanguageText); newLanguageText.Id = languageTexts.Max(l => l.Id) + 1; return(newLanguageText); }
public string Format(LanguageText value, params object[] args) { return String.Format(GetText(value), args); }
public string Format(LanguageText value) { return GetText(value); }