Timetrex & decimal places

General support regarding TimeTrex, such as
configuring policies/taxes or processing payroll.
Locked
reloded
Posts: 52
Joined: Mon Aug 13, 2007 10:24 pm

Timetrex & decimal places

Post by reloded »

Hi, I had asked how to enable decimal places in my pay stubs and this is what you had said. (it was in an unrelated thread so I thought I bring it here to make it easy to find)
Not seeing decimal places on the pay stubs is caused by your locale number format settings, usually in your operating system. The most common issue is the locale can't be found in your operating system. In your TimeTrex.ini.php file, set the following debug settings:

enable = TRUE
enable_display = TRUE
buffer_output = TRUE
enable_log = TRUE
verbosity = 10

This will display debug information at the bottom of each page, look for lines like this:

Code:

DEBUG [329]: TTi18n::chooseBestLocale(): Choosing Best Locale...
DEBUG [346]: TTi18n::chooseBestLocale(): Using Language from cookie: en_US
DEBUG [250]: TTi18n::setLocale(): Attempting to set Locale to: en_US Category: 6 Current Locale:
DEBUG [253]: TTi18n::setLocale(): Attempting to set Locale to: en_US
DEBUG [267]: TTi18n::setLocale(): Setting translator normalized locale to: en_US
DEBUG [285]: TTi18n::setLocale(): Set Locale To: en_US
DEBUG [391]: TTi18n::chooseBestLocale(): Using Locale: en_US


What does it say on your system?

So, I did that and this is what my system says:
DEBUG [235]: TTi18n::getLanguageFromLocale(): Locale: en_US
DEBUG [108]: [Function](): User Preference Language matches cookie!
DEBUG [270]: TTi18n::setLocale(): Attempting to set Locale to: en_KE Category: 6 Current Locale:
DEBUG [273]: TTi18n::setLocale(): Attempting to set Locale to: en_KE
DEBUG [275]: TTi18n::setLocale(): Failed setting i18n locale: en_KE
DEBUG [287]: TTi18n::setLocale(): Setting translator normalized locale to: en_US
DEBUG [305]: TTi18n::setLocale(): Set Locale To: en_KE
Am using Ubuntu 7.04.

Thanks
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Post by shaunw »

We may have a fix available for this in v2.1.0-rc4, which we hope to release within a week.

Please give it a try and let us know then.
reloded
Posts: 52
Joined: Mon Aug 13, 2007 10:24 pm

Post by reloded »

Sure. Will do. :D
reloded
Posts: 52
Joined: Mon Aug 13, 2007 10:24 pm

Post by reloded »

Hi.
I downloaded version v2.1.0-rc4 and installed it. However, I still can't get decimal places.
Is there something extra am meant to do after installing v2.1.0-rc4 so as to be able to view decimal places?

Thanks
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Post by shaunw »

Can you post the setLocale debug information from RC4 again please.
reloded
Posts: 52
Joined: Mon Aug 13, 2007 10:24 pm

Post by reloded »

Hi.

Here is the output.

Code: Select all

DEBUG [100]: [Function](): Locale Cookie: en_US
DEBUG [235]: TTi18n::getLanguageFromLocale(): Locale: en_US
DEBUG [108]: [Function](): User Preference Language matches cookie!
DEBUG [270]: TTi18n::setLocale(): Attempting to set Locale to: en_KE Category: 6 Current Locale:
DEBUG [273]: TTi18n::setLocale(): Attempting to set Locale to: en_KE
DEBUG [275]: TTi18n::setLocale(): Failed setting i18n locale: en_KE
DEBUG [279]: TTi18n::setLocale(): Failed setting normalized i18n locale: en_KE
DEBUG [291]: TTi18n::setLocale(): Setting translator normalized locale to: en_US
DEBUG [309]: TTi18n::setLocale(): Set Locale To: en_KE
Thanks.
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Post by shaunw »

Unfortunatley Ubuntu is difficult when it comes to locales.

Until we can figure out a proper way to support Ubuntu automatically, I think you are going to have to find the directory where your locales are stored (often: /usr/share/locale) and symlink:

en_US -> en_US.UTF8

I'm assuming that the en_US directory doesn't exist at all, and the en_US.UTF8 does. This is where the problem is, TimeTrex is looking for the "en_US" locale, but Ubuntu only has the "en_US.UTF8" locale. So the symlink should fix the issue hopefully.
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Post by shaunw »

You might want to take a look at this post for more information as well:

http://forums.timetrex.com/viewtopic.php?p=2671#2671
reloded
Posts: 52
Joined: Mon Aug 13, 2007 10:24 pm

Post by reloded »

Thanks for that reference. But even before I tried that -which I will look into later-, I did some do or die Googling and I came across this: http://ubuntuforums.org/showthread.php?t=75493

I executed this step:
If you're having this problem on dapper/edgy, you may have to regen the locales using "locale-gen <localename>" where localename is the name of the locale you want to regenerate (e.g. "en_US.UTF-8"), then "dpkg-reconfigure locales".
After that the setlocale() error had disappeared and on generating a pay stub, I got my Decimals!:D

I had gotten similar threads but I don't know why this one worked. Maybe its coz you specify the actual locale instead of just doing a "locale-gen". How concrete this is I wish an expert would tell me so that am assured that come next time I'll be able to solve the locale issue the same way.
For now, if it ain't broken, why fix it! :!:
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Post by shaunw »

Sounds like an excellent work-around until we can offer something in TimeTrex itself.

Thanks for the update.
reloded
Posts: 52
Joined: Mon Aug 13, 2007 10:24 pm

Post by reloded »

Hi, aaah, am back with the locale issue. Have you found a "permanent" solution yet?
I had sorted it out on one timetrex installation. I now have another installation and am at the point where I want to display my decimals. And its clearly a locale issue.
The error I get is the same as the one specified at the beginning of this thread:

Code: Select all

DEBUG [270]: TTi18n::setLocale(): Attempting to set Locale to: en_KE Category: 6 Current Locale:
DEBUG [273]: TTi18n::setLocale(): Attempting to set Locale to: en_KE
DEBUG [275]: TTi18n::setLocale(): Failed setting i18n locale: en_KE
DEBUG [279]: TTi18n::setLocale(): Failed setting normalized i18n locale: en_US
DEBUG [291]: TTi18n::setLocale(): Setting translator normalized locale to: en_US
DEBUG [309]: TTi18n::setLocale(): Set Locale To: en_KE
However, my work around above seems not to work for now! So, help!!!
How/where do I do what this other thread had suggested:
http://forums.timetrex.com/viewtopic.php?p=2671#2671
I then digged into the php source where I found a comment!
//setlocale fails on ubuntu if UTF-8 is not specified
I uncommented the '.UTF-8' part and it....works!
Where do I change this?

Thanks.
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Post by shaunw »

Do a search for: UTF-8 in classes/modules/core/TTi18n.class.php

You'll find several lines similar to this one:

Code: Select all

$locale = self::getLanguage().'_'.self::getCountry(); // . '.UTF-8';
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Post by shaunw »

It appears that in Ubuntu you have to manually generate locales, try running this command:
sudo locale-gen <locale here>
for example, if you want Spanish:
sudo locale-gen es_ES
for example, if you want German:
sudo locale-gen de_DE
In your case, with the current version of TimeTrex you may have to run:
sudo locale-gen en_KE
reloded
Posts: 52
Joined: Mon Aug 13, 2007 10:24 pm

Post by reloded »

Congratulations. I noticed that you'd released V2.1.1 five days ago. I downloaded it and installed it.
It just so happened that at the same time I decided to test Ubuntu 7.10 (gutsy) server.
So I installed my Gutsy and then my Timetrex. And out of the box without any extra configuration, the decimal places were working!
So, is it that you guys fixed the decimal issue or was it the new Ubuntu release that did so?
I haven't installed again to confirm but as soon as I get the time I will just to make sure its no fluke.

PS: Where do we get to know the features of a new Timetrex release?
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Post by shaunw »

v2.1.1 had some fixes for Ubuntu, but in some cases you still need to run locale-gen, the Ubuntu installer probably does it for some locales out of the box though.

v2.1.1 doesn't have any new features (just fixes), but all new features are listed under Help -> Whats New. You can see more information in our release notes when you download TimeTrex from SourceForge.
Locked