Skip to content

Differences in transliteration compared to behat/transliterator #35061

@kdambekalns

Description

@kdambekalns

Symfony version(s) affected: 5.0.2

Description

We used behat/transliterator until now, but because of issues with PHP 7.4 look into replacing it. I switched our codebase to use symfony/string and run into some differences with the result of transliteration to ASCII.

Input behat/transliterator symfony/strings
汉语 yi-yu han-yu
ភាសាខ្មែរ bhaasaakhmaer
ภาษาไทย phaasaaaithy phas-a-thiy
العَرَبِية l-arabiy al-arabit
한국어 hangugeo hangug-eo
မြန်မာဘာသာ m-n-maabhaasaa
हिन्दी hindii hindi

Notes:

How to reproduce

class TransliterationTest extends UnitTestCase
{
    public function sourcesAndResults(): array
    {
        return [
            ['Überlandstraßen; adé', 'uberlandstrassen-ade'],
            ['TEST DRIVE: INFINITI Q50S 3.7', 'test-drive-infiniti-q50s-3-7'],
            ['汉语', 'yi-yu'],
            ['日本語', 'ri-ben-yu'],
            ['Việt', 'viet'],
            ['ភាសាខ្មែរ', 'bhaasaakhmaer'],
            ['ภาษาไทย', 'phaasaaaithy'],
            ['العَرَبِية', 'l-arabiy'],
            ['עברית', 'bryt'],
            ['한국어', 'hangugeo'],
            ['ελληνικά', 'ellenika'],
            ['မြန်မာဘာသာ', 'm-n-maabhaasaa'],
            [' हिन्दी', 'hindii'],
            ['Иван Иванович', 'ivan-ivanovic'],
            ['Löic & René', 'loic-rene'],
            ['Châteauneuf du Pape', 'chateauneuf-du-pape'],
            ['Žluťoučký kůň', 'zlutoucky-kun'],
            [' x- ', 'x'],
        ];
    }

    /**
     * @test
     * @dataProvider sourcesAndResults
     */
    public function transliterationWorksAsExpected($source, $result): void
    {
        $result = strtolower((new AsciiSlugger())->slug($source)->toString());
        self::assertEquals($result, $result);
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy