none
How to Identify Norwegian Bokmal and norwegian Nynorsk programmatically RRS feed

  • Question

  • Hi all,

    I have to find a way to differentiate text between Norwegian Bokmal and Norwegian Nynorsk programmatically using c#.

    Please help me out!


    Jegadheswari

    Friday, July 28, 2017 9:21 AM

All replies

  • Please translate the word "Bokmal" and "Nynorsk" into English, if they are not English words. 

    Ashidacchi


    • Edited by Ashidacchi Friday, July 28, 2017 1:26 PM
    Friday, July 28, 2017 1:24 PM
  • Hello Jegadheswari,

    You could use Language.ID Property (Word) to detect which language it uses. To detect the language, please check Document.LanguageDetected Property (Word). To reevaluate the language of the specified text, you must first set the LanguageDetected property to False.

    Please visit MsoLanguageID Enumeration (Office) to get the language id:

    msoLanguageIDNorwegianBokmol 1044 The Norwegian Bokmol language.
    msoLanguageIDNorwegianNynorsk 2068 The Norwegian Nynorsk language.

    Here is a sample to detect lauguage in an add-in.

                Globals.ThisAddIn.Application.ActiveDocument.LanguageDetected = false;
                Globals.ThisAddIn.Application.ActiveDocument.DetectLanguage();
                foreach (Word.Paragraph para in Globals.ThisAddIn.Application.ActiveDocument.Paragraphs)
                {
                    for (int i = 1; i < para.Range.Words.Count; i++)
                    {
                        var langID = para.Range.Words[i].LanguageID;
                    }
                }

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, July 31, 2017 7:12 AM
    Moderator