How to show Language Flags?

Author Message

Neo Pixel

Friday 17 April 2009 4:25:57 am

Can anyone tell me how to show language flag images instead of the text "eng" "fra" etc

Thanks in advance :-)

Asking stupid questions so you don't have to!

Floris van den Hoeven

Thursday 13 May 2010 1:19:59 pm

Hi,

I could not find a good solution as well.. and therefore I tried something out myself.

I know this is not the cleanest code,.. but maybe it can be useful you and someone else.

Please go to EXTENSION/EZWEBIN/DESIGN/EZWEBIN/TEMPLATES/
Then edit the file PAGE_HEADER_LANGUAGES.TPL

Then replace the complete code with the code below:

<div id="languages">
{def $lang='eng-US'}
<a href={concat('index.php/',$lang|extract_left(3)|downcase())|ezroot}>
<img src={$lang |flag_icon} alt="{$lang}" title="{$lang}"/>
</a>
{def $lang='ger-DE'}
<a href={concat('index.php/',$lang|extract_left(3)|downcase())|ezroot}>
<img src={$lang |flag_icon} alt="{$lang}" title="{$lang}"/>
</a>
{def $lang='fre-FR'}
<a href={concat('index.php/',$lang|extract_left(3)|downcase())|ezroot}>
<img src={$lang |flag_icon} alt="{$lang}" title="{$lang}"/>
</a>
{def $lang='esl-ES'}
<a href={concat('index.php/',$lang|extract_left(3)|downcase())|ezroot}>
<img src={$lang |flag_icon} alt="{$lang}" title="{$lang}"/>
</a>
{def $lang='dut-NL'}
<a href={concat('index.php/',$lang|extract_left(3)|downcase())|ezroot}>
<img src={$lang |flag_icon} alt="{$lang}" title="{$lang}"/>
</a>
</div>

I hope this helps.. and I hope that someone could make this a bit more easier to do or generate it automatically.
Having a nice option in eZ Publish (Graphical or Text-based links) would be a nice idea as well I think.

Greetings,
Floris.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 14:53:32
Script start
Timing: Jan 18 2025 14:53:32
Module start 'layout'
Timing: Jan 18 2025 14:53:32
Module start 'content'
Timing: Jan 18 2025 14:53:33
Module end 'content'
Timing: Jan 18 2025 14:53:33
Script end

Main resources:

Total runtime1.1422 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0053 587.9141152.6250
Module start 'layout' 0.00530.0028 740.539139.4453
Module start 'content' 0.00811.1328 779.9844526.7734
Module end 'content' 1.14090.0013 1,306.75788.1641
Script end 1.1422  1,314.9219 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.2869160.0002
Check MTime0.00130.1142160.0001
Mysql Total
Database connection0.00060.054410.0006
Mysqli_queries1.091695.5732540.0202
Looping result0.00050.0433520.0000
Template Total1.109397.120.5547
Template load0.00200.170920.0010
Template processing1.107496.951620.5537
Template load and register function0.00010.010310.0001
states
state_id_array0.00080.072110.0008
state_identifier_array0.00130.115520.0007
Override
Cache load0.00160.1397390.0000
Sytem overhead
Fetch class attribute can translate value0.00060.054420.0003
Fetch class attribute name0.00120.108930.0004
XML
Image XML parsing0.00180.155820.0009
class_abstraction
Instantiating content class attribute0.00000.000630.0000
General
dbfile0.00480.4216170.0003
String conversion0.00000.000640.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 15
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs