Friendly language names in the language links

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
ppliessnig
User
Posts: 6

Friendly language names in the language links

Post by ppliessnig »

Hello

I like to have friendly language names in the language links in multilanguage project in PHPMaker 2024. Eg instead of "en-US" and "it-IT", I simply like something like "english" and "italiano" (or en and it).

Renaming the language file from eg "italian.it-IT.xml" to "italian.it.xml" or "italian.xml" does not work as the language file is not loaded with this naming pattern.

What is the missing step please?

Thank you
Patrick


arbei
User
Posts: 8746

Post by arbei »

The language ID in the file name is required, do not remove it, read Language Files. The file name is not the display name of the language links.


ppliessnig
User
Posts: 6

Post by ppliessnig »

Yes it seems so, but then, how do I customize the language link name to a friendly language name different from the id.


arbei
User
Posts: 8746

Post by arbei »

By default the Lanuguage class uses: (Note that it is JsRender Template)
'{{for languages}}<li class="nav-item"><a class="nav-link{{if selected}} active{{/if}} ew-tooltip" title="{{>desc}}" data-ew-action="language" data-language="{{:id}}">{{:id}}</a></li>{{/for}}'

You may use Language_Load server event to set your own, e.g.

$this->Template = '{{for languages}}...your template...{{/for}}';

Also read [Selecting Languages](Selecting Languages):
If you want to customize the text of the links, you can customzie the file C:\Users\<user>\AppData\Roaming\PHPMaker2024\languages\languages.xml.


ppliessnig
User
Posts: 6

Post by ppliessnig »

that works, thank you.


Post Reply