/// --------------------------------------------------------------------------------
 /// <summary>
 /// Initializes a new instance of the <see cref="PhraseCustomization"/> class.
 /// </summary>
 /// --------------------------------------------------------------------------------
 public PhraseCustomization(TranslatablePhrase tp)
 {
     Reference      = tp.Reference;
     OriginalPhrase = tp.OriginalPhrase;
     ModifiedPhrase = tp.ModifiedPhrase;
     Type           = tp.IsExcluded ? CustomizationType.Deletion : CustomizationType.Modification;
 }
Esempio n. 2
0
        public void Key_CustomizationBasedOnModifiedTranslatablePhrase_ValueIsBasedOnOriginalTpQuestion()
        {
            var tp = new TranslatablePhrase(new Question("TST 6:1-2", 100006001, 100006002, "Is this the original?", "Yes"), 1, 2, 3);

            tp.ModifiedPhrase = "This is the modified version of it";
            var pc = new PhraseCustomization(tp);

            Assert.AreEqual("Is this the original?", pc.ImmutableKey);
            Assert.AreEqual(pc.ImmutableKey, pc.ImmutableKey_PublicForSerializationOnly);
        }
Esempio n. 3
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="T:EditQuestion"/> class.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public EditQuestionDlg(TranslatablePhrase question, List <string> existingQuestionsForRef,
                               LocalizationsFileAccessor dataLocalizer)
        {
            m_question = question;
            m_existingQuestionsForRef = existingQuestionsForRef;
            InitializeComponent();
            if (dataLocalizer == null)
            {
                m_txtOriginal.Text = question.OriginalPhrase;
                m_txtModified.Text = question.PhraseInUse;
            }
            else
            {
                m_txtOriginal.Tag  = question.OriginalPhrase;
                m_txtOriginal.Text = dataLocalizer.GetLocalizedDataString(new UIQuestionDataString(question.PhraseKey, true, false), out _);
                m_txtModified.Text = question.OriginalPhrase == question.PhraseInUse ? m_txtOriginal.Text : question.PhraseInUse;
            }
            var alternativeForms = question.QuestionInfo?.Alternatives;

            if (alternativeForms != null && alternativeForms.Any(f => !f.Hide))
            {
                var resources      = new System.ComponentModel.ComponentResourceManager(typeof(EditQuestionDlg));
                var firstOneToShow = -1;
                for (var i = 0; i < alternativeForms.Length; i++)
                {
                    if (alternativeForms[i].Hide)
                    {
                        continue;
                    }
                    if (firstOneToShow == -1)
                    {
                        firstOneToShow = i;
                        continue;
                    }
                    var newBtn = new RadioButton();
                    m_pnlAlternatives.Controls.Add(newBtn);
                    resources.ApplyResources(newBtn, "m_rdoAlternative");
                    m_pnlAlternatives.SetFlowBreak(newBtn, true);
                    newBtn.Padding  = m_rdoAlternative.Padding;
                    newBtn.AutoSize = true;
                    InitializeRadioButton(newBtn, i, dataLocalizer);
                    newBtn.CheckedChanged += m_rdoAlternative_CheckedChanged;
                }
                Debug.Assert(firstOneToShow >= 0);
                InitializeRadioButton(m_rdoAlternative, firstOneToShow, dataLocalizer);
            }
            else
            {
                m_pnlAlternatives.Hide();
            }
        }
Esempio n. 4
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Verifies the translatable phrase.
        /// </summary>
        /// <param name="phrase">The phrase.</param>
        /// <param name="parts">Parts information, with alternating sub-phrases and their
        /// occurrence counts (across all phrases in the test).</param>
        /// ------------------------------------------------------------------------------------
        private static void VerifyTranslatablePhrase(TranslatablePhrase phrase,
                                                     params object[] parts)
        {
            Assert.AreEqual(parts.Length / 2, phrase.TranslatableParts.Count(), "Phrase \"" + phrase +
                            "\" was split into the wrong number of parts.");
            int i = 0;

            foreach (Part part in phrase.TranslatableParts)
            {
                Assert.AreEqual(parts[i++], part.Text, "Unexpected part");
                Assert.AreEqual(GetWordCount(part.Text), part.Words.Count(),
                                "Unexpected word count for part \"" + part.Text + "\"");
                Assert.AreEqual(parts[i++], part.OwningPhrases.Count(),
                                "Unexpected number of owning phrases for part \"" + part.Text + "\"");
            }
        }
Esempio n. 5
0
        public void EnumeratePhrases_UnnamedCategory()
        {
            QuestionSections qs = new QuestionSections();

            qs.Items = new Section[1];
            int     iS = 0;
            Section s  = new Section();

            qs.Items[iS] = s;

            s.ScriptureReference = "ROM 1.1-17";
            s.Heading            = "Romans 1:1-17 Introduction to the book.";
            s.StartRef           = 45001001;
            s.EndRef             = 45001017;
            s.Categories         = new Category[1];
            s.Categories[0]      = new Category();
            Question q = new Question();

            s.Categories[0].Questions.Add(q);
            q.Text    = "Who wrote this book?";
            q.Answers = new[] { "Paul." };

            QuestionProvider qp = new QuestionProvider(qs, null);

            Assert.AreEqual(1, qp.SectionInfo.Count);
            Assert.AreEqual("Romans 1:1-17 Introduction to the book.", qp.SectionInfo[s.StartRef].Heading);
            Assert.AreEqual(1, qp.AvailableBookIds.Length);
            Assert.AreEqual(45, qp.AvailableBookIds[0]);
            List <TranslatablePhrase> phrases = qp.ToList();

            Assert.AreEqual(1, phrases.Count);

            TranslatablePhrase phrase = phrases[0];

            Assert.AreEqual("Who wrote this book?", phrase.PhraseInUse);
            Assert.AreEqual(1, phrase.Category);
            Assert.AreEqual("ROM 1.1-17", phrase.Reference);
            Assert.AreEqual(45001001, phrase.StartRef);
            Assert.AreEqual(45001017, phrase.EndRef);
            Assert.AreEqual(1, phrase.SequenceNumber);
            Assert.IsNotNull(phrase.QuestionInfo);
            Assert.AreEqual(1, phrase.QuestionInfo.Answers.Length);
            Assert.IsNull(phrase.QuestionInfo.Notes);
            Assert.AreEqual("Paul.", phrase.QuestionInfo.Answers.First());
        }
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Gets or creates a part matching the given sub-phrase.
        /// </summary>
        /// <param name="words">The words of the part.</param>
        /// <param name="owningPhraseOfPart">(optional) The owning phrase of the part to find or
        /// create.</param>
        /// <param name="unconditionallyCreate">Caller can pass true for added efficiency if it
        /// knows for sure that the part doesn't already exist in the table.</param>
        /// ------------------------------------------------------------------------------------
        public Part GetOrCreatePart(List <Word> words, TranslatablePhrase owningPhraseOfPart,
                                    bool unconditionallyCreate)
        {
            Dictionary <Word, List <Part> > partsDictionary;
            List <Part> parts = null;
            Part        part  = null;

            if (m_partsTable.TryGetValue(words.Count(), out partsDictionary))
            {
                if (partsDictionary.TryGetValue(words.First(), out parts) && !unconditionallyCreate)
                {
                    part = parts.FirstOrDefault(x => x.Words.SequenceEqual(words));
                }
            }
            else
            {
                m_partsTable[words.Count()] = partsDictionary = new Dictionary <Word, List <Part> >();
            }

            if (parts == null)
            {
                partsDictionary[words.First()] = parts = new List <Part>();
            }

            if (part == null)
            {
                part = new Part(words);
                parts.Add(part);
                if (m_allPartsList != null)
                {
                    m_allPartsList.Add(part);
                }
            }

            if (owningPhraseOfPart != null)
            {
                part.AddOwningPhrase(owningPhraseOfPart);
            }

            return(part);
        }
Esempio n. 7
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Gets the best rendering for this term in when used in the context of the given
        /// phrase.
        /// </summary>
        /// <remarks>If this term occurs more than once in the phrase, it is not possible to
        /// know which occurrence is which.</remarks>
        /// ------------------------------------------------------------------------------------
        public string GetBestRenderingInContext(TranslatablePhrase phrase)
        {
            IEnumerable <string> renderings = Renderings;

            if (!renderings.Any())
            {
                return(string.Empty);
            }
            if (renderings.Count() == 1 || TranslatablePhrase.s_helper.TermRenderingSelectionRules == null)
            {
                return(Translation);
            }

            List <string> renderingsList = null;

            foreach (RenderingSelectionRule rule in TranslatablePhrase.s_helper.TermRenderingSelectionRules.Where(r => !r.Disabled))
            {
                if (renderingsList == null)
                {
                    renderingsList = new List <string>();
                    foreach (string rendering in renderings)
                    {
                        if (rendering == Translation)
                        {
                            renderingsList.Insert(0, rendering);
                        }
                        else
                        {
                            renderingsList.Add(rendering);
                        }
                    }
                }
                string s = rule.ChooseRendering(phrase.PhraseInUse, m_words, renderingsList);
                if (!string.IsNullOrEmpty(s))
                {
                    return(s);
                }
            }
            return(Translation);
        }
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// For each "ParsedPart" in the phrase/question, populate the phrase's Parts with the
        /// appropriate key term or "Part" (adding it to the master repo of parts, if needed).
        /// </summary>
        /// <param name="phrase">A translatable phrase which has already been parsed but not
        /// yet initialized with real IPhraseParts</param>
        /// ------------------------------------------------------------------------------------
        public void InitializePhraseParts(TranslatablePhrase phrase)
        {
            Debug.Assert(phrase.QuestionInfo.ParsedParts.Any());
            Debug.Assert(!phrase.m_parts.Any());

            foreach (ParsedPart part in phrase.QuestionInfo.ParsedParts)
            {
                IPhrasePart newPart;
                if (part.Type == PartType.TranslatablePart)
                {
                    newPart = GetOrCreatePart(part.Words, phrase, false);
                }
                else if (part.Type == PartType.KeyTerm)
                {
                    newPart = FindKeyTerm(part.Words);
                }
                else
                {
                    newPart = new Number(part.NumericValue);
                }
                phrase.m_parts.Add(newPart);
            }
        }
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="T:EditQuestion"/> class.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public EditQuestionDlg(TranslatablePhrase question, List <String> existingQuestionsForRef, LocalizationsFileAccessor dataLocalizer)
        {
            m_question = question;
            m_existingQuestionsForRef = existingQuestionsForRef;
            InitializeComponent();
            if (dataLocalizer == null)
            {
                m_txtOriginal.Text = question.OriginalPhrase;
                m_txtModified.Text = question.PhraseInUse;
            }
            else
            {
                m_txtOriginal.Tag  = question.OriginalPhrase;
                m_txtOriginal.Text = dataLocalizer.GetLocalizedDataString(new UIQuestionDataString(question.PhraseKey, true, false), out string locale);
                m_txtModified.Text = question.OriginalPhrase == question.PhraseInUse ? m_txtOriginal.Text : question.PhraseInUse;
            }
            Question q = question.QuestionInfo;

            if (q?.AlternateForms != null)
            {
                System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EditQuestionDlg));

                for (int i = 1; i < q.AlternateForms.Length; i++)
                {
                    RadioButton newBtn = new RadioButton();
                    m_pnlAlternatives.Controls.Add(newBtn);
                    resources.ApplyResources(newBtn, "m_rdoAlternative");
                    m_pnlAlternatives.SetFlowBreak(newBtn, true);
                    InitializeRadioButton(newBtn, i, dataLocalizer);
                    newBtn.CheckedChanged += m_rdoAlternative_CheckedChanged;
                }
                InitializeRadioButton(m_rdoAlternative, 0, dataLocalizer);
                return;
            }
            m_pnlAlternatives.Hide();
        }
Esempio n. 10
0
        public void EnumeratePhrases_CategoriesDifferOnlyByCase()
        {
            QuestionSections qs = new QuestionSections();

            qs.Items = new Section[2];
            int iS = 0;

            qs.Items[iS] = MasterQuestionParserTests.CreateSection("ACT 1.1-5", "Acts 1:1-5 Introduction to the book.", 44001001,
                                                                   44001005, 1, 1);
            int      iC = 0;
            Question q  = qs.Items[iS].Categories[iC].Questions[0];

            q.Text    = "What information did Luke, the writer of this book, give in this introduction?";
            q.Answers = new[] { "Luke reminded his readers that he was about to continue the true story about Jesus" };

            iC        = 1;
            q         = qs.Items[iS].Categories[iC].Questions[0];
            q.Text    = "To whom did the writer of Acts address this book?";
            q.Answers = new[] { "He addressed this book to Theophilus." };

            iS           = 1;
            qs.Items[iS] = MasterQuestionParserTests.CreateSection("ACT 1.6-10", "Acts 1:6-10 The continuing saga.", 44001006, 44001010, 1, 1);
            iC           = 0;
            qs.Items[iS].Categories[iC].Type = "overview";
            q         = qs.Items[iS].Categories[iC].Questions[0];
            q.Text    = "What happened?";
            q.Answers = new[] { "Stuff" };

            iC = 1;
            qs.Items[iS].Categories[iC].Type = "details";
            q = qs.Items[iS].Categories[iC].Questions[0];
            q.ScriptureReference = "ACT 1.6";
            q.StartRef           = 44001006;
            q.EndRef             = 44001006;
            q.Text    = "What question did the apostles ask Jesus about his kingdom?";
            q.Answers = new[] { "The apostles asked Jesus whether he was soon going to set up his kingdom in a way that everybody could see and cause the people of Israel to have power in that kingdom." };

            QuestionProvider qp = new QuestionProvider(qs, null);

            List <TranslatablePhrase> phrases = qp.ToList();

            Assert.AreEqual(6, phrases.Count);
            Assert.AreEqual(1, qp.AvailableBookIds.Length);
            Assert.AreEqual(44, qp.AvailableBookIds[0]);
            Assert.AreEqual(2, qp.SectionInfo.Count);
            Assert.AreEqual("Acts 1:1-5 Introduction to the book.", qp.SectionInfo[44001001].Heading);
            Assert.AreEqual("Acts 1:6-10 The continuing saga.", qp.SectionInfo[44001006].Heading);

            TranslatablePhrase phrase = phrases[0];

            Assert.AreEqual("Overview", phrase.PhraseInUse);
            Assert.AreEqual(-1, phrase.Category);
            Assert.AreEqual(string.Empty, phrase.Reference);
            Assert.AreEqual(001001001, phrase.StartRef);
            Assert.AreEqual(066022021, phrase.EndRef);
            Assert.AreEqual(0, phrase.SequenceNumber);
            Assert.IsNull(phrase.QuestionInfo);

            phrase = phrases[1];
            Assert.AreEqual("What information did Luke, the writer of this book, give in this introduction?",
                            phrase.PhraseInUse);
            Assert.AreEqual(0, phrase.Category);
            Assert.AreEqual("ACT 1.1-5", phrase.Reference);
            Assert.AreEqual(44001001, phrase.StartRef);
            Assert.AreEqual(44001005, phrase.EndRef);
            Assert.AreEqual(1, phrase.SequenceNumber);
            Assert.IsNotNull(phrase.QuestionInfo);
            Assert.AreEqual(1, phrase.QuestionInfo.Answers.Count());
            Assert.AreEqual("Luke reminded his readers that he was about to continue the true story about Jesus",
                            phrase.QuestionInfo.Answers.First());

            phrase = phrases[2];
            Assert.AreEqual("Details", phrase.PhraseInUse);
            Assert.AreEqual(-1, phrase.Category);
            Assert.AreEqual(string.Empty, phrase.Reference);
            Assert.AreEqual(001001001, phrase.StartRef);
            Assert.AreEqual(066022021, phrase.EndRef);
            Assert.AreEqual(1, phrase.SequenceNumber);
            Assert.IsNull(phrase.QuestionInfo);

            phrase = phrases[3];
            Assert.AreEqual("To whom did the writer of Acts address this book?",
                            phrase.PhraseInUse);
            Assert.AreEqual(1, phrase.Category);
            Assert.AreEqual("ACT 1.1-5", phrase.Reference);
            Assert.AreEqual(44001001, phrase.StartRef);
            Assert.AreEqual(44001005, phrase.EndRef);
            Assert.AreEqual(1, phrase.SequenceNumber);
            Assert.IsNotNull(phrase.QuestionInfo);
            Assert.AreEqual(1, phrase.QuestionInfo.Answers.Count());
            Assert.AreEqual("He addressed this book to Theophilus.",
                            phrase.QuestionInfo.Answers.First());

            phrase = phrases[4];
            Assert.AreEqual("What happened?", phrase.PhraseInUse);
            Assert.AreEqual(0, phrase.Category);
            Assert.AreEqual("ACT 1.6-10", phrase.Reference);
            Assert.AreEqual(44001006, phrase.StartRef);
            Assert.AreEqual(44001010, phrase.EndRef);
            Assert.AreEqual(1, phrase.SequenceNumber);
            Assert.IsNotNull(phrase.QuestionInfo);
            Assert.AreEqual(1, phrase.QuestionInfo.Answers.Count());
            Assert.AreEqual("Stuff", phrase.QuestionInfo.Answers.First());

            phrase = phrases[5];
            Assert.AreEqual("What question did the apostles ask Jesus about his kingdom?",
                            phrase.PhraseInUse);
            Assert.AreEqual(1, phrase.Category);
            Assert.AreEqual("ACT 1.6", phrase.Reference);
            Assert.AreEqual(44001006, phrase.StartRef);
            Assert.AreEqual(44001006, phrase.EndRef);
            Assert.AreEqual(1, phrase.SequenceNumber);
            Assert.IsNotNull(phrase.QuestionInfo);
            Assert.AreEqual(1, phrase.QuestionInfo.Answers.Count());
            Assert.AreEqual("The apostles asked Jesus whether he was soon going to set up his kingdom in a way that everybody could see and cause the people of Israel to have power in that kingdom.",
                            phrase.QuestionInfo.Answers.First());
        }
Esempio n. 11
0
        public void EnumeratePhrases_EnsureSharedPartsAreHookedUpCorrectly()
        {
            ParsedQuestions pq = new ParsedQuestions();

            pq.KeyTerms = new [] {
                new KeyTermMatchSurrogate("luke", "lucas"),
                new KeyTermMatchSurrogate("jesus", "jesu"),
                new KeyTermMatchSurrogate("disciple", "dicipulo")
            };
            QuestionSections qs = pq.Sections = new QuestionSections();

            qs.Items = new Section[2];
            int iS = 0;

            qs.Items[iS] = MasterQuestionParserTests.CreateSection("ACT 1.1-5", "Acts 1:1-5 Introduction to the book.", 44001001,
                                                                   44001005, 2, 1);
            int      iC = 0;
            Question q  = qs.Items[iS].Categories[iC].Questions[0];

            q.Text = "What information did Luke give?";
            q.ParsedParts.Add(new ParsedPart(PhraseParser.GetWordsInString("what information did")));
            q.ParsedParts.Add(new ParsedPart(pq.KeyTerms[0]));
            q.ParsedParts.Add(new ParsedPart(PhraseParser.GetWordsInString("give")));
            q      = qs.Items[iS].Categories[iC].Questions[1];
            q.Text = "What is a disciple of Jesus?";
            q.ParsedParts.Add(new ParsedPart(PhraseParser.GetWordsInString("what is a")));
            q.ParsedParts.Add(new ParsedPart(pq.KeyTerms[2]));
            q.ParsedParts.Add(new ParsedPart(PhraseParser.GetWordsInString("of")));
            q.ParsedParts.Add(new ParsedPart(pq.KeyTerms[1]));

            iC     = 1;
            q      = qs.Items[iS].Categories[iC].Questions[0];
            q.Text = "What is a book?";
            q.ParsedParts.Add(new ParsedPart(PhraseParser.GetWordsInString("what is a")));
            q.ParsedParts.Add(new ParsedPart(PhraseParser.GetWordsInString("book")));

            iS           = 1;
            qs.Items[iS] = MasterQuestionParserTests.CreateSection("ACT 1.6-10", "Acts 1:6-10 The continuing saga.", 44001006, 44001010, 1, 2);
            iC           = 0;
            q            = qs.Items[iS].Categories[iC].Questions[0];
            q.Text       = "Which of the disciples wanted to give away land?";
            q.ParsedParts.Add(new ParsedPart(PhraseParser.GetWordsInString("which")));
            q.ParsedParts.Add(new ParsedPart(PhraseParser.GetWordsInString("of")));
            q.ParsedParts.Add(new ParsedPart(PhraseParser.GetWordsInString("the")));
            q.ParsedParts.Add(new ParsedPart(pq.KeyTerms[2]));
            q.ParsedParts.Add(new ParsedPart(PhraseParser.GetWordsInString("wanted to")));
            q.ParsedParts.Add(new ParsedPart(PhraseParser.GetWordsInString("give")));
            q.ParsedParts.Add(new ParsedPart(PhraseParser.GetWordsInString("away land")));

            iC = 1;
            q  = qs.Items[iS].Categories[iC].Questions[0];
            q.ScriptureReference = "ACT 1.6";
            q.StartRef           = 44001006;
            q.EndRef             = 44001006;
            q.Text = "What information did jesus want to give the disciples?";
            q.ParsedParts.Add(new ParsedPart(PhraseParser.GetWordsInString("what information did")));
            q.ParsedParts.Add(new ParsedPart(pq.KeyTerms[1]));
            q.ParsedParts.Add(new ParsedPart(PhraseParser.GetWordsInString("want to")));
            q.ParsedParts.Add(new ParsedPart(PhraseParser.GetWordsInString("give")));
            q.ParsedParts.Add(new ParsedPart(PhraseParser.GetWordsInString("the")));
            q.ParsedParts.Add(new ParsedPart(pq.KeyTerms[2]));

            q = qs.Items[iS].Categories[iC].Questions[1];
            q.ScriptureReference = "ACT 1.7";
            q.StartRef           = 44001007;
            q.EndRef             = 44001007;
            q.Text = "Do you want to read this book again?";
            q.ParsedParts.Add(new ParsedPart(PhraseParser.GetWordsInString("do you")));
            q.ParsedParts.Add(new ParsedPart(PhraseParser.GetWordsInString("want to")));
            q.ParsedParts.Add(new ParsedPart(PhraseParser.GetWordsInString("read this")));
            q.ParsedParts.Add(new ParsedPart(PhraseParser.GetWordsInString("book")));
            q.ParsedParts.Add(new ParsedPart(PhraseParser.GetWordsInString("again")));

            pq.TranslatableParts = new []
            {
                "what information did",
                "give",
                "what is a",
                "of",
                "book",
                "which",
                "the",
                "wanted to",
                "away land",
                "do you",
                "want to",
                "read this",
                "again"
            };
            QuestionProvider          qp      = new QuestionProvider(pq);
            List <TranslatablePhrase> phrases = qp.ToList();

            Assert.AreEqual(8, phrases.Count);

            TranslatablePhrase phrase = phrases[0];

            Assert.AreEqual("Overview", phrase.PhraseInUse);
            VerifyTranslatablePhrase(phrase, "overview", 1);

            phrase = phrases[1];
            Assert.AreEqual("What information did Luke give?", phrase.PhraseInUse);
            VerifyTranslatablePhrase(phrase, "what information did", 2, "give", 3);

            phrase = phrases[2];
            Assert.AreEqual("What is a disciple of Jesus?", phrase.PhraseInUse);
            VerifyTranslatablePhrase(phrase, "what is a", 2, "of", 2);

            phrase = phrases[3];
            Assert.AreEqual("Details", phrase.PhraseInUse);
            VerifyTranslatablePhrase(phrase, "details", 1);

            phrase = phrases[4];
            Assert.AreEqual("What is a book?", phrase.PhraseInUse);
            VerifyTranslatablePhrase(phrase, "what is a", 2, "book", 2);

            phrase = phrases[5];
            Assert.AreEqual("Which of the disciples wanted to give away land?", phrase.PhraseInUse);
            VerifyTranslatablePhrase(phrase, "which", 1, "of", 2, "the", 2, "wanted to", 1, "give", 3, "away land", 1);

            phrase = phrases[6];
            Assert.AreEqual("What information did jesus want to give the disciples?", phrase.PhraseInUse);
            VerifyTranslatablePhrase(phrase, "what information did", 2, "want to", 2, "give", 3, "the", 2);

            phrase = phrases[7];
            Assert.AreEqual("Do you want to read this book again?", phrase.PhraseInUse);
            VerifyTranslatablePhrase(phrase, "do you", 1, "want to", 2, "read this", 1, "book", 2, "again", 1);
        }
Esempio n. 12
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// The "best rendering" for a number is always just the number expressed in the
 /// vernacular script, formatted apprpriately.
 /// </summary>
 /// <remarks>If this term occurs more than once in the phrase, it is not possible to
 /// know which occurrence is which.</remarks>
 /// ------------------------------------------------------------------------------------
 public string GetBestRenderingInContext(TranslatablePhrase phrase)
 {
     return(Translation);
 }
Esempio n. 13
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Adds the specified phrase as an owner of this Part.
 /// </summary>
 /// ------------------------------------------------------------------------------------
 internal void AddOwningPhrase(TranslatablePhrase phrase)
 {
     m_owningPhrases.Add(phrase);
 }