Forums / Setup & design / Choosing language at publishing time
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?
thanksstef
-- : 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. Seehttp://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
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)?
PS are we the only one that think this is a serious usability issue?
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
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
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
Thursday 23 August 2007 6:41:26 am
Thanks for the suggestion. We have put online a suitable solution.