Ricardo Acras
Ricardo Acras

Reputation: 36254

Configures locale not being considered

My software relies in the windows locale configuration to work properly.

My customers have always the pt-br locale setted up and it works fine that way.

In one user´s windows there is the pt-br locale setted properly but somehow my software gets all the us configurations. (. as decimal sepparator, $ as currency symbol and so on).

Is there any way for me to force the locale globally in my software?

Upvotes: 3

Views: 1563

Answers (3)

Daniele
Daniele

Reputation: 25

Having the same problem I found your post.

I also found this thread (http://social.technet.microsoft.com/Forums/en-US/w7itprogeneral/thread/b4f90f07-206c-494b-8d14-ee17bfa689e0) that helped me.

Here's the method:

If you open "Regional and Language Options" from the control panel (the globe icon) / intl.cpl, and reselect your locale it will likely solve the problem.

1) Open Regional and Language Options

2) Under "Format" pick anything else. (eg: English (United States)).

3) Press "Apply"

4) Under "Format" pick your desired locale (eg: English (United Kingdom)).

5) Press OK.

Upvotes: 1

Arnaud Bouchez
Arnaud Bouchez

Reputation: 43053

Under Windows Seven, the locale of non Unicode apps (like Delphi 7) is not set in the main tab of the Control Panel.

You will have to go to "Administrative" tab, then select "Change system locale".

enter image description here

See this article.

Upvotes: 0

LU RD
LU RD

Reputation: 34947

Since you have delphi-7 you can do as follows:

Application.UpdateFormatSettings := false;

This prevents the system to update your application with windows default values.

Then define at application startup:

DecimalSeparator := '.'; // Or whatever preference you have
CurrencyString := '$'; // Or something else
... 
etc

In Delphi 2006 and higher this method is deprecated and the use of TFormatSettings is prefered. It also deals with reentrancy problems if parts of the applications needs to change the format settings during execution.

Upvotes: 1

Related Questions