Skip to content

How to transliterate from UTF8 to ASCII? #372

Discussion options

You must be logged in to vote

And with some help of the API you can add a TitleSlug setting, if there isn't already one.

Here's an example extension file system/extensions/transliterate.php. It transliterates UTF8 characters to ASCII, for example Привет to Privet. I looked at different built-in PHP functions, in the end this is the solution that worked best on my web server. It can be extended to transliterate more languages if needed.

<?php
// Transliterate extension, experimental

class YellowTransliterate {
    const VERSION = "0.9.3";
    public $yellow;         //access to API

    // Handle initialisation
    public function onLoad($yellow) {
        $this->yellow = $yellow;
    }
    
    // Handle content file…

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@markseuffert
Comment options

Answer selected by annaesvensson
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #372 on December 27, 2020 13:40.