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.