Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

pretty URLs with Titles with special chars (slovak, czech, german...)


Go to End


1516 Views

Avatar
pali

Community Member, 33 Posts

19 June 2009 at 9:14pm

update sapphire/javascript/UpdateURL.js like this:

Add function

function deLocalize( inStr ) {
        
        var outStr = inStr;
        outStr = outStr.replace(/[áÁ]/g, 'a');
        outStr = outStr.replace(/[éÉ]/g, 'e');
        outStr = outStr.replace(/[íÍ]/g, 'i');
        outStr = outStr.replace(/[ýÝ]/g, 'y');
        outStr = outStr.replace(/[óÓ]/g, 'o');
        outStr = outStr.replace(/[úÚ]/g, 'u');
        outStr = outStr.replace(/[ôô]/g, 'o');
        outStr = outStr.replace(/[ää]/g, 'a');
        outStr = outStr.replace(/[ůů]/g, 'u');
        outStr = outStr.replace(/[ěĚ]/g, 'e');
        outStr = outStr.replace(/[Å¡Å ]/g, 's');
        outStr = outStr.replace(/[čČ]/g, 'c');
        outStr = outStr.replace(/[řŘ]/g, 'r');
        outStr = outStr.replace(/[ťŤ]/g, 't');
        outStr = outStr.replace(/[žŽ]/g, 'z');
        outStr = outStr.replace(/[ľĽ]/g, 'l');
        outStr = outStr.replace(/[ĺĹ]/g, 'l');
        outStr = outStr.replace(/[ďĎ]/g, 'd');
        outStr = outStr.replace(/[ňŇ]/g, 'n');
        return outStr;
    }

and replace

var newSuggestion = urlSegmentField.suggestNewValue( this.value.toLowerCase() );

with

var newSuggestion = urlSegmentField.suggestNewValue( deLocalize(this.value.toLowerCase()) );

Above chars are special for slovak or czech languages...

Enjoy

Pali