GithubHelp home page GithubHelp logo

vria / nodiacritic Goto Github PK

View Code? Open in Web Editor NEW
11.0 3.0 2.0 271 KB

Twig filter to strip all diacritical signs from strings

License: GNU General Public License v2.0

PHP 100.00%
php string-manipulation diacritical-signs accents

nodiacritic's Introduction

nodiacritic

Build Status Total Downloads

Tiny helper function that removes all diacritical signs from characters. Function is aware of German and Danish diacritic particularities.

Installation

composer.json

"require": {
    "vria/nodiacritic": "0.*"
}

Use

use VRia\Utils\NoDiacritic;

$noDiacriticString = NoDiacritic::filter("Révolution française");

As expected, the result is Revolution francaise.

The library is aware of particularities in German and Danish language:

use VRia\Utils\NoDiacritic;

$noAccentsNiceStreet = NoDiacritic::filter("Schöne straße", "de");

The result is Schoene strasse.

The code is inspired by WordPress' remove_accents function.

nodiacritic's People

Contributors

vria avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

nodiacritic's Issues

Request to relicense to "GPL 2.0 or later"

This library is used in a WordPress plugin: https://github.com/publishpress/PublishPress-Planner/blob/a4a52f92eb6c972a3b7c590ebbcfb4a0cb6b1c96/composer.lock#L10096

The WordPress plugin is licensed as GPLv2 or later: https://github.com/publishpress/PublishPress-Planner#license

However, this has no effect because the usage of this library would require everything to be licensed as GPLv2 or compatible. It's not possible to use a GPLv2 component in a GPLv3 context, whereas GPLv2-or-later is allowed.

This means that when another plugin is licensed as GPLv3, then using PublishPress Planner is no longer allowed because of the license clash.

Here are the corresponding issues:
publishpress/PublishPress-Planner#1237
lucatume/wp-browser#600

As short-term solution (until there is a better one), it would be easiest, if this library was relicensed to "GPL 2.0 or later" instead of "GPL 2.0 only" (see https://github.com/vria/nodiacritic/blob/0eb3cafbca8ac1b478bd4dabe0666d8b0d3cba6c/LICENSE and

"license": "GPL-2.0",
)

Readme improvement

The readme file can be improve by adding the namespace of the class, in the ##Usage section.

use VRia\Utils\NoDiacritic;

$noDiacriticString = NoDiacritic::filter("Révolution française");

Regards

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.