How To Russify Delphi

Table of contents:

How To Russify Delphi
How To Russify Delphi

Video: How To Russify Delphi

Video: How To Russify Delphi
Video: Delphi мертв? 2024, May
Anonim

Russification of programs is an important matter, especially for users who do not speak foreign languages. Quite often, Delphi program users wonder how to Russify it.

How to russify delphi
How to russify delphi

Instructions

Step 1

The point is that the OEM and ANSI encodings (in which Delphi works) do not match. They have different positions of Cyrillic symbols. ANSI also has accented characters, which OEM does not. But the second contains pseudo-graphic symbols, which are indispensable for displaying tables, although this is not very much in demand. And yet it is worth noting that, in general, these tables are interchangeable - they have the same possibilities for displaying text information.

Step 2

There are several ways to solve the problem of Russification. The first is working in the OEM editor. You can initially prepare parts of the program text that are critical to the code table in an editor that works in the OEM encoding. Quite a simple, but at the same time effective solution. This is especially true for writing local utilities, in which the output of information, nevertheless, is highly demanded.

Step 3

As for the shortcomings of this method, here you can designate work outside of the IDE, which is familiar to many, with its bells and whistles that are great in life, such as: coding, compilation, debugging. And all this is said, "in one bottle." In addition, as the project grows, certain difficulties begin to appear when third-party strings created using ANSI encoding begin to be used.

Step 4

If the project does not contain strings directly included in the code (hard-coded), you can move all the string resources into separate modules, then localizing them to the encoding that is required. Fortunately, the network is full of utilities that change the encoding of files.

Step 5

Now about the use of filtering procedures. The Windows API contains functions to help you convert ANSI and OEM encodings to one another. These are OemToChar and CharToOem. They are used when displaying text with replacement of fragments Writeln (‘text '); into the following fragments:

procedure MyWriteln (const S: string);

var

NewStr: string;

begin

SetLengtn (NewStr, Length (S));

CharToOem (PChar (S), PChar (NewStr));

Writeln (NewStr);

end;

MyWriteln (‘text ');

Step 6

As for the disadvantages of this method, this is the inability to use the extended Write syntax and cluttering the application text with a call to filter procedures. When you need to Russify a finished application with multiple calls to Write, this becomes a serious problem.

Step 7

Last but not least, change the console code page using the Windows API. This method is documented, by the way. The only catch is that the feature doesn't work in Windows 95 and 98. Although if the application will run exclusively on Windows NT, in this case, you can use the SetConsoleOutputCP (866) function.

Recommended: