// ~~ public TRANSLATION GetUpperCase( TRANSLATION translation ) { translation.Text = GetUpperCase(translation.Text); return(translation); }
// ~~ public TRANSLATION GetSentenceCase( TRANSLATION translation ) { translation.Text = GetSentenceCase(translation.Text); return(translation); }
// -- CONSTRUCTORS public SPANISH_LANGUAGE( ) : base() { Name = "Spanish"; DotCharacter = ','; TranslationDictionary["French"] = new TRANSLATION("Francés"); TranslationDictionary["English"] = new TRANSLATION("Inglés"); TranslationDictionary["Poem"] = new TRANSLATION("La mariposa es una cosa para contemplar,\ncon colores más hermosos que el oro.\n" + "Que me gusta tu belleza, mariposa,\nmientras me siento y te veo revolotear."); TranslationDictionary["French"] = new TRANSLATION("Francés"); }
// -- CONSTRUCTORS public FRENCH_LANGUAGE( ) : base() { Name = "French"; DotCharacter = ','; TranslationDictionary["French"] = new TRANSLATION("Français"); TranslationDictionary["English"] = new TRANSLATION("Anglais"); TranslationDictionary["Language:"] = new TRANSLATION("Langue :"); TranslationDictionary["Poem"] = new TRANSLATION("Le papillon est une chose à contempler,\navec des couleurs plus belles que l'or.\n" + "Que j'apprécie ta beauté, papillon,\nalors que je suis assis et te regarde flotter."); }
// ~~ public virtual string TestFunctions( ) { bool opposite_boolean; int opposite_integer; double opposite_real; string opposite_string = ""; TRANSLATION opposite_translation_translation = new TRANSLATION(), inverse_translation_translation = new TRANSLATION(), result_translation = new TRANSLATION(); opposite_boolean = GetOppositeBoolean(true); opposite_integer = GetOppositeInteger(1); opposite_real = GetOppositeReal(1.0); opposite_string = GetOppositeString("one"); opposite_translation_translation = GetOppositeTranslation(new TRANSLATION("one", "1")); inverse_translation_translation = GetInverseTranslation(new TRANSLATION("x", "1")); result_translation.AddText(GetBooleanText(opposite_boolean) + " / " + GetIntegerText(opposite_integer) + " / " + GetRealText(opposite_real) + " / " + opposite_string + " / " + opposite_translation_translation.Text + " / " + inverse_translation_translation.Text + "\n"); result_translation.AddText(GetBooleanText(false) + " / " + GetBooleanText(true) + "\n"); result_translation.AddText(GetIntegerText(-12, 4) + " / " + GetIntegerText(12, 4) + "\n"); result_translation.AddText(GetIntegerText(-12) + " / " + GetRealText(-12.0, 0) + " / " + GetRealText(-12.0) + " / " + GetRealText(-12.0, 3) + " \n"); result_translation.AddText(GetRealText(-12.3, 3, 3, '_') + " / " + GetRealText(-12.345) + " / " + GetRealText(-12.3456789, 0, 3, DotCharacter) + "\n"); result_translation.AddText(GetRealText(-12.000123456, 0, 3) + " / " + GetRealText(-12.000123456, 1, 3) + " / " + GetRealText(-12.000123456, 3, 3) + " / " + GetRealText(-12.000123456) + " \n"); result_translation.AddText(GetLowerCase("jack SPARROW") + " / " + GetUpperCase("john MCLANE") + "\n"); result_translation.AddText(GetSentenceCase("jason bourne") + " / " + GetTitleCase("james kirk") + "\n"); result_translation.AddText(Dump(MakeTranslation("cm"))); result_translation.AddText(Dump(MakeTranslation("cm", "0"))); result_translation.AddText(Dump(MakeTranslation("cm", "1"))); result_translation.AddText(Dump(MakeTranslation("cm", "2"))); result_translation.AddText(Dump(MakeTranslation("cm", "-12.345"))); result_translation.AddText(Dump(MakeTranslation("cm", "-12.345", GENRE.Male))); result_translation.AddText(Dump(MakeTranslation(12))); result_translation.AddText(Dump(MakeTranslation(12, GENRE.Female))); result_translation.AddText(Dump(new TRANSLATION("", "3"))); result_translation.AddText(Dump(new TRANSLATION("perros", "4"))); result_translation.AddText(Dump(new TRANSLATION("fiestas", "5", GENRE.Female))); result_translation.AddText(Dump(new TRANSLATION("", "6.5"))); result_translation.AddText(Dump(new TRANSLATION("metros", "7.5"))); result_translation.AddText(Dump(new TRANSLATION("vueltas", "8.5", GENRE.Female))); result_translation.AddText(GetText("English") + " / " + GetText("French") + " / " + GetDate("18", "2", "2018") + "\n"); result_translation.AddText(GetText("Poem") + "\n"); if (HasText("Haiku")) { result_translation.AddText(GetText("Haiku") + "\n"); } return(result_translation.Text); }
// -- CONSTRUCTORS public ENGLISH_LANGUAGE( ) : base() { Name = "English"; DotCharacter = '.'; TranslationDictionary["Language:"] = new TRANSLATION("Language:"); TranslationDictionary["English"] = new TRANSLATION("English"); TranslationDictionary["French"] = new TRANSLATION("French"); TranslationDictionary["Spanish"] = new TRANSLATION("Spanish"); TranslationDictionary["Haiku"] = new TRANSLATION("Limits are created by mind.\nImagination can take you to the heavens.\nNow imagine something."); TranslationDictionary["Poem"] = new TRANSLATION("The butterfly is a thing to behold,\nwith colors more beautiful than gold.\n" + "How I enjoy your beauty, butterfly,\nas I sit and watch you flutter by."); }
// -- CONSTRUCTORS public TRANSLATION( TRANSLATION translation ) { Text = translation.Text; Quantity = translation.Quantity; HasIntegerQuantity = translation.HasIntegerQuantity; HasRealQuantity = translation.HasRealQuantity; IntegerQuantity = translation.IntegerQuantity; RealQuantity = translation.RealQuantity; Genre = translation.Genre; }
// ~~ public virtual TRANSLATION GetInverseTranslation( TRANSLATION value_translation ) { TRANSLATION result_translation = new TRANSLATION(); result_translation.SetQuantity(value_translation.Quantity); result_translation.SetText("one over " + value_translation.Text); result_translation.SetGenre(value_translation.Genre); return(result_translation); }
// ~~ public virtual TRANSLATION Kings( TRANSLATION count_translation ) { TRANSLATION result_translation = new TRANSLATION(); result_translation.SetText("reyes"); result_translation.SetQuantity(count_translation.Quantity); result_translation.SetGenre(GENRE.Male); return(result_translation); }
// ~~ public void AddText( TRANSLATION translation ) { if (Text == null || Text.Length == 0) { Text = translation.Text; } else { Text = Text + translation.Text; } }
// ~~ public override string TheItemsHaveBeenFound( TRANSLATION items_translation ) { TRANSLATION result_translation = new TRANSLATION(); result_translation.AddText(TheItems(items_translation)); result_translation.AddText(Have(items_translation)); result_translation.AddText(BeenFound(items_translation)); result_translation.AddText(".\n"); return(result_translation.Text); }
// ~~ public virtual string TestConditions( int value ) { TRANSLATION result_translation = new TRANSLATION(); result_translation.AddText(GetIntegerText(value)); if (value < 0) { if (value < -20) { result_translation.AddText(" < -20"); } else if (value < -10) { result_translation.AddText(" < -10"); } else { result_translation.AddText(" < 0"); } } else if (value > 0) { if (value > 20) { result_translation.AddText(" > 20"); } else if (value > 10) { result_translation.AddText(" > 10"); } else { result_translation.AddText(" > 0"); } } else { result_translation.AddText(" = 0"); } result_translation.AddText("\n"); return(result_translation.Text); }
// ~~ public override string TheItems( TRANSLATION items_translation ) { TRANSLATION result_translation = new TRANSLATION(); if (items_translation.IntegerQuantity == 0) { if (items_translation.Genre == GENRE.Female) { result_translation.AddText("Ninguna "); } else { result_translation.AddText("Ningún "); } } else if (items_translation.IntegerQuantity == 1) { if (items_translation.Genre == GENRE.Female) { result_translation.AddText("La "); } else { result_translation.AddText("El "); } } else { if (items_translation.Genre == GENRE.Female) { result_translation.AddText("Las "); } else { result_translation.AddText("Los "); } result_translation.AddText(items_translation.Quantity); result_translation.AddText(" "); } result_translation.AddText(items_translation); return(result_translation.Text); }
// ~~ public virtual string Have( TRANSLATION items_translation ) { TRANSLATION result_translation = new TRANSLATION(); if (items_translation.IntegerQuantity <= 1) { result_translation.AddText(" ha"); } else { result_translation.AddText(" han"); } return(result_translation.Text); }
// ~~ public override string TheItems( TRANSLATION items_translation ) { TRANSLATION result_translation = new TRANSLATION(); if (items_translation.IntegerQuantity == 0) { if (items_translation.Genre == GENRE.Female) { result_translation.AddText("Aucune "); } else { result_translation.AddText("Aucun "); } } else if (items_translation.IntegerQuantity == 1) { if (HasFirstCharacter(GetLowerCase(items_translation.Text), "aâeéêèiîoôuû")) { result_translation.AddText("L'"); } else if (items_translation.Genre == GENRE.Female) { result_translation.AddText("La "); } else { result_translation.AddText("Le "); } } else { result_translation.AddText("Les "); result_translation.AddText(items_translation.Quantity); result_translation.AddText(" "); } result_translation.AddText(items_translation); return(result_translation.Text); }
// ~~ public override TRANSLATION Swords( TRANSLATION count_translation ) { TRANSLATION result_translation = new TRANSLATION(); if (count_translation.GetEnglishCardinalPlurality() == PLURALITY.One) { result_translation.AddText("sword"); } else { result_translation.AddText("swords"); } result_translation.SetQuantity(count_translation.Quantity); return(result_translation); }
// ~~ public override TRANSLATION Helmets( int count ) { TRANSLATION result_translation = new TRANSLATION(); if (count == 1) { result_translation.AddText("helmet"); } else { result_translation.AddText("helmets"); } result_translation.SetQuantity(count); return(result_translation); }
// ~~ public override TRANSLATION Helmets( int count ) { TRANSLATION result_translation = new TRANSLATION(); if (count <= 1) { result_translation.AddText("yelmo"); } else { result_translation.AddText("yelmos"); } result_translation.SetQuantity(count); result_translation.SetGenre(GENRE.Male); return(result_translation); }
// ~~ public override TRANSLATION Swords( TRANSLATION count_translation ) { TRANSLATION result_translation = new TRANSLATION(); if (count_translation.GetFrenchCardinalPlurality() == PLURALITY.One) { result_translation.AddText("épée"); } else { result_translation.AddText("épées"); } result_translation.SetQuantity(count_translation.Quantity); result_translation.SetGenre(GENRE.Female); return(result_translation); }
// ~~ public override TRANSLATION Swords( TRANSLATION count_translation ) { TRANSLATION result_translation = new TRANSLATION(); if (count_translation.IntegerQuantity <= 1) { result_translation.AddText("espada"); } else { result_translation.AddText("espadas"); } result_translation.SetQuantity(count_translation.Quantity); result_translation.SetGenre(GENRE.Female); return(result_translation); }
// ~~ public virtual string BeenFound( TRANSLATION items_translation ) { TRANSLATION result_translation = new TRANSLATION(); result_translation.AddText(" été trouvé"); if (items_translation.Genre == GENRE.Female) { result_translation.AddText("e"); } if (items_translation.IntegerQuantity > 1) { result_translation.AddText("s"); } return(result_translation.Text); }
// ~~ public override string TheItemsHaveBeenFound( TRANSLATION items_translation ) { TRANSLATION result_translation = new TRANSLATION(); result_translation.AddText(TheItems(items_translation)); if (items_translation.IntegerQuantity == 1) { result_translation.AddText(" has"); } else { result_translation.AddText(" have"); } result_translation.AddText(" been found.\n"); return(result_translation.Text); }
// ~~ public virtual string Dump( TRANSLATION this_translation ) { TRANSLATION result_translation = new TRANSLATION(); result_translation.AddText("\"" + this_translation.Text + "\" / \"" + this_translation.Quantity + "\" / '" + this_translation.GetQuantityFirstCharacter() + "' / "); if (this_translation.HasIntegerQuantity) { result_translation.AddText(GetIntegerText(this_translation.IntegerQuantity) + " / "); } if (this_translation.HasRealQuantity) { result_translation.AddText(GetRealText(this_translation.RealQuantity) + " / "); } result_translation.AddText(GetPluralityText(GetCardinalPlurality(this_translation)) + " / " + GetPluralityText(GetOrdinalPlurality(this_translation)) + " / " + GetGenreText(this_translation.Genre) + "\n"); return(result_translation.Text); }
// ~~ public virtual string Test( ) { TRANSLATION no_helmets_translation = new TRANSLATION(), one_helmet_translation = new TRANSLATION(), kings_translation = new TRANSLATION(), queens_translation = new TRANSLATION(), princes_translation = new TRANSLATION(), result_translation = new TRANSLATION(); no_helmets_translation = Helmets(0); one_helmet_translation = Helmets(1); result_translation.AddText(TheItemsHaveBeenFound(no_helmets_translation)); result_translation.AddText(TheItemsHaveBeenFound(one_helmet_translation)); result_translation.AddText(TheItemsHaveBeenFound(Helmets(2))); result_translation.AddText(TheItemsHaveBeenFound(NoSwords())); result_translation.AddText(TheItemsHaveBeenFound(OneSword())); result_translation.AddText(TheItemsHaveBeenFound(Swords(new TRANSLATION("", "2")))); result_translation.AddText(TestFunctions()); result_translation.AddText(TestConditions(-25)); result_translation.AddText(TestConditions(-15)); result_translation.AddText(TestConditions(-5)); result_translation.AddText(TestConditions(0)); result_translation.AddText(TestConditions(5)); result_translation.AddText(TestConditions(15)); result_translation.AddText(TestConditions(25)); kings_translation = Kings(new TRANSLATION("", "1")); queens_translation.SetText("reinas"); queens_translation.SetQuantity("2"); queens_translation.SetGenre(GENRE.Female); princes_translation = new TRANSLATION("príncipes", "3", GENRE.Male); result_translation.AddText(kings_translation.Text + " " + queens_translation.Text + " " + princes_translation.Text + "\n"); return(result_translation.Text); }
// ~~ public virtual string TheItems( TRANSLATION items_translation ) { return(""); }
// ~~ public virtual string TheItemsHaveBeenFound( TRANSLATION items_translation ) { return(""); }
// -- INQUIRIES public override PLURALITY GetCardinalPlurality( TRANSLATION translation ) { return(translation.GetEnglishCardinalPlurality()); }
// ~~ public override PLURALITY GetOrdinalPlurality( TRANSLATION translation ) { return(translation.GetSpanishOrdinalPlurality()); }
// ~~ public virtual PLURALITY GetOrdinalPlurality( TRANSLATION translation ) { return(PLURALITY.Zero); }
// ~~ public virtual TRANSLATION Swords( TRANSLATION count_translation ) { return(TRANSLATION.Null); }