{"action":"created","issue":{"url":"https://api.github.com/repos/phpmyadmin/phpmyadmin/issues/11993","repository_url":"https://api.github.com/repos/phpmyadmin/phpmyadmin","labels_url":"https://api.github.com/repos/phpmyadmin/phpmyadmin/issues/11993/labels{/name}","comments_url":"https://api.github.com/repos/phpmyadmin/phpmyadmin/issues/11993/comments","events_url":"https://api.github.com/repos/phpmyadmin/phpmyadmin/issues/11993/events","html_url":"https://github.com/phpmyadmin/phpmyadmin/issues/11993","id":134905233,"number":11993,"title":"Implement gettext expression evaluator","user":{"login":"nijel","id":212189,"avatar_url":"https://avatars.githubusercontent.com/u/212189?v=3","gravatar_id":"","url":"https://api.github.com/users/nijel","html_url":"https://github.com/nijel","followers_url":"https://api.github.com/users/nijel/followers","following_url":"https://api.github.com/users/nijel/following{/other_user}","gists_url":"https://api.github.com/users/nijel/gists{/gist_id}","starred_url":"https://api.github.com/users/nijel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nijel/subscriptions","organizations_url":"https://api.github.com/users/nijel/orgs","repos_url":"https://api.github.com/users/nijel/repos","events_url":"https://api.github.com/users/nijel/events{/privacy}","received_events_url":"https://api.github.com/users/nijel/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/phpmyadmin/phpmyadmin/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/phpmyadmin/phpmyadmin/labels/newbie","name":"newbie","color":"0052cc"}],"state":"closed","locked":false,"assignee":{"login":"nijel","id":212189,"avatar_url":"https://avatars.githubusercontent.com/u/212189?v=3","gravatar_id":"","url":"https://api.github.com/users/nijel","html_url":"https://github.com/nijel","followers_url":"https://api.github.com/users/nijel/followers","following_url":"https://api.github.com/users/nijel/following{/other_user}","gists_url":"https://api.github.com/users/nijel/gists{/gist_id}","starred_url":"https://api.github.com/users/nijel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nijel/subscriptions","organizations_url":"https://api.github.com/users/nijel/orgs","repos_url":"https://api.github.com/users/nijel/repos","events_url":"https://api.github.com/users/nijel/events{/privacy}","received_events_url":"https://api.github.com/users/nijel/received_events","type":"User","site_admin":false},"assignees":[{"login":"nijel","id":212189,"avatar_url":"https://avatars.githubusercontent.com/u/212189?v=3","gravatar_id":"","url":"https://api.github.com/users/nijel","html_url":"https://github.com/nijel","followers_url":"https://api.github.com/users/nijel/followers","following_url":"https://api.github.com/users/nijel/following{/other_user}","gists_url":"https://api.github.com/users/nijel/gists{/gist_id}","starred_url":"https://api.github.com/users/nijel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nijel/subscriptions","organizations_url":"https://api.github.com/users/nijel/orgs","repos_url":"https://api.github.com/users/nijel/repos","events_url":"https://api.github.com/users/nijel/events{/privacy}","received_events_url":"https://api.github.com/users/nijel/received_events","type":"User","site_admin":false}],"milestone":null,"comments":25,"created_at":"2016-02-19T16:18:52Z","updated_at":"2016-10-12T15:45:29Z","closed_at":"2016-07-29T12:04:27Z","body":"For gettext we need something what is able to evaluate it's plural expressions and not use ``eval()`` (see #6363), unfortunately I was not able to find single arithmetic expression evaluation library for PHP which supports ternary operator, but they tend to support dozen of other stuff we don't need like functions. Therefore I think it will be better to implement own code for this particular use case. The final goal is to remove [eval usage in gettext library](https://github.com/phpmyadmin/phpmyadmin/blob/master/libraries/php-gettext/gettext.php#L361).\r\n\r\nExample expression we need to evaluate for any arbitrary value of ``n``: ``n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 ? 4 : 5 ``\r\n\r\nThe syntax is quite limited:\r\n\r\n- ``n`` variable\r\n- ternary operator ``? :``\r\n- comparisons ``==`` ``<`` ``>`` ``<=`` ``=>`` ``!=``\r\n- division and modulo ``/`` ``%``\r\n- numbers\r\n\r\nPS: More plural examples can be found in the [Localization Guide](http://localization-guide.readthedocs.org/en/latest/l10n/pluralforms.html)."},"comment":{"url":"https://api.github.com/repos/phpmyadmin/phpmyadmin/issues/comments/253252179","html_url":"https://github.com/phpmyadmin/phpmyadmin/issues/11993#issuecomment-253252179","issue_url":"https://api.github.com/repos/phpmyadmin/phpmyadmin/issues/11993","id":253252179,"user":{"login":"ibennetch","id":1443710,"avatar_url":"https://avatars.githubusercontent.com/u/1443710?v=3","gravatar_id":"","url":"https://api.github.com/users/ibennetch","html_url":"https://github.com/ibennetch","followers_url":"https://api.github.com/users/ibennetch/followers","following_url":"https://api.github.com/users/ibennetch/following{/other_user}","gists_url":"https://api.github.com/users/ibennetch/gists{/gist_id}","starred_url":"https://api.github.com/users/ibennetch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ibennetch/subscriptions","organizations_url":"https://api.github.com/users/ibennetch/orgs","repos_url":"https://api.github.com/users/ibennetch/repos","events_url":"https://api.github.com/users/ibennetch/events{/privacy}","received_events_url":"https://api.github.com/users/ibennetch/received_events","type":"User","site_admin":false},"created_at":"2016-10-12T15:45:29Z","updated_at":"2016-10-12T15:45:29Z","body":"Nice work @nijel!"}}
{"actor":{"display_login":"ibennetch"}}