Jump to content

Convert german Umlaute


felted
 Share

Recommended Posts

Hello,

i would like to convert germand Umlaute url-conform.
ü = ue
ä = ae
usw...

I use this code:

$tmp = $sanitizer->pageName("Über", true);

But the output for über is:

ber

And the output für Größe is:
 

gre

Can anyone help me?

 

Greetings and thank you, Detlef

 

Link to comment
Share on other sites

Go to Modules / Core / Page Name and add to Character replacements:

ä=ae
ö=oe
ü=ue

Save and check if it's still there. (in my case I always have to add it twice)

I honestly don't know why it isn't there already...

Link to comment
Share on other sites

1 hour ago, Klenkes said:

I honestly don't know why it isn't there already...

Because there are many languages that uses those chars. Means: these are not only "german umlauts", this is used in multiple languages. And those languages all reduce the chars to a single char, (ä -> a, ö -> o, ü -> u). So, the usage in german language, changing it to a char with a trailing e, is in the minority here. ?

  • Like 3
Link to comment
Share on other sites

8 hours ago, felted said:

But the output for über is:


ber

And the output für Größe is:
 


gre

I get different results.

2018-08-15_085640.png.795b661b85d0cd510e11bb1d19ecc726.png

Using the Sanitizer::translate constant in the second argument means the sanitizer will use the character replacements defined in the InputfieldPageName module settings. So if you only need to account for the German language you can edit the replacements for ü, etc, to achieve a result like that shown above.

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...