# Script work with several Languages

**URL:** <https://forum.dynamobim.com/t/script-work-with-several-languages/16358>\
**Category:** Uncategorized\
**Tags:** dynamo, language\
**Created:** [November 9, 2017, 3:42pm UTC](https://forum.dynamobim.com/t/script-work-with-several-languages/16358 "2017-11-09T15:42:37Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![talbimam](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/talbimam/32/32376_2.png) [@talbimam](https://forum.dynamobim.com/u/talbimam)\
**Post date:** [November 9, 2017, 3:42pm UTC](https://forum.dynamobim.com/t/script-work-with-several-languages/16358/1 "2017-11-09T15:42:37Z")

</div>

Hello everyone, i just want to ask if there is a way to make a dynamo script works in several language ? for example when i use a parameter name string in french and then i need yo use this script on an english version without changing the parameter name to english manually ! Thank you.

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [November 9, 2017, 5:26pm UTC](https://forum.dynamobim.com/t/script-work-with-several-languages/16358/2 "2017-11-09T17:26:14Z")

</div>

You could review your options after you get the Revit language as shown here:

> [@Get Revit Language](https://forum.dynamobim.com/t/get-revit-language/3938):
>
> I tried to use Autodesk.Revit.ApplicationServices.Application.Language to get the Revit language in Python, but can not get the result string, only IronPython.Runtime.Types.ReflectedProperty. How to get the result string?

That said if you’re doing a workflow which frequently works across languages within your office you may want to consider adding a UI element to allow the user to select the parameter they want to work with directly. That or make a list of what the parameter name should be in every language you use, and use that as a dictionary to get the right result.

I believe the Revit language packs may also allow you to resolve this in another way.

---

<div class="post-metadata">

**Author:** ![adam\_bear1](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/adam_bear1/32/13411_2.png) [@adam\_bear1](https://forum.dynamobim.com/u/adam_bear1)\
**Post date:** [November 9, 2017, 5:39pm UTC](https://forum.dynamobim.com/t/script-work-with-several-languages/16358/3 "2017-11-09T17:39:43Z")

</div>

heres a code block example of how you could define a list of parameter strings in two languages then you could call these strings using the new definition

> def params (num) {  
> Translated\_Params = {  
> {“english0”,“french0”},  
> {“english1”,“french1”},  
> {“english2”,“french2”}  
> };  
> //change language index once  
> language = 1;  
> return = Translated\_Params[num][language];  
> };  
> //call strings  
> params(0…2);

[http://dynamoprimer.com/en/07\_Code-Block/7-4\_functions.html](http://dynamoprimer.com/en/07_Code-Block/7-4_functions.html)

---

<div class="post-metadata">

**Author:** ![Peter\_Kompolschek](https://avatars.discourse-cdn.com/v4/letter/p/dec6dc/32.png) [@Peter\_Kompolschek](https://forum.dynamobim.com/u/Peter_Kompolschek)\
**Post date:** [November 9, 2017, 5:48pm UTC](https://forum.dynamobim.com/t/script-work-with-several-languages/16358/4 "2017-11-09T17:48:51Z")

</div>

Why don’t you address parameters by their id?  
Examples can be found @ buildingcoder

---

<div class="post-metadata">

**Author:** ![talbimam](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/talbimam/32/32376_2.png) [@talbimam](https://forum.dynamobim.com/u/talbimam)\
**Post date:** [November 9, 2017, 6:11pm UTC](https://forum.dynamobim.com/t/script-work-with-several-languages/16358/5 "2017-11-09T18:11:55Z")

</div>

@jacob.small @adam_bear1 @Peter_Kompolschek thank all of you mates i will try those solutions and give you feedback.

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [November 9, 2017, 6:20pm UTC](https://forum.dynamobim.com/t/script-work-with-several-languages/16358/6 "2017-11-09T18:20:44Z")

</div>

If they are built in parameters with a consistent ID than the method @Peter_Kompolschek linked is likely best.

If the IDs change based on project workflow than the dictionary illustrated by @adam_bear1 is likely best.

If there are neither standard names nor standard IDs than go the UI route for now, and discuss standardizing the workflow long term.

---

<div class="post-metadata">

**Author:** ![Peter\_Kompolschek](https://avatars.discourse-cdn.com/v4/letter/p/dec6dc/32.png) [@Peter\_Kompolschek](https://forum.dynamobim.com/u/Peter_Kompolschek)\
**Post date:** [November 9, 2017, 6:30pm UTC](https://forum.dynamobim.com/t/script-work-with-several-languages/16358/7 "2017-11-09T18:30:22Z")

</div>

@jacob.small i asume multilingual Shared parameters are out of @adam_bear1 s scope.

---

<div class="post-metadata">

**Author:** ![adam\_bear1](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/adam_bear1/32/13411_2.png) [@adam\_bear1](https://forum.dynamobim.com/u/adam_bear1)\
**Post date:** [November 10, 2017, 1:21pm UTC](https://forum.dynamobim.com/t/script-work-with-several-languages/16358/8 "2017-11-10T13:21:58Z")

</div>

slight improvement based on string rather than integer

```
def params (str) {
Translated_Params = {
{"english0","french0"},
{"english1","french1"},
{"english2","french2"}
};
//change language index once
language = 1;

//search for parameter
contains = List.ContainsItem(Translated_Params<1L>, str);
indices = List.AllIndicesOf(contains, true);

return = Translated_Params[indices][language];
};
//call strings
params({"english0","english1","english2"});
```

---

<div class="post-metadata">

**Author:** ![adam\_bear1](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/adam_bear1/32/13411_2.png) [@adam\_bear1](https://forum.dynamobim.com/u/adam_bear1)\
**Post date:** [November 13, 2017, 9:34am UTC](https://forum.dynamobim.com/t/script-work-with-several-languages/16358/9 "2017-11-13T09:34:29Z")

</div>

another slight improvement to run on partial strings

```
def params (str) {
Translated_Params = {
{"english0","french0"},
{"english1","french1"},
{"english2","french2"}};
//change language index once
language = 1;

//search for parameter
str_contains = String.Contains(Translated_Params, str, false);
index_str = List.AllIndicesOf(str_contains@-2<1>, true);
empty = List.IsEmpty(index_str<1L>);
index_false = List.AllIndicesOf(empty, false);
first = List.FirstItem(index_false);

return = Translated_Params[first][language];
};
//call strings
params({"ish","lish1","glish2"});
```

---

<div class="post-metadata">

**Author:** ![Konrad\_X-PLAN](https://avatars.discourse-cdn.com/v4/letter/k/da6949/32.png) [@Konrad\_X-PLAN](https://forum.dynamobim.com/u/Konrad_X-PLAN)\
**Post date:** [December 2, 2021, 12:46am UTC](https://forum.dynamobim.com/t/script-work-with-several-languages/16358/10 "2021-12-02T00:46:39Z")

</div>

This nodes from archilab package can help 🙂

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/e/5/e535057b4efde15f1da8f21cb32cba19e39d13ba.png)
