Author Topic: determining Language pack in use  (Read 2953 times)

0 Members and 1 Guest are viewing this topic.

poupou11

  • Guest
determining Language pack in use
« on: October 18, 2012, 10:42:26 AM »
With Autocad 2013, language pack can be set using for example '/Language "fr-FR"' in the shortcut properties to make Autocad independent of the installed version

In such case, Is there a way to determine within a .net application which current language pack has been loaded with the Autocad session ?

With past version of Autocad, I was using the value of the variable "ROAMABLEROOTPREFIX" to determine whether it was a french or an english version of Autocad running, but it's no longer possible as the value of this variable seems to be fully dependant of the language version of the installed Autocad, not the loaded language pack.

Thanks.

BlackBox

  • King Gator
  • Posts: 3770
Re: determining Language pack in use
« Reply #1 on: October 18, 2012, 03:18:25 PM »
Perhaps this will help... If using .NET 3.5 or earlier:

Code - C#: [Select]
  1.  
  2. using Autodesk.AutoCAD.ApplicationServices;
  3. using Autodesk.AutoCAD.Interop;
  4.  
  5. namespace Foo
  6. {
  7.     class Bar
  8.     {
  9.         public string GetMainDictionary_Example()
  10.         {
  11.             AcadApplication _AcAppCom = Application.AcadApplication as AcadApplication;
  12.            
  13.             if (_AcAppCom != null)
  14.             {
  15.                 return _AcAppCom.Preferences.Files.MainDictionary;
  16.             }
  17.  
  18.             return "";
  19.         }
  20.     }
  21. }
  22.  



If using .NET 4.0 or later, see this thread for info on dynamic type.
« Last Edit: October 18, 2012, 03:33:31 PM by RenderMan »
"How we think determines what we do, and what we do determines what we get."

gile

  • Gator
  • Posts: 2520
  • Marseille, France
Re: determining Language pack in use
« Reply #2 on: October 18, 2012, 03:29:07 PM »
Hi,

This is the way I use:
Code - C#: [Select]
  1. bool isFrench = AcAp.GetSystemVariable("LOCALROOTPREFIX").ToString().EndsWith("fra\\");
Speaking English as a French Frog

BlackBox

  • King Gator
  • Posts: 3770
Re: determining Language pack in use
« Reply #3 on: October 18, 2012, 03:30:31 PM »
Hi,

This is the way I use:
Code - C#: [Select]
  1. bool isFrench = AcAp.GetSystemVariable("LOCALROOTPREFIX").ToString().EndsWith("fra\\");

Much less overhead; thanks, Gile!  :-)
"How we think determines what we do, and what we do determines what we get."

BlackBox

  • King Gator
  • Posts: 3770
Re: determining Language pack in use
« Reply #4 on: October 18, 2012, 03:32:13 PM »
Perhaps one could use LOCALE system variable as an alternative?
"How we think determines what we do, and what we do determines what we get."

gile

  • Gator
  • Posts: 2520
  • Marseille, France
Re: determining Language pack in use
« Reply #5 on: October 18, 2012, 03:46:26 PM »
Perhaps one could use LOCALE system variable as an alternative?

No the LOCALE sysvar returns the OS (Windows) language.
Speaking English as a French Frog

BlackBox

  • King Gator
  • Posts: 3770
Re: determining Language pack in use
« Reply #6 on: October 18, 2012, 03:47:29 PM »
Perhaps one could use LOCALE system variable as an alternative?

No the LOCALE sysvar returns the OS (Windows) language.

Understood; thanks.
"How we think determines what we do, and what we do determines what we get."

poupou11

  • Guest
Re: determining Language pack in use
« Reply #7 on: October 23, 2012, 08:05:04 AM »
Thanks for your suggestions ....

about using MainDIctionary ... this can be change by the user in the working profile, so it doesn't reflect language pack in use

about LOCALROOTPREFIX, I've to check on that one, because when I install an English language pack on a french version of Autocad 2013, Autocad was still pointing to the  french support files directory (ROAMABLEROOTPREFIX keeps its original value, whatever the starting language is), so I was getting English interface and commands at the prompt but french menu and ribbons, I'd to edit the support files path by changing the location of the support files... so more to come on that one as soon I can get an hold on the test PC.

poupou11

  • Guest
Re: determining Language pack in use
« Reply #8 on: October 23, 2012, 03:42:41 PM »
Unfortunately,  LOCALROOTPREFIX has the same behaviour as ROAMABLEROOTPREFIX, it keeps pointing on the initial support directory (when Autocad is1st fired up) and doesn't change afterwards, whatever language pack is used.

the '/language "fr-FR"' is handled at start up time, but it's true that we cannot switch language within a Autocad session, so, may be, the Autodesk people have not seen any reason to assign this switch to a system variable.

huiz

  • Swamp Rat
  • Posts: 919
  • Certified Prof C3D
Re: determining Language pack in use
« Reply #9 on: October 23, 2012, 03:54:59 PM »
You can look at the results of System.Environment.GetCommandLineArgs()

This will give a list of strings of all the command switches.
The conclusion is justified that the initialization of the development of critical subsystem optimizes the probability of success to the development of the technical behavior over a given period.

poupou11

  • Guest
Re: determining Language pack in use
« Reply #10 on: October 24, 2012, 08:15:26 AM »
Perfect !!! it's doing the job
Thanks for the solution.

You can look at the results of System.Environment.GetCommandLineArgs()

This will give a list of strings of all the command switches.