Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Issue with LanguageType in addin manifest for Localization

8 REPLIES 8
SOLVED
Reply
Message 1 of 9
christian.tonn
1008 Views, 8 Replies

Issue with LanguageType in addin manifest for Localization

Hello!

 

Is there some sort of cache active in Revit for the display of localized Addin Ribbon GUI elements? I am trying to apply the following xml tag "<LanguageType>German</LanguageType>" in the addin xml file. When I run it the first time on a machine, I can successfully set it to "German" or to "English_USA", run Revit2016 and everything looks just fine localized ... but, if I change the LanguageType xml tag on that same machine to a different value, it doesn't have any impact (e.g. for testing or a different user might like to work on this Revit with another language). Revit shows me always the first set language in the Ribbon GUI. Is there a workaround for that? Did I miss something?

 

We first used a different mechanism to set the localization:

 

 

CultureInfo culture = new CultureInfo(languageString);
Thread.CurrentThread.CurrentCulture = culture;
Thread.CurrentThread.CurrentUICulture = culture;

 

But this method has some side effects as well: Some Revit dialogs (which are not part of our addin application) change their language back to English. So, I started looking for other ways to do the localization.

 

Any answer or hint is very welcome! Thank you!

 

Christian

8 REPLIES 8
Message 2 of 9

Hi Christian,

 

please do NEVER change the Thread.CurrentThread.CurrentCulture.

It will affect every other third party add-in, causing errors in those which cannot be found easily.

For example, the handling of the decimal or the thousands separator will be changed, thus casting strings to doubles will return unexpected results.

 

Changing the Thread.CurrentThread.CurrentUICulture will just change the language of the UI, meaning your RibbonItem texts will adjust to either German or English, as desired.

 

 

Revitalizer

 




Rudolf Honke
Software Developer
Mensch und Maschine





Message 3 of 9

Hello Revitalizer,

 

thanks for your answer! I had to check it out immediatly. I changed the above code snippet in our product to:

 

CultureInfo culture = new CultureInfo(languageString);
Thread.CurrentThread.CurrentUICulture = culture;

I double checked all files to not accidently make that call to the "CurrentCulture" property ... but to no success. Your are right, the ribbon/dialog UI of our Revit application changes it's language. But also some "native" Revit dialogs switch back to English after that. If I am setting "CurrentUICulture" to "German" I get some dialogs like that in Revit (you will note the mixed languages):

 

mixed Revit Languages

That's why, I thought the way over the addin xml manifest is the way to go ... and used the "LanguageType" tag in there. But I can not get it to work, if I want to switch the language on the same machine. Thank you very much again! Your answer is right ... but has some side effects for other Revit functionalities, I am afraid. That's why I am leaving the discussion open ...

 

Christian

Message 4 of 9

Hi,

 

what sort of language string do you use ?

 

Make sure you use "de-DE" instead of "de" (which would also cover Austrian and Swiss environments).

In the Revit program folder, you can see a "de-DE" folder which drives some of the Revit strings.

So, changing the UI culture to "de", Revit will not find its own German strings, thus its Fallback language is English.

 

 

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





Message 5 of 9

Hello Revitalizer,

 

you are right! I was indeed using "de" and not your suggested "de-DE" as languageString. Now everthing is working just fine. Thank you so much!

 

Christian

Message 6 of 9

Hi Christian,

 

I think Revit uses at least two different systems for localization.

As it has some DotNet-BuilIn-Addins, there is a de-DE subfolder in its program folder, just for those add-ins.

Revit developers make use of their own API.

Natively, Revit is a C++ application, and its own language strings are stored somewhere else.

 

So setting the UI language using "de" may work apparently, but in fact you need to check the language of all the built-in dialogs which belong to the DotNet built-in add-ins.

 

Do they still work properly ?

The question is which dialogs belong to which add-in.

 

By the way, a "built-in add-in" is a contradiction in itself...

 

 

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





Message 7 of 9
Anonymous
in reply to: christian.tonn

Hi, @Revitalizer!

I am using Revit 2018, but I have set zh-CN or zh-Hans for LanguageType but it is not valid, how should I make sure the window text is displayed in Chinese?

 

Link: https://forums.autodesk.com/t5/revit-api-forum/how-to-convert-a-revit-plugin-from-english-to-other-l...

Message 8 of 9
christian.tonn
in reply to: Anonymous

Hi!

 

You need to take a look what languages are available inside your Revit programs folder: For me its "C:\Program Files\Autodesk\Revit 2023" right now. There are some sub-folders for the supported languages in this folder (e.g. "zh-CN", ... usually with a minus in between). I think, you should be able to use those language-ids with the method in the answer above. I don't see "zh-Hans" on my machine, but that may depend, I think. Good luck!

Christian

Message 9 of 9
Anonymous
in reply to: christian.tonn

@christian.tonn 

Thank you! 

 

 I think, you should be able to use those language-ids with the method in the answer above. 

In addition, region symbols have inheritance properties, so it is not necessary to adhere exactly to the language code contained in the Revit catalog. I have done a detailed verification.

 

 

Of course, the view you expressed may not be the answer I see on my side. That option (LanguageType) doesn't seem to do the trick either, because it has something to do with the Revit display language, so I'm a bit confused, and this doesn't seem to be of any use except to confuse.

 

I wanted to do this experiment before, hesitated not to do it, and you said that in these contents, it has triggered some thoughts in me. Finally found the essential reason.

 

I totally get it, the fundamental decision is in the language option of the Revit startup screen, starting the plugin is what language resource it will prioritize. There is no need to make additional settings at all, because setting it does nothing, it is cheating itself. That is to say, the plug-in language only has something to do with revit display language.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report