How to browser language variable in dmx-html bind

I have this code for filtering language of label in my page:

<p class="small text-justify" dmx-html="jsonDS_traduzioni.data.labelcopyrightdecoresin.{{browser1.language}}"></p>

but it doesn’t work

have you tried it as just dmx-text instead of dmx-html to make sure it return something

yes, I tried

dmx-html="jsonDS_traduzioni.data.labelcopyrightdecoresin.{{browser1.language}}

That’s a wrong expression.

Try:

dmx-text="jsonDS_traduzioni.data.labelcopyrightdecoresin + browser1.language

i want ‘it’ dynamic value ( it, en, es, fr) browser language

dmx-html=“jsonDS_traduzioni.data.labelcopyrightdecoresin.it”

it doen’t work, it writes:

[object Object]it

excuse me @Teodor
if I type this code:

dmx-html=“jsonDS_traduzioni.data.labelcopyrightdecoresin.{{browser1.language}}”
the result on the html page is:
jsonDS_traduzioni.data.labelcopyrightdecoresin.it

the result is corret, but doesn’t view a json data, why ?

if I type

dmx-html=“jsonDS_traduzioni.data.labelcopyrightdecoresin.it”

the result on the html page is ok

Ok then, can you explain what are you trying to achieve exactly?

ok, I’m developing a multi language page
I have a json file that contains the translations

{
“labelcopyright”: {
“it”: “labelcopyright-it”,
“en”: “labelcopyright-en”,
“es”: “labelcopyright-es”,
“fr”: “labelcopyright-fr”,
“de”: “labelcopyright-de”
}
}

I want to filter the field label based on the browser language value (browser1.language)

ok ?

for example:

<div class="row">
<div class="col text-center">
<p class="small text-justify" dmx-html="jsonDS_traduzioni.data.labelcopyright.it"></p>
</div>
</div>

works great but I want che final ‘it’ dynamic

SOLVED
the corret way is this:

<p class="small text-justify" dmx-html="jsonDS_traduzioni.data.labelcopyright[browser1.language]"></p>

SOLVED @psweb @Teodor
the correct way is

<p class="small text-justify" dmx-html="jsonDS_traduzioni.data.labelcopyright[browser1.language]"></p>
1 Like