Page 1 of 1
Friendly language names in the language links
Posted: Fri Nov 10, 2023 7:47 pm
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
Re: language link in multilanguage project
Posted: Fri Nov 10, 2023 7:53 pm
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.
Re: Language file name
Posted: Fri Nov 10, 2023 8:19 pm
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.
Re: Language file name
Posted: Fri Nov 10, 2023 9:46 pm
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.
Re: Friendly language names in the language links
Posted: Fri Nov 10, 2023 10:46 pm
by ppliessnig