Collections functions
General functions
Node functions
Render functions
Theme permission functions
User functions
Resource functions

normalize_keyword()

Description

Normalize the text if function available

Some languages consider characters with accents to be different characters
and therefore order them after z and other consider them to be the same as the
character without the accent.
See https://www.php.net/manual/en/class.normalizer.php for more information

Parameters

ColumnTypeDefaultDescription
$keyword string Keyword to normalize
$user_language bool false Flag to enable normalizing based on the current user language.

Return

string Normalized keyword

Location

include/language_functions.php lines 344 to 360

Definition

 
function normalize_keyword ($keyword,bool $user_language false) {
    global 
$keywords_remove_diacritics,$language_normalize_mapping;
    if (
function_exists('normalizer_normalize')) {
        if (
$user_language && key_exists($GLOBALS["language"],$language_normalize_mapping)) {
            
$form $language_normalize_mapping[$GLOBALS["language"]];
        } else {
            
$form Normalizer::FORM_C;
        }

        
$keyword=normalizer_normalize($keyword,$form);
    }

    if (
$keywords_remove_diacritics) {
        
$keyword=remove_accents($keyword);
    }
    return 
$keyword;
}

This article was last updated 22nd July 2024 21:35 Europe/London time based on the source file dated 3rd May 2024 14:45 Europe/London time.