Forums / Setup & design / Display available translations

Display available translations

Author Message

Kjell Knudsen

Thursday 12 August 2004 2:16:23 am

Searching for an hour for the answer to this - really strange I can't find.

Want to list the available translations of an object on the user side, with links to display them. (similar to how they are listed on right in admin)

Also wondering at how to change the name of the language - since I just want it to eg say "Spanish" or "Español" and not "Castillan (Spain)".

regards,

-kjell

Kjell Knudsen
http://www.icbl.org

Bård Farstad

Thursday 12 August 2004 5:26:46 am

Kjell,

Try something like this.

{section var=translation loop=$node.object.current_version.translation_list}
   {$translation}
{/section}

--bård

Documentation: http://ez.no/doc

Bård Farstad

Monday 16 August 2004 4:53:40 am

And the code which also will show a link would look something like:

{section var=translation loop=$node.object.current_version.translation_list}
   <a href={concat($node.url_alias,'/(language)/',$translation )|ezurl}>{$translation}</a>
{/section}

Normally we use different site accesses for the different translations, then the link would be different. E.g. with language code prepended in the url.

--bård

Documentation: http://ez.no/doc

Kjell Knudsen

Friday 03 September 2004 2:04:09 am

Here's the code which Peter made for me in the end- which solved all my issues very nicely. Listing the additional translations if there are any, and also allows me to override the system names for the languages:

{* Code to show list of translations *}
{* to use pictures, instead of text uses st.like this: 'esl-ES',concat('<img src=',"picture_name.png"|ezimage,'/>') *}

{let languages=hash('cat-ES','Catalan', 'chi-CN','Chinese', 'cze-CZ','Czech', 'dan-DK','Danish', 'dut-NL','Dutch', 'eng-CA','English (Canada)', 'eng-GB','English (United Kingdom)', 'eng-US','English', 'esl-ES','Español', 'esl-MX','Castillan', 'fin-FI','Finnish', 'fre-CA','French (Canada)', 'fre-FR','Français', 'ger-DE','German (Germany)', 'hun-HU','Hungarian', 'ita-IT','Italian', 'nno-NO','Norwegian (Nynorsk)', 'nor-NO','Norwegian (Bokmal)', 'pol-PL','Polish', 'por-BR','Portuguese (Brasil)', 'por-MZ','Portuguese (Mozambique)', 'por-PT','Portuguese (Portugal)', 'rus-RU','Russian', 'swe-SE','Swedish')

all_translations=$node.object.current.translation_list}
    {section show=$all_translations|count|gt(0)}
    <div class="translations">
	    {section var=translation loop=$node.object.current.translation_list}
                <a href={concat($node.url_alias,'/(language)/',$translation.item.language_code)|ezurl}>{$languages[$translation.item.language_code]}</a> | 
            {/section}
    </div>
    {/section}
{/let}

Kjell Knudsen
http://www.icbl.org

eZ debug

Timing: Jan 31 2025 00:38:37
Script start
Timing: Jan 31 2025 00:38:37
Module start 'content'
Timing: Jan 31 2025 00:38:37
Module end 'content'
Timing: Jan 31 2025 00:38:38
Script end

Main resources:

Total runtime0.1761 sec
Peak memory usage8,192.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0065 589.0781370.2969
Module start 'content' 0.00660.0136 959.37501,005.5469
Module end 'content' 0.02010.1559 1,964.92193,893.8438
Script end 0.1760  5,858.7656 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00432.4224200.0002
Check MTime0.00130.7380200.0001
Mysql Total
Database connection0.00080.445410.0008
Mysqli_queries0.087649.75941410.0006
Looping result0.00110.62101390.0000
Template Total0.155588.310.1555
Template load0.00070.415710.0007
Template processing0.154887.920610.1548
Override
Cache load0.00050.283910.0005
Sytem overhead
Fetch class attribute can translate value0.00191.075110.0019
XML
Image XML parsing0.00030.145410.0003
General
dbfile0.01015.7089200.0005
String conversion0.00000.002730.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs