Forums / Install & configuration / User-dependent language for admin interface?

User-dependent language for admin interface?

Author Message

Guido Ehlert

Tuesday 18 November 2008 3:48:22 am

Hello ezp community,

at a customer project in an international company we have following situation: Their website is available in three languages (siteaccesses). The admin interface is currently in English, but this is not satisfactory, since some editors understand English and German, but others only Russian for example.

Is it somehow possible to display the admin interface in the user's preferred language? Ideally with the site content in his language too, but this is no must.

The only solution in my mind would be creating three separate siteaccess for the admin interface too. But I'd like to avoid the effort to also manage config files and permissions for this additial siteaccesses, if possible anyhow.

Im am using ezp 4.0.1.

Thanks,
Guido

Arnaud Lafon

Monday 24 November 2008 5:05:34 am

Hi Guido,

I think you'll need to use three siteaccess cuz some core functionnality are directly using the Locale set in your site.ini.
If you want to manage some ini files at a top lvl configuration (but not in the settings/override folder), maybe you could put them in an extension and activate that extension using the ActiveAccessExtension settings. If you want to manage the override.ini.append.php with only one file for all your front office siteaccess for exemple, you'll need to do that otherwise you'll override your backoffice template too.

Arnaud

Looking for information about SQLI ?
Looking for a new job in Paris ?
Please contact me at alafon [at] sqli [dot] com

Kristof Coomans

Monday 24 November 2008 8:25:47 am

Hi

I made a patch for setting the interface language per user, see http://issues.ez.no/14008. Feel free to try and let me know if you have any feedback.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Guido Ehlert

Monday 24 November 2008 11:32:00 pm

Hi Christof,

I applied your patches and in general they do as intended, thanks! It would be perfect if not only the admin interface, but also the content itself (i.e. in the content structure tree) would be shown in the user's language. Is this possible?

But caution: The patches do not work against 4.0.1 files out of the box. I had to delete several commented lines and to patch "manually". For example, in <i>kernel/classes/eznodeviewfunctions.php</i> (file header says build 22260) there is the line 319

$ini = eZINI::instance(); 

which makes the patch fail.

Could you please check whether the patches were made against the official 4.0.1 release? If you need more details, please tell me.

Regards,
Guido

Kristof Coomans

Tuesday 25 November 2008 1:13:11 am

Hi Guido

The patches were made against the trunk (4.1.0alpha1), so they indeed might require some minor modifications for 4.0.x.

I'll see what can be done to get a per-user prioritized language list.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Kristof Coomans

Tuesday 25 November 2008 1:49:00 am

I gave it a quick try, insert this code in index.php in the if ( $lang ) conditional:

    $langCodes = eZContentLanguage::prioritizedLanguageCodes();
    if ( in_array( $lang, $langCodes ) )
    {
        $langCodes = array_diff( $langCodes, array( $lang ) );
        array_unshift( $langCodes, $lang );
        eZContentLanguage::setPrioritizedLanguages( $langCodes );
    }

This code just moves the current language to the front of the prioritized languages list.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Guido Ehlert

Tuesday 25 November 2008 3:30:35 am

Wow, that was fast! Just applied your hack to my index.php and everything is fine now :-)

It should be noted that after changig the language, the user might need to reload the browser cache with CTRL+F5 since otherwise the entries in the content structure tree are still in the old language (at least here with Firefox 3).

But nevertheless, you helped me a lot!

Is there any chance to have such a feature in an official eZ Publish release?

Best regards,
Guido

Joakim Farestveit

Sunday 23 August 2009 6:15:04 pm

Hi, I'm new to all this stuff, so I have absolutely no clue how to apply that patch, and I'd really love to have one user get english interface, and one to get norwegian interface.

To be frank I don't know where to place that code-snippet, and I don't know how to apply any patches, and despite an hour of Google I have to throw in the towel and ask here on the forums :)

I have PuTTY and FireFTP ready at my disposal.

Edit: http://ezpedia.org/en/ez/patch didn't make any sense to me I'm afraid

eZ debug

Timing: Jan 18 2025 11:25:44
Script start
Timing: Jan 18 2025 11:25:44
Module start 'content'
Timing: Jan 18 2025 11:25:44
Module end 'content'
Timing: Jan 18 2025 11:25:44
Script end

Main resources:

Total runtime0.1930 sec
Peak memory usage4,096.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0093 589.7344180.8047
Module start 'content' 0.00930.0058 770.5391102.1016
Module end 'content' 0.01510.1778 872.6406530.8750
Script end 0.1929  1,403.5156 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00402.0874200.0002
Check MTime0.00140.7023200.0001
Mysql Total
Database connection0.00180.922310.0018
Mysqli_queries0.135270.03041410.0010
Looping result0.00150.79151390.0000
Template Total0.177491.910.1774
Template load0.00100.538410.0010
Template processing0.176491.392910.1764
Override
Cache load0.00080.392210.0008
Sytem overhead
Fetch class attribute can translate value0.00090.447710.0009
XML
Image XML parsing0.00030.152910.0003
General
dbfile0.00190.9722200.0001
String conversion0.00000.003630.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