Re: [Tiki-devel] A Unicode-aware replacement for the natcasesort() function
Jean-Marc Libs <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.devel |
|---|---|
| Message-ID | <CA++RN4eLp4raE7gKngmSMSnh3Qdx5XH6LgM=C0B8GsUQYcMrBg@mail.gmail.com> |
I wouldn't say the messages contradict each other. They are never shown together. The first message is in case the intl extension is present. Nothing needs to be done. There is no need for detailed explanations. The second one is besides an orange warning (not a red issue). It explains one should install the extension but if one can't, nothing is going to blow up. Tiki will still work, just not as well. Cheers, J-M On Sat, Jul 8, 2023 at 2:43 PM Volker Wysk <post-hhF2Jplw28UoZk/[email protected]> wrote: > Am Samstag, dem 08.07.2023 um 14:22 +0200 schrieb Jean-Marc Libs: > > Hi Volker, > > > > This is how tiki-check.php does it: > > > > // intl > > $s=extension_loaded('intl'); > > Okay. > > > if($s){ > > $php_properties['intl']=array( > > 'fitness'=> tra('good'), > > 'setting'=>'Loaded', > > 'message'=> tra("The intl extension is required for Tiki 15 and > > newer.") > > ); > > }else{ > > $php_properties['intl']=array( > > 'fitness'=> tra('unsure'), > > 'setting'=>'Not available', > > 'message'=> tra("intl extension is preferred for Tiki 15 and newer. > > Because is not available, the filters for text will not be able to detect > > the language and will use a generic range of characters as letters.") > > ); > > } > > That's interesting. It says "The intl extension is required for Tiki 15 and > newer." and "intl extension is preferred for Tiki 15 and newer...". > > So, can we assume that the intl extension is available? The two messages > contradict each other. > > Cheers, > Volker > > > > > > > > > > > > > > On Sat, Jul 8, 2023 at 1:59 PM Volker Wysk <post-hhF2Jplw28UoZk/[email protected]> wrote: > > > Hi. > > > > > > Does anyone know how to check if the intl PHP extension is available? > > > > > > Bye > > > V.W. > > > > > > Am Freitag, dem 07.07.2023 um 13:31 +0200 schrieb Volker Wysk: > > > > Hi! > > > > > > > > Here it is: > > > > > > > > > ---------------------------------------------------------------------- > > > > ------ > > > > // Do a natural, locale aware sort of an array of strings. > > > > // > > > > // "Natural" means that numbers are sorted by their value, not by the > > > > digits > > > > // they contain. For instance, "10" is ordered after "2". > > > > // > > > > // The "lang" argument is the language for which to order. Accented > > > > // characters, like "ä", are ordered with their non-accented > > > > counterpart, > > > > // like "a". In the non-locale aware natcasesort() function, > accented > > > > // characters get ordered at the end. That's not right for non- > > > > English > > > > // languages. > > > > // > > > > // For the "lang" argument, "false" can be specified. In this case, > > > > the > > > > // function investigates the language of the current user and uses > > > > that. > > > > // > > > > // mb_natcasesort() depends on the "intl" PHP extension. > > > > > > > > function mb_natcasesort(string $lang, array &$array): bool > > > > { > > > > if ($lang == false) { > > > > $tikilib = TikiLib::lib('tiki'); > > > > $loginlib = TikiLib::lib('login'); > > > > > > > > $user = $loginlib->getUser(); > > > > $lang = $tikilib->get_language($user); > > > > } > > > > > > > > $coll = collator_create($lang); > > > > collator_set_attribute($coll, Collator::NUMERIC_COLLATION, > > > > Collator::ON); > > > > collator_set_attribute($coll, Collator::CASE_FIRST, > > > > Collator::LOWER_FIRST); > > > > collator_set_attribute($coll, Collator::ALTERNATE_HANDLING, > > > > Collator::SHIFTED); > > > > > > > > return collator_asort($coll, $array); > > > > } > > > > > ---------------------------------------------------------------------- > > > > ------ > > > > > > > > Any comments are welcome. > > > > > > > > Regards, > > > > Volker > > > > _______________________________________________ > > > > TikiWiki-devel mailing list > > > > [email protected] > > > > https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel > > > > > > _______________________________________________ > > > TikiWiki-devel mailing list > > > [email protected] > > > https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel > > _______________________________________________ > > TikiWiki-devel mailing list > > [email protected] > > https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel > > _______________________________________________ > TikiWiki-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel > _______________________________________________ TikiWiki-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel