Search code examples
c#ms-officems-project

Get the UI language of Project


I use Microsoft.Office.Interop.MSProject to automate the creation of Project file, but I have to work with different UI language.

I tried the way of Microsoft : https://msdn.microsoft.com/en-us/library/w9x4hz7x.aspx, but it doesn't look to work with a Microsoft.Office.Interop.MSProject.Application.

Here is a working example for Excel :

mse.Application excel = new mse.Application();
msp.Application project = new msp.Application();

CultureInfo cExcelCulture = new CultureInfo(excel.LanguageSettings.get_LanguageID(Microsoft.Office.Core.MsoAppLanguageID.msoLanguageIDUI));

But I want it in Project. Any idea ?


Solution

  • In MSProject, you should get the CultureInfo as follows:

    int languageID = Globals.ThisAddIn.Application.LocaleID();
    CultureInfo cProjectCulture = new CultureInfo(languageID);