0

I need to modify an existing application in order to have multilanguage support. This means that with the same database(Firebird) in an english version, my client want to sale the application in China.

Application was written in Delphi 7, and the components used to access the database are from the FibPlus suite.

Starting from this question, from my knowledge, using .AsDate, .AsDateTime, etc routines are converting the data from the database using the locale settings from the system. It means that I will display data to final user, by using current format setting, correct?

When saving data in the database, database connector should save correct(using current format settings) the data in the database. Or, I'm wrong?

So, basically my question is: how should I manage DateTime, Thousands, Decimal, etc separators in order to display to the final user/save correct the data from/into the database ?

Community
  • 1
  • 1
RBA
  • 12,337
  • 16
  • 79
  • 126

3 Answers3

2

AsDateTime etc. don't convert using the regional settings, because they do not convert at all. As far as your application should be concerned, the database reads and writes TDateTime values, not strings. As long as you don't convert TDateTime values to/from strings, there is no problem. The standard edit controls will display them using the end user's regional settings. Only if you do perform the conversion yourself do you need to look at FormatSettings.

-1

You'd think about text data types in the database and in the connection string of FibPlus. So that non-English letters would be allowed to be correctly stored/retrieved. Especialy if later non-Delphi programs would need such a database.

Arioch 'The
  • 15,799
  • 35
  • 62
  • I don't understand what you are talking about. Can you explain? – RBA Jul 23 '12 at 15:52
  • which character would be byte #230 ? it might be european letter "æ", or european letter "ć", or russian letter "ж", or greek letter "ζ", or hebrew letter "ז", etc So if the database contain byte #230 - which letter it would be ? If server sends to FIBPlus byte #230 - which letter it should be ? If FIBPlus sends to your Delphi program that byte - which letter it should be ? Sorting needs alphabet, changing small letters to capital needs it. If you do not specify that for database (for storing and sorting texts) and for connection (for transfering texts) sooner or later would be an error. – Arioch 'The Jul 25 '12 at 07:25
  • with different standards to specify it, it might be called "charset" or "codepage" or "encoding". Without specifying it it would work for a while in "as is" binary mode. But with any environment changes that might fail. For example you adding Java program to work with database. Or you move database to Linux server. Or you move your Delphi program to MacOS, etc. Suddenly there are different local ideas what #230 means. Or your client has a problem that you just cannot reproduce, because your system has slightly different expectations than his - as above with two different European letters #230 – Arioch 'The Jul 25 '12 at 07:31
-1

It depends on what format is used to store date/time values in the database. If you need to convert date/time into string before saving you should select one internal format in which those values will be saved. In our applications we prefere something like "yyyy-MM-dd hh:mm:ss" because this format eliminates any ambiguity. Additionally I would suggest to adjust all date/time values into one time zone (e.g. GMT) before saving into DB and then modify them back before showing to the users.

Sergiy
  • 1,912
  • 2
  • 16
  • 25