Forums / Setup & design / Choosing language at publishing time

Choosing language at publishing time

Author Message

Stefano Maffulli

Monday 29 January 2007 3:40:58 am

hello,

on fsfe.org we have been playing with ezp 3.8.6 to test the multilanguage features. We are stuck on a usability question: when users decide to create new content (say an article) the are brought to a 'select the language' page and then to the normal edit page. The default process looks something like:

create --> select language --> write content --> publish

We don't like the extra step and would prefer to select the language within the 'write content' phase. Would that be possible? and how?

thanks
stef

--
: Stefano Maffulli : https://www.fsfe.org/en/fellows/maffulli/
`--------+----------+--------------------------------------------------.
Join the Fellowship of FSFE http://fsfe.org

Daniele P.

Tuesday 30 January 2007 7:01:45 am

Hi Stefano,
I don't think that it's possible in a easy way.
Usually you have to choose the language first because the CMS engine create a draft using the choosen language.
Enable the debug redirection to see how it works.

Maybe you could skip the language question and use the default language for the site.
See
http://ez.no/community/forum/setup_design/language_of_content_creation_in_the_frontend_3_8

Regards,
Daniele

J-A Eberhard

Tuesday 30 January 2007 12:53:04 pm

Try to add this

<input type="hidden" name="ContentLanguageCode" value="{ezini('RegionalSettings', 'Locale')}" />

in your form

Open Source Solution Provider
Open-Net Ltd Switzerland
http://www.open-net.ch

Stefano Maffulli

Thursday 01 February 2007 10:09:14 am

Thanks for the suggestions, but neither of the two really suits our needs because there can be cases where the user is using the Italian siteaccess but wants to write an article in English (or viceversa), so forcing a default language defeats the whole purpose of having a multilanguage site.

I have to say that this is quite disappointing. I don't see a simple way out since, as Daniele say, eZP creates a draft as soon as you hit the 'create' button.

Is there a way to change the language *after* the object has been published (or after the draft has been created)?

thanks
stef

PS are we the only one that think this is a serious usability issue?

--
: Stefano Maffulli : https://www.fsfe.org/en/fellows/maffulli/
`--------+----------+--------------------------------------------------.
Join the Fellowship of FSFE http://fsfe.org

Xavier Dutoit

Thursday 01 February 2007 2:34:31 pm

Hi,

Creating the draft as the first step is more a pain and has quite a lot of added problem (not to mention the effect on the speed before seeing the form ;)

Would it be a solution for your problem to offer 2 buttons create english and create italian ? (or offer a select with all the languages, or a drop menu or...)

X+

http://www.sydesy.com

Stefano Maffulli

Thursday 01 February 2007 10:17:16 pm

> Would it be a solution for your problem to offer 2 buttons create english and
> create italian ? (or offer a select with all the languages, or a drop menu or...)

This could be a solution. I'll investigate this as a possibility.

Thanks,
stefano

--
: Stefano Maffulli : https://www.fsfe.org/en/fellows/maffulli/
`--------+----------+--------------------------------------------------.
Join the Fellowship of FSFE http://fsfe.org

Luc Chase

Sunday 17 June 2007 4:49:57 am

You can add this code ( taken from the admin/.../children.tpl template ) next to the 'New Topic' etc. buttons.

{* Language Selector  *}

{def $can_create_languages=fetch( content, prioritized_languages )}

    {if ne( $can_create_languages|count, 1 )}
    <script type="text/javascript">
    <!--
        {literal}
        function updateLanguageSelector( classSelector )
        {
            languageSelector = classSelector.form.ContentLanguageCode;
            if ( !languageSelector )
            {
                return;
            }

            classID = classSelector.value;
            languages = languagesByClassID[classID];
            candidateIndex = -1;

            for ( var index = 0; index < languageSelector.options.length; index++ )
            {
                var value = languageSelector.options[index].value;
                var disabled = true;

                for ( var indexj = 0; indexj < languages.length; indexj ++ )
                {
                    if ( languages[indexj] == value )
                    {
                        disabled = false;
                        break;
                    }
                }

                if ( !disabled && candidateIndex == -1 )
                {
                    candidateIndex = index;
                }

                languageSelector.options[index].disabled = disabled;
                if ( disabled )
                {
                    languageSelector.options[index].style.color = '#888888';
                    if ( languageSelector.options[index].text.substring( 0, 1 ) != '(' )
                    {
                        languageSelector.options[index].text = '(' + languageSelector.options[index].text + ')';
                    }
                }
                else
                {
                    languageSelector.options[index].style.color = '#000000';
                    if ( languageSelector.options[index].text.substring( 0, 1 ) == '(' )
                    {
                        languageSelector.options[index].text = languageSelector.options[index].text.substring( 1, languageSelector.options[index].text.length - 1 );
                    }
                }
            }

            if ( languageSelector.options[languageSelector.selectedIndex].disabled )
            {
                window.languageSelectorIndex = candidateIndex;
                languageSelector.selectedIndex = candidateIndex;
            }
        }

        function checkLanguageSelector( languageSelector )
        {
            if ( languageSelector.options[languageSelector.selectedIndex].disabled )
            {
                languageSelector.selectedIndex = window.languageSelectorIndex;
                return;
            }
            window.languageSelectorIndex = languageSelector.selectedIndex;
        }

        window.onload = function() { updateLanguageSelector( document.getElementById( 'ClassID' ) ); }
        {/literal}

        languagesByClassID = new Array();
        {foreach $can_create_classes as $class}
        languagesByClassID[{$class.id}] = [ {foreach $class.can_instantiate_languages as $tmp_language}'{$tmp_language}'{delimiter}, {/delimiter} {/foreach} ];
    {/foreach}
    // -->
    </script>
    {/if}

    

    {if and(eq( $can_create_languages|count, 1 ), is_set( $can_create_languages[0] ) )}
        <input name="ContentLanguageCode" value="{$can_create_languages[0].locale}" type="hidden" />
    {else}
        <select name="ContentLanguageCode" onchange="checkLanguageSelector(this)" title="{'Use this menu to select the language you wish use for the creation and click the "Create here" button. The item will be created within the current location.'|i18n( 'design/admin/node/view/full' )|wash()}">
            {foreach $can_create_languages as $tmp_language}
                <option value="{$tmp_language.locale|wash()}">{$tmp_language.name|wash()}</option>
            {/foreach}
       </select>
    {/if}
    {undef $can_create_languages}


{* /Language Selector  *}

 

The Web Application Service Provider

Stefano Maffulli

Thursday 23 August 2007 6:41:26 am

Thanks for the suggestion. We have put online a suitable solution.

--
: Stefano Maffulli : https://www.fsfe.org/en/fellows/maffulli/
`--------+----------+--------------------------------------------------.
Join the Fellowship of FSFE http://fsfe.org

eZ debug

Timing: Jan 30 2025 21:19:26
Script start
Timing: Jan 30 2025 21:19:26
Module start 'content'
Timing: Jan 30 2025 21:19:26
Module end 'content'
Timing: Jan 30 2025 21:19:26
Script end

Main resources:

Total runtime0.2593 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.0118 588.0469370.2891
Module start 'content' 0.01180.0156 958.33591,013.6719
Module end 'content' 0.02750.2317 1,972.00783,902.2422
Script end 0.2592  5,874.2500 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00532.0458200.0003
Check MTime0.00160.6035200.0001
Mysql Total
Database connection0.00150.561110.0015
Mysqli_queries0.149957.80961410.0011
Looping result0.00230.87941390.0000
Template Total0.231089.110.2310
Template load0.00120.469510.0012
Template processing0.229888.628610.2298
Override
Cache load0.00080.291210.0008
Sytem overhead
Fetch class attribute can translate value0.00200.785710.0020
XML
Image XML parsing0.00030.117310.0003
General
dbfile0.00501.9255200.0002
String conversion0.00000.004230.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