A problem with Pretty URLs and German Umlauts

Permalink
I have experienced an inconsistency in how page names with German Umlauts are translated into pretty URLs: if a German Umlaut is located within a page name like for instance "Lösung", the canonical URL will be ".../loesung" what is correct.

However, if the first letter of a page name is an Umlaut like in "Übung", it will be converted into ".../bung" instead of ".../uebung" as it should be.

Is this a bug, or do i have to tweak the .htaccess to achieve the correct behaviour?

Michael

okapi
View Replies:
jbx replied on at Permalink Reply
jbx
This looks like the issue - line 31 of /concrete/helpers/text.php:
$multi = array(
    "ä"=>"ae",
    "ö"=>"oe",
    "ß"=>"ss",
    "ü"=>"ue",
    "æ"=>"ae",
    "ø"=>"oe",
    "å"=>"aa",
    "é"=>"e",
    "è"=>"e"   
);
$handle = str_replace(array_keys($multi), array_values($multi), $handle);

I would assume that this is only replacing lowercase characters, so your uppercase letter at the start gets missed and then removed later.

You could either add uppercase variants to this list, or add a strtolower() call in the Page::add() method, where it calls $txt->sanitizeFileSystem()...

Hope that helps,

Jon
okapi replied on at Permalink Reply
okapi
Hi Jon,

cool, thank you for that information!
Now i just tried to copy an edited version of that file to the helpers directory at the root, believing it would simply override the one in the concrete/helpers directory, but unfortunately this leads to a

Fatal error: Cannot redeclare class TextHelper in /.../helpers/text.php on line 20


Obviously it's not enough to only copy text.php in the helpers directory, there must be more files/directories needed... Can you imagine which ones?

Thank you,
Michael
okapi replied on at Permalink Reply
okapi
With the current concrete5 5.6 the problem has changed a bit:

When adding a new page, ä, ö, ü (uppercase and lowercase) in page names are now transformed to a, o, u instead of ae, oe, ue, as it should be.
SigmaAlphaPi replied on at Permalink Reply
SigmaAlphaPi
Just came across this issue myself and noticed, that "ü" becomes "u" and the other "Umlaute" likewise.
But that is not how it should be. For the German special characters it 'has to be' like that:

ä --> ae
ö --> oe
ü --> ue
ß --> ss

The only letter that's handled the right way is the "ß".

On the one hand it's disturbing for me as a native speaker and on the other hand I think I read some articles, that in therms of SEO it is important, that the "Umlaut" characters are converted the right way.

So, I'm going on hunt for finding the right lines in code, where to alter this. :)=

Cheers,
Sven
jbx replied on at Permalink Reply
jbx
The conversion is done in /concrete/libraries/3rdparty/urlify.php.

Modifying this file should be simple enough. Just remember to copy the file under your root libraries and you can modify the contents however you like :)
SigmaAlphaPi replied on at Permalink Reply
SigmaAlphaPi
Hi, thanks for your answer.

Just found me to that spot, but ...

... the correct are conversions set there. Unfortunately the "latin" conversion seems to take effect, not the german. How is that triggered?

Thanks in advance,
Sven
PatrickHeck replied on at Permalink Reply
PatrickHeck
If You set your Language to German ist will work properly in concrete5 >= 5.6.2
SigmaAlphaPi replied on at Permalink Reply
SigmaAlphaPi
Are you talking about the backend's language? If so, that's not a good way to trigger it. I prefer untranslated backends.
PatrickHeck replied on at Permalink Reply
PatrickHeck
No, the site language is not directly connected to you user language.

You can also use the multilingual addon. but you must provide the desired language somehow because transliteration rules can vary between languages.
SigmaAlphaPi replied on at Permalink Reply
SigmaAlphaPi
Hi,

and that "somehow" is how?

Is there any setting in the C5 dashboard or is a lang-attribute in the template's source enough?

Am just testing the "Internationalization"-Addon but still experiencing the issue, that is discussed in the reviews at the moment. But you're right, maybe that could help, because a language is set for a whole branch of a website.

Sven
PatrickHeck replied on at Permalink Reply
PatrickHeck
Either at /dashboard/system/basics/multilingual/ or in your site.php file: define('LOCALE', 'de_DE');

http://www.concrete5.org/developers/translate/...