Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Better character replacement for URLSegment #1002

Open
SewerHrehorowicz opened this Issue · 4 comments

4 participants

@SewerHrehorowicz

Diactric signs, such as ęółąśłżźć are deleted, and they should be replaced by euoslzzc. I don't know how it looks in other languages, but it works like that in Polish.

@tractorcow tractorcow added this to the 3.2 alpha 1 milestone
@tractorcow
Owner

This sounds like a good idea.

Here's an example of a replacement chart that we could consider as an option. https://github.com/EllisLab/CodeIgniter/blob/develop/application/config/foreign_chars.php

@simonwelsh

If you have iconv installed, you can use:

SS_Transliterator:
  use_iconv: true
@Craftnet

Hi, now for polish signs I use this code:

//Znaki PL w URLSegment - dodajemy w Class w Page.php
public function generateURLSegment($title){
        $arg1 = array('ą', 'Ą', 'ć', 'Ć', 'ę', 'Ę', 'ł', 'Ł', 'ń', 'Ń', 'ó', 'Ó', 'ś', 'Ś', 'ź', 'Ź', 'ż', 'Ż' );
        $arg2 = array('a', 'a', 'c', 'c', 'e', 'e', 'l', 'l', 'n', 'n', 'o', 'o', 's', 's', 'z', 'z', 'z', 'z' );
        $title = str_replace ( $arg1, $arg2, $title );
        $filter = URLSegmentFilter::create();
        $t = $filter->filter($title);

        // Fallback to generic page name if path is empty (= no valid, convertable characters)
        if(!$t || $t == '-' || $t == '-1') $t = "page-$this->ID";

        // Hook for extensions
        $this->extend('updateURLSegment', $t, $title);

        return $t;
    }

And yes, I think too that this good idea

Sorry for my weak English

@tractorcow tractorcow modified the milestone: 4.0, 3.2 alpha 1
@tractorcow
Owner

Changing to 4.0 since there's no fix in time for 3.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.