How to look up enum on locale Key?

Hi,

For the purpose of this topic I have created a new enum called enumItems where two values has been translated to Norwegian from English:

When I print out the enumItems, the Key and Value is printed. But as shown in the image below the Key is printed in English even though my Active Language is Norwegian. And that might be intended.

My scenario is that I want to get an enum-item based on another language. Does anyone have an idea of how to look up/get an item in the enum based on the norwegian translated Key and not the default Key, using javascript?

Thanks!

–
Sondre

Hi!

Not quite sure if I understand the problem or your setup here. But in general, by using either properties of enum datatype, or adding Enumerated Type Data Sources in the App - the Name of those enums are always translated to the client language, also when using them in the function editor (e.g. “return projectStatusDisplay” translates correctly).

How it your “return enumItems” related to the screenshot (printEnum)? In other words, where is this function defined?

Maybe the issues is that you need to add the Enum as a Data Source, and use that in the function editor:

Hello again,

I just verified that adding enums from en “Enums” section in the function editor (with reference to the above screenshot) does not translate. But using enum properties or data sources from your App Data translates. Challenge registered.

1 Like