Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow negative numbers being passed to transChoice #85

Closed
wants to merge 2 commits into from

Conversation

Projects
None yet
2 participants
@wodCZ
Copy link
Contributor

commented Aug 26, 2015

No description provided.

@@ -143,7 +143,7 @@ public function translate($message, $count = NULL, $parameters = array(), $domai
$parameters = $tmp;
if ($count !== NULL && is_scalar($count)) {
return $this->transChoice($message, preg_replace('~[^0-9,.]~', '', $count), $parameters + array('%count%' => $count), $domain, $locale);
return $this->transChoice($message, preg_replace('~[^0-9,.\-]~', '', $count), $parameters + array('%count%' => $count), $domain, $locale);

This comment has been minimized.

Copy link
@fprochazka

fprochazka Aug 26, 2015

Member

Wouldn't it be better to allow the - only on the beginning?

This comment has been minimized.

Copy link
@wodCZ

wodCZ Aug 27, 2015

Author Contributor

I'm not sure why is this needed anyway. The only next usage is here, casting value to integer and thanks to previous line in this file we can be sure that typecasting will never fail.
To be honest, this was only hotfix so I could continue in work, so I did not think about this very much :)

So:

  • if this is not needed, should I update PR with preg_replace removed?
  • if this is needed, would you please point me why & how to update PR to make this OK?

Thank you for your time!

This comment has been minimized.

Copy link
@fprochazka

fprochazka Aug 27, 2015

Member

I see! I overlooked that. I don't really remember why was the preg_replace needed. It can probably be removed.

@fprochazka

This comment has been minimized.

Copy link
Member

commented Aug 28, 2015

Thank you!

@wodCZ

This comment has been minimized.

Copy link
Contributor Author

commented Aug 28, 2015

Thank You for merge!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.