From 3f0105910e2bc14b50886c762e4ac7a4870a3b58 Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Thu, 4 Sep 2014 16:37:29 -0500 Subject: [PATCH] i18n: Correctly initialize the word break iterator --- include/class.format.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/class.format.php b/include/class.format.php index fbbddb631..9267c9ff9 100644 --- a/include/class.format.php +++ b/include/class.format.php @@ -575,7 +575,9 @@ class Format { // Performs Unicode normalization (where possible) and splits words at // difficult word boundaries (for far eastern languages) - function searchable($text) { + function searchable($text, $lang=false) { + global $cfg; + if (function_exists('normalizer_normalize')) { // Normalize text input :: remove diacritics and such $text = normalizer_normalize($text, Normalizer::FORM_C); @@ -613,7 +615,9 @@ class Format { if (class_exists('IntlBreakIterator')) { // Split by word boundaries - if ($tokenizer = IntlBreakIterator::createWordInstance()) { + if ($tokenizer = IntlBreakIterator::createWordInstance( + $lang ?: ($cfg ? $cfg->getSystemLanguage() : 'en_US')) + ) { $tokenizer->setText($text); $text = implode(' ', $tokenizer); } -- GitLab