Multilingual japanese url alias

Author Message

jeremy dauvilliers

Monday 09 November 2009 2:40:43 pm

Hi all,

There is my problem :

I have a website in 3 languages, french, english and japanese, url_alias for french and english siteaccess are OK but japanese url_aliases looks like node_%node_id%

Can i do something to get the url_alias of english siteaccess for japanese language by default or always take english url alias?

Thans for your help!

Bertrand Dunogier

Tuesday 10 November 2009 1:30:18 am

You need to transliterate the japanese caracters to "readable" ones. The main difficulty is that you need to find either an extension or alib that will convert the japanese string for you... I know that pecl/translit can do it for chinese, but not to japanese.

Once you've found such a library, you can simply use an URL filter, see here: http://ez.no/doc/ez_publish/technical_manual/3_10/reference/configuration_files/site_ini/urltranslator/filters (check the comments).

Bertrand Dunogier
eZ Systems Engineering, Lyon
http://twitter.com/bdunogier
http://gplus.to/BertrandDunogier

Sylvain Gogel

Friday 13 November 2009 12:42:55 pm

Got a site with arabian version, i cannot remember having any issues with url alias... gotta double check for the config/solution we have used

--
http://www.ecedi.fr
Agence Web, Créa/Conseils, Accessibilité
eZPublish, Drupal, Zend, Symfony

Andy Caiger

Tuesday 24 November 2009 7:03:48 pm

We are facing a similar task but with a Chinese/English website. Rather than transliterate the Chinese characters, all I want to do is turn off the Chinese URL aliases so that both siteaccesses use the English URLs. How can I do this? We're using eZ Publish 4.2.0.

EAB - Integrated Internet Success
Offices in England, France & China.
http://www.eab.co.uk http://www.eab-china.com http://www.eab-france.com

Andy Caiger

Tuesday 26 January 2010 9:47:18 pm

Has anyone got an answer to this? I don't want to transliterate the Chinese characters, all I want to do is the same as Jeremy above, use the url_alias of the English siteaccess for all siteaccesses.

EAB - Integrated Internet Success
Offices in England, France & China.
http://www.eab.co.uk http://www.eab-china.com http://www.eab-france.com

jeremy dauvilliers

Wednesday 27 January 2010 2:34:48 am

I have made a little extension can help you :

create extension jdfilter

Create file jdfilter/settings/site.ini.append.php , int this copy this settings and choose your languages traductions :

[URLTranslator]

Extensions[]=jdfilter

Filters[]=jdfilter

[JDTranslation]

URLLanguage[]

URLLanguage[]=eng-GB

URLLanguage[]=fre-FR

*/ ?>

After create the jdfilter/urlfilters/jdfilter.php file with this :

<?php

class jdFilter extends eZURLAliasFilter

{

function jdFilter()

{

}

function process( $text, &$languageObject, &$caller )

{

if ( $caller instanceof eZContentObjectTreeNode )

{

$text = strtolower( $text );

if( $languageObject->attribute('locale') == 'jpn-JP')

{

if( !preg_match( '/^[-a-z0-9._]+$/i', $text ) )

{

$valid = false;

$object = $caller->attribute('object');

$available_languages = $object->attribute('available_languages');

$siteINI = eZINI::instance( 'site.ini' );

$URLTranslations = $siteINI->variable( 'JDTranslation', 'URLLanguage' );

foreach( $URLTranslations as $URLTranslation )

{

if( in_array( $URLTranslation, $available_languages ) && $valid == false )

{

$tsName = $object->name( false, $URLTranslation );

$tsName = eZURLAliasML::convertToAlias( $tsName );

$tsName = strtolower( $tsName );

if( preg_match( '/^[-a-z0-9._]+$/i', $tsName ) )

{

$text = $tsName;

$valid = true;

}

}

}

}

}

}

return $text;

}

}

?>

And just enable the jdfilter extension in your site.ini.append.php

Andy Caiger

Thursday 28 January 2010 12:46:43 am

This looks good, but I can't get it to work! The extension is recognized and the admin interface shows the extension settings in site.ini when I look in Settings / View, but the process() function never seems to get called.

Settings / View for site.ini gives:

Filters default
extension:jdfilter
[0] [1] jdfilter

Any ideas?

EAB - Integrated Internet Success
Offices in England, France & China.
http://www.eab.co.uk http://www.eab-china.com http://www.eab-france.com

Andy Caiger

Sunday 07 March 2010 7:47:36 pm

Finally, I did get this working. I needed to change the TransformationGroup setting in site.ini as below:

[URLTranslator]
TransformationGroup=urlalias_iri

After that, when each new object was published eZ Publish would generate a URL alias for it using the extension. For existing objects, I needed to re-edit them to change the URL alias.

Thanks very much Jeremy, this is a good solution!

EAB - Integrated Internet Success
Offices in England, France & China.
http://www.eab.co.uk http://www.eab-china.com http://www.eab-france.com

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.