Detect the interface language in a lisp routine

Detect the interface language in a lisp routine

lucdoucet_msdl
Advisor Advisor
2,323 Views
10 Replies
Message 1 of 11

Detect the interface language in a lisp routine

lucdoucet_msdl
Advisor
Advisor

I would like to know if it is possible to return the current Autocad interface language to allow me to set a variable.

 

My specific case is that that the default table cell style name of "Data" is "Données" when the french language interface is active in the current Autocad session. I would like the following table setting function not return an automation error:

 

(vla-SetCellStyle tbl row cell "Données") vs (vla-SetCellStyle tbl row cell "Data")

 

Thanks for any help.

0 Likes
Accepted solutions (3)
2,324 Views
10 Replies
Replies (10)
Message 2 of 11

Moshe-A
Mentor
Mentor

check DWGCODEPAGE or SYSCODEPAGE system variables

 

0 Likes
Message 3 of 11

DannyNL
Advisor
Advisor

Try this as well

 

(vl-registry-read (strcat "HKEY_LOCAL_MACHINE\\" (vlax-product-key)) "Language")
Message 4 of 11

cadffm
Consultant
Consultant
Accepted solution

@lucdoucet_msdl

What is the Value of cellstyle now? In my german version the cellstyle is internatinal "_DATA"

(vla-getcellstyle tblobj 0 2) = "_DATA" and not german like "DATEN"

 

_DATA _HEADER and _TITLE (and "")

Sebastian

0 Likes
Message 5 of 11

roland.r71
Collaborator
Collaborator
Accepted solution

@lucdoucet_msdl wrote:

I would like to know if it is possible to return the current Autocad interface language to allow me to set a variable.

 

My specific case is that that the default table cell style name of "Data" is "Données" when the french language interface is active in the current Autocad session. I would like the following table setting function not return an automation error:

 

(vla-SetCellStyle tbl row cell "Données") vs (vla-SetCellStyle tbl row cell "Data")

 

Thanks for any help.



Tried "_Data" ?

If you use the _ prefix you can use the international (english) commands & values.

like "_Y" = Yes, in any acad language, "_last" for the last object created etc.

No need to set the right language.

 

Besides: i wouldn't know of any such variable. (doesn't mean it's not existent )

There are 2 system vars, people refer to in my search, but both are invalid.

LOCALE & DCTMAIN - Both return NLD (as thats where i am) but my interface language for ACAD (still) is English, not Dutch.

 

Anyway, as for commands and standard "answers" (Yes, No, Previous, Last, etc, etc.) this isn't needed. Just add a _ to the English/standard text and it will tell acad to use/accept the international versions.

 

0 Likes
Message 6 of 11

roland.r71
Collaborator
Collaborator

@DannyNL wrote:

Try this as well

 

(vl-registry-read (strcat "HKEY_LOCAL_MACHINE\\" (vlax-product-key)) "Language")

"English"

 

Correct! Smiley Happy

0 Likes
Message 7 of 11

cadffm
Consultant
Consultant
Accepted solution

(ver)

 

Sebastian

0 Likes
Message 8 of 11

lucdoucet_msdl
Advisor
Advisor

Thanks, this solution would work best for identifying the current interface language when deciding how to respond to users that aren't bilingual. In my case, the best solution would be the simplest, that is to prefix the cell style with an underscore as suggested by roland.r71

 

Luc

0 Likes
Message 9 of 11

lucdoucet_msdl
Advisor
Advisor

Thanks to CADffm and roland.r71, it works!

 

This is the simplest and most straightforward solution. 

0 Likes
Message 10 of 11

lucdoucet_msdl
Advisor
Advisor

Nope, both the french and english Autocad installs return the same result : "ANSI_1252"

0 Likes
Message 11 of 11

lucdoucet_msdl
Advisor
Advisor

This also works but requires us to parse the string result and look for "fr" or "en"

results: "Visual Lisp 2017 (fr)" and "Visual Lisp 2017 (en)"

0 Likes