Forums / Developer / Module localization

Module localization

Author Message

Sao Tavi

Sunday 08 May 2011 3:35:50 am

I was wondering if there is possible to localize the module url.

As for example, a module called user profile that can be accessed at http://www.example.com/eng/user-profile, but I want, for Spanish users, the module to be also accessible at http://www.example.com/esl/perfil-del-usuario (or whatever the right translation may be).

I've tried doing this through .htaccess, but it does not work and I am not knowledgeable enough to be able to debug why not. Here is my htaccess file (I removed my modifications)

# Copy this file to a new file called .htaccess in your eZ Publish root
# to make the site more secure in non-virtualhost mode (index.php used in urls).
#

DirectoryIndex index.php
 
RewriteEngine On
 
# RewriteCond %{HTTP_HOST} ^webdav\..*
# RewriteRule ^(.*) webdav.php [L]
# RewriteCond %{HTTP_HOST} ^soap\..*
# RewriteRule ^(.*) soap.php [L]
 
RewriteRule content/treemenu/? /index_treemenu.php [L]
 
RewriteRule ^var/storage/.* - [L]
RewriteRule ^var/[^/]+/storage/.* - [L]
RewriteRule ^var/([^/]+/)?cache/(texttoimage|public)/.* - [L]
 
RewriteRule ^design/[^/]+/(stylesheets|images|javascript)/.* - [L]
RewriteRule ^share/icons/.* - [L]
RewriteRule ^extension/[^/]+/design/[^/]+/(stylesheets|images|javascripts?)/.* - [L]
Rewriterule ^packages/styles/.+/(stylesheets|images|javascript)/[^/]+/.* - [L]
RewriteRule ^packages/styles/.+/thumbnail/.* - [L]
 
RewriteRule ^favicon\.ico - [L]
RewriteRule ^robots\.txt - [L]
 
# Uncomment the following lines when using popup style debug.
# RewriteRule ^var/cache/debug\.html.* - [L]
# RewriteRule ^var/[^/]+/cache/debug\.html.* - [L]
RewriteRule  ^(.*)esl/perfil-del-usuario(/.*)?$  $1esl/user-profile$2 [L]
RewriteRule .* index.php [L]

I also tried changing last line to

 RewriteRule .* indexProxy.php [L]

And in indexProxy.php changing indexProxy.php to index.php and perfil-del-usuario to user-profile in REQUEST_URI, PHP_SELF, SCRIPT_NAME and then including index.php, but, in practice, this does not work.

I have several modules that I want to have the url translated. Do the links really have to be the module names, or can they be localized? If not, shouldn't this be a feature?

Gaetano Giunta

Sunday 08 May 2011 10:45:53 am

You can translate module names using the virtual urls feature within the eZP admin interface

Principal Consultant International Business
Member of the Community Project Board

Sao Tavi

Monday 09 May 2011 2:31:21 pm

Thank you for your kind reply.

I found the menu, but it seems that I have problems using it. I have, for example, a module called 'coordonate-localitati' that has a view, 'cauta' As it is enable site-wise, the url would be ezroot()/coordonate-localitati/cauta.

On the other hand, I want for English version the url to be: "geographical-coordinates/search".

The problem is that regardless what url I type in the text-box labeled "Destination (path to existing functionality or resource):", I get a response like

"The specified destination URL <coordonate-localitati/cauta> does not exist in the system, cannot create alias for it"

(Sorry for the big letters, it's copy paste and I don't know how to make them small)

So... is there some additional step that I missed? Or what should I input at the "Destination" in my example?

Sao Tavi

Monday 16 May 2011 10:04:48 am

It took a while of searching and hair pulling, but eventually I realized that "-" gets transformed. So, I had to rename my extension by removing the - and everything worked fine.

eZ debug

Timing: Jan 30 2025 00:47:37
Script start
Timing: Jan 30 2025 00:47:37
Module start 'content'
Timing: Jan 30 2025 00:47:37
Module end 'content'
Timing: Jan 30 2025 00:47:37
Script end

Main resources:

Total runtime0.2580 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0062 587.8281180.8516
Module start 'content' 0.00630.0047 768.679797.9766
Module end 'content' 0.01090.2470 866.6563528.2188
Script end 0.2580  1,394.8750 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00281.0680200.0001
Check MTime0.00120.4521200.0001
Mysql Total
Database connection0.00070.266310.0007
Mysqli_queries0.217384.22641410.0015
Looping result0.00110.41751390.0000
Template Total0.246795.610.2467
Template load0.00060.227110.0006
Template processing0.246195.383810.2461
Override
Cache load0.00040.158910.0004
Sytem overhead
Fetch class attribute can translate value0.00080.298410.0008
XML
Image XML parsing0.00020.088310.0002
General
dbfile0.00562.1646200.0003
String conversion0.00000.001830.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