Re: [Tiki-devel] Tracker item calculation field date and multilingual
Bernard Sfez via TikiWiki-devel <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Jonny, > and apparently we should use this now: > > https://www.php.net/manual/en/intldateformatter.format.php At https://wiki.php.net/rfc/deprecations_php_8_1#strftime_and_gmstrftime it says: As the note already mentioned, date_parse_from_format() is an alternative that is always available and always behaves consistently. DateTime::createFromFormat() is another alternative that creates a DateTime object instead. IntlDateFormatter::parse() is available as a more sophisticated, localization-aware alternative. https://www.php.net/manual/en/function.date-parse-from-format.php I’m not skilled 🎯 as you are but date-parse-from-format seems more like what we use in Tiki (easier to adapt ?) B PS: I guess the answer to the initial question is then “no way to translate it as it is”… Unless doing a massive pregnancy/replace (mono lingual) ;-) > On 20 Sep 2021, at 13:15, Jonny Bradley via TikiWiki-devel <[email protected]> wrote: > > Hi Bernard > > You are correct, it uses the plain date function, and the recommendation is to use setlocale and strftime instead. > > However, strftime is scheduled to be deprecated in php 8.1 > > https://wiki.php.net/rfc/deprecations_php_8_1#strftime_and_gmstrftime > > and apparently we should use this now: > > https://www.php.net/manual/en/intldateformatter.format.php > > I expect this will be the case in numerous places in Tiki, and i think we'll need a new pref to pick the locale... > > Any better ideas? > > jb > > > > >> On 20 Sep 2021, at 10:31, Bernard Sfez via TikiWiki-devel <[email protected]> wrote: >> >> Hello, >> >> I post this in the list because it look to me something more related to the developers knowledge than power users. >> >> >> In a tracker I use a item calculation field to extract the month from another (complete date) field. >> (date (str F) paymentsDate) >> >> It will output “September” and unlike other fields it won’t be changed considering the language of the Tiki. >> >> How can I made this multilingual ? >> >> Is the function using https://www.php.net/manual/en/function.date.php (not good for multilingual) ? >> To format dates in other languages, you should use the setlocale() and strftime() functions instead of date(). >> >> But may be not because in many places I see dates properly translated. >> >> Does anyone see a clever way to have this translated ? >> >> Bernard >> >> >> _______________________________________________ >> 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