Hi All,
I'm trying to build language dropdown for a site that is using Enhanced Data model in Power pages. There are 2 languages English and French. On the portal I've modified the header code as follows so only the other language displays using the code below.
{% if website.languages.size > 1 %} {% for language in page.languages %} {% capture lang%}/{{language.code}}{%endcapture%} {% if request.url contains lang %} {% assign langCode = language.code %} {% else %} {% if user %} <a href="/{{ language.url_substitution }}"> {% else %} <a href="/{{ language.code }}"> {% endif %} <abbr title="{{ language.name }}"> {{ language.code }} </abbr> <span> {{ language.name }} // I would like to use the value from display name here instead of name. </span> </a> {% endif %} {% endfor %} {% endif %}
I've updated Display Name as Français but on the website, it shows French - France.
Is there any liquid attribute in languages object that I can use to get the display name? Based on the Microsoft documentation I don't see an option to get display name.
Thanks
Apologies, I understand the issue now
I think the "Display Name" is always ignored, that's my experience anyway
Please take a look at this thread that I replied recently with the steps to change the "Name" of the Language:
Language Displayname for language settings on webs... - Power Platform Community (microsoft.com)
Did you manage to resolve this @PowePortalDev? Weird that the display name isn't available as an attribute in EDM.
Thanks for getting back @OliverRodrigues
The reason for writing custom code is I don't want to show a dropdown containing both languages. I only need to show another available language that user can switch. Moreover, I'm using same Liquid tags that are used in Language Dropdown web template. The issue that I've is {{ language.name }} displays the actual language name and not the display name.
Hi, is there any reason as to why you are building your custom code for the language dropdown?
there is one available OOB in the Header Web Template:
{% if website.languages.size > 1 %}
<li class=' nav-item dropdown'>
<a class=' nav-link dropdown-toggle' aria-roledescription='link' href='#' data-bs-toggle='dropdown' aria-label='{{ website.selected_language.name | escape }}' aria-haspopup='true' aria-expanded='false' title='{{ website.selected_language.name | escape }}'>
<span class='drop_language'>{{ website.selected_language.name | escape }}</span>
<span class='caret'></span>
</a>
{% include 'Languages Dropdown' %}
</li>
<li class=' nav-item divider-vertical' aria-hidden='true'></li>
Fubar
62
Super User 2025 Season 2
Lucas001
48
Super User 2025 Season 2
KevinGador
44
Super User 2025 Season 2