CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • $config->monetaryDecimalPoint empty - causes incorrect localization
Pages: [1]

Author Topic: $config->monetaryDecimalPoint empty - causes incorrect localization  (Read 1641 times)

jords

  • I’m new here
  • *
  • Posts: 15
  • Karma: 1
$config->monetaryDecimalPoint empty - causes incorrect localization
December 16, 2009, 06:55:11 pm
Hi,

I am experiencing an issue with the event signup screens - the calculated total value displays without a decimal point. An example is: http://dev.act.org.nz/civicrm/event/register?id=3&reset=1

I have tracked down the problem to be that the separator variable is being set to {$config->monetaryDecimalPoint} in templates/CRM/Event/Form/CalculatePriceset.tpl, but it seems this value is empty.

I have tried changing my monetary locale, originally I had only the en_NZ locale installed on my server (Debian Lenny) but I have now installed en_US and en_GB, this did not make a difference. So I installed the civicrm localizations pack and switched my monetary locale to en_GB, this also did not make a difference.

So, I am confused here. I know I can override the template file with a custom template, but it seems like a pretty bad way of solving this issue. Some other people have reported similar things, but I thought i would post a new topic because I have tracked down the issue more.

Thanks
Jordan

jords

  • I’m new here
  • *
  • Posts: 15
  • Karma: 1
Re: $config->monetaryDecimalPoint empty - causes incorrect localization
December 17, 2009, 08:00:23 am
After much tracking, it turns out the root cause is that you need the php-gettext package installed to provide localization support in php. For some reason, it's not installed by default.

However, civicrm should really check to see if the call to setlocale has failed, so I will submit a patch to improve this

Piotr Szotkowski

  • I live on this forum
  • *****
  • Posts: 1497
  • Karma: 57
Re: $config->monetaryDecimalPoint empty - causes incorrect localization
December 18, 2009, 08:12:15 am
Quote from: jords on December 17, 2009, 08:00:23 am
After much tracking, it turns out the root cause is that you need the php-gettext package installed to provide localization support in php. For some reason, it's not installed by default.

Note that we ship it in packages/PHPgettext, and CiviCRM should use it by default from there. Can you check why it’s not used in your case?

Quote
However, civicrm should really check to see if the call to setlocale has failed, so I will submit a patch to improve this

Ok, if we don’t sanely handle the lack of PHP’s gettext support (as opposed to the PHPgettext package…) then it’s a bug (in much the same way as not handling the lack of mb_strings sanely).

I’ll reopen the bug and will try to figure out how to make it sane, hopefully without throwing a fatal error that most users (e.g., on shared hosting) are unable to fix anyway.
If you found the above helpful, please consider helping us in return – you can even steer CiviCRM’s future and help us extend CiviCRM in ways useful to you.

jords

  • I’m new here
  • *
  • Posts: 15
  • Karma: 1
Re: $config->monetaryDecimalPoint empty - causes incorrect localization
December 18, 2009, 09:40:55 pm
I cannot, despite many tries, get my server back into the state where this was failing.  ::) I'm pretty sure it was installing the php-gettext package that fixed it, but uninstalling it makes no difference and it looks like it only actually installs some stuff in docs! So, maybe this should be chalked up to quantum fluctuations until somebody can actually work out what causes it to go wrong sometimes (there are a few other threads on here with people having the same issue, in it's manifestation of not having the decimal point on calculations for event register screens).

I did write a little standalone script that just sets the locale and prints the result of localeconv(), it was getting weird results with blank mon_decimal_point (but not blank decimal_point), and that was fixed too at the same time and I also cannot unfix it. So I suspect this is more weirdness at the php/gettext level than  civicrm. However, I still think we should have a warning message print out if setlocale() fails, (and maybe also set some good defaults manually) just to let users know so they can at least try to fix it.


The much confused Jordan

Piotr Szotkowski

  • I live on this forum
  • *****
  • Posts: 1497
  • Karma: 57
Re: $config->monetaryDecimalPoint empty - causes incorrect localization
December 21, 2009, 07:58:05 am
Jordan, thanks a lot for your attempts to track this down. Neither PHP’s gettext support, nor the PHPgettext library (which, confusingly, is something different than PHP’s gettext module), nor PHP’s setlocale() calls are easy to work with, so I do feel your pain and confusion.

I’ll see what I can do to make this both fail-back sanely and notify the user that there’s possibly something missing in their setup.
If you found the above helpful, please consider helping us in return – you can even steer CiviCRM’s future and help us extend CiviCRM in ways useful to you.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • $config->monetaryDecimalPoint empty - causes incorrect localization

This forum was archived on 2017-11-26.