Req #76123 [NEW]: Implement Month Genitive and Nominative Names in date format functions

From: Date: Wed, 21 Mar 2018 07:51:21 +0000
Subject: Req #76123 [NEW]: Implement Month Genitive and Nominative Names in date format functions
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-214424@lists.php.net to get a copy of this message
From: murznn at gmail dot com Operating system: PHP version: Next Major Version Package: Date/time related Bug Type: Feature/Change Request Bug description:Implement Month Genitive and Nominative Names in date format functions Description: ------------ Some languages have 2 cases of month names - genitive and nominative. Eg in Russian - January have 2 cases - 'Январь' and 'января', depended on month place in string. '1 January' in Russian must be translated as '1 января' 'January, 1' in Russian must be translated as 'Январь, 1' But PHP date function have only one case for month name - 'F', that translates to nominative case, and there are no way to translate in genitive case. There are many workarounds for this problem via custom scripts, also this already implemented in some systems, eq in Russian PHP CMS Bitrix: https://dev.1c-bitrix.ru/api_help/main/functions/date/formatdate.php added 'f' symbol that return month in genitive case. On some other languages, eg C# - this feature is implemented: https://msdn.microsoft.com/en-us/library/system.globalization.datetimeformatinfo.monthgenitivenames.aspx Because function date() not use locale, my suggestion is to add new symbol to PHP strtotime() and DateTime::format functions, that will return month name in genitive case with no capital letter. For example, this can be '%L' symbol, that return localized month name in genitive case. Or maybe community can provide some better solutions for this problem in PHP core. P.S. Description of problem in Russian language: Правильное склонение месяца в датах через PHP функции strtotime() и DateTime::format в именительном и родительном падежах на русском языке. Test script: --------------- <?php setlocale(LC_TIME, 'ru_RU.UTF-8'); echo strftime('%B %L', strtotime('2000-01-01')); ?> Expected result: ---------------- Январь января Actual result: -------------- Январь %L -- Edit bug report at https://bugs.php.net/bug.php?id=76123&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76123&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76123&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76123&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=76123&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=76123&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=76123&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=76123&r=needscript Try newer version: https://bugs.php.net/fix.php?id=76123&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=76123&r=support Expected behavior: https://bugs.php.net/fix.php?id=76123&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=76123&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=76123&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=76123&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76123&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=76123&r=dst IIS Stability: https://bugs.php.net/fix.php?id=76123&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=76123&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=76123&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=76123&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=76123&r=mysqlcfg

« previous php.bugs (#214424) next »