Forum

Thread tagged as: Question, Problem

German Umlaute in slugs/URLs

This might not be an actual Perch issue, but is it possible to have an Umlaut like "ä" be transformed to "ae" in a slug or URL rather then "a"?
"ae" would be the correct form, if you can not use an actual Umlaut?
For the character "ß" it is working correctly by default, turning it into "ss".

Nils Mielke

Nils Mielke 3 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Do you have the PHP Transliteration extension installed? If not, try again with it enabled.

Thanks, Drew. Unfortunately I can't find any helpful documentation on that topic. Any hints on how to get there would be highly appreciated.

Rachel Andrew

Rachel Andrew 394 points
Perch Support

It's a server extension - you would need to speak to your host.

Thanks, Rachel.
I am developing locally for now and not that much of an experienced hoster. ;)

Drew McLellan

Drew McLellan 2638 points
Perch Support

Tried to get my head around that. Never learned Chinese, though ;)
I'll have to live with the flaw, I guess.

Rachel Andrew

Rachel Andrew 394 points
Perch Support

I don't understand what you mean by Chinese.

This isn't a Perch "flaw", we've added support for the PHP function that allows this to happen, if your server doesn't support that function we fall back to a simpler transliteration method. So you have a choice, use a server with that extension enabled OR accept the simpler transliteration. Either way, Perch has coped with that for you.

By Chinese I meant, that I understand next to nothing in the documentation on https://php.net/manual/en/class.transliterator.php
Never mind. :)

The MAMP installation I am running does have the extension installed. That I could find out by running

<?php echo transliterator_transliterate('Latin-ASCII; Lower()','ÄÖÜäöü'); ?>

which echos "aouaou". I do not know how to tell it, how to handle umlauts correctly, though.
I'll get there at some point.
Thanks for your help.

Sorry, for picking this up again, but I still have problems with the German Umlaute.
In a Perch installation I am currently working on I have set

setlocale(LC_ALL, "de_DE");

at the top of my frontend code.
The Perch diagnostics report tells me

Transliteration functions: Yes

Still, when I add a page in the backend with the title "Schüler", it transliterates "schuler" as the file name. Correctly that should be "schueler", though.
I suspect, that I have to set locale for the Perch backend somehow. Is that possible? And where?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Have you set the locale in your config.php file?

No, couldn't find anything in the documentation on how and where to do that.
Do I simply put

setlocale(LC_ALL, "de_DE");

into the config.php?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, that's right.

Thanks.
Still no luck, though.
"Schüler" continues to be transliterated to "schuler".
Any ideas what's missing to fix that?

Drew McLellan

Drew McLellan 2638 points
Perch Support

That's core PHP functionality rather than anything Perch is doing, I believe.

Do you have working examples elsewhere?

No, unfortunately not.
I'll live with it for now and hope that I stumble upon a solution at some point.
Thanks for your help, nonetheless.