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
|