Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "Прочее";
Текущий архив: 2006.11.12;
Скачать: [xml.tar.bz2];

Вниз

brc32.exe + Unicode не понимают друг друга?   Найти похожие ветки 

 
Layner ©   (2006-10-20 14:44) [0]

Здравствуйте! Создал файл на латышском, сохранил в Unicode, файл в *.RC, хочу прогнать в brc32.exe, brc32.exe - ругается "Fatal error Expecting resource name or resource type name"


 
Elen ©   (2006-10-20 14:48) [1]


> хочу прогнать

Не прогоняй его, он хороший. :)
"Fatal error Expecting resource name or resource type name" - Фатальная ошибка, Ожидающая имя ресурса или имя типа ресурса". Делфа питается аглицким, а остальные только уважает .


 
Layner ©   (2006-10-20 14:52) [2]

:)
А как в таком случае поступают с др. языками, кроме как русского и английского? Мне надо показать несколько фраз на латышском (немецком, испанском..) с их нац. закорючками, и если этот текст я могу сохранить ТОЛЬКО в Unicode, но Unicode не могу скомпилировать в ресурс, в дальнейшем бы его подгружал, как быть?


 
Игорь Шевченко ©   (2006-10-20 14:55) [3]


>  Делфа питается аглицким, а остальные только уважает .


Переведи на нормальный язык и объясни, какое отношение твоя фраза имеет к brcc32


 
Alien1769 ©   (2006-10-20 14:55) [4]

А шо ASCII коды уже не работают ?


 
Elen ©   (2006-10-20 14:57) [5]


> Layner

Пиши на английском. Если скомпилиться правильно - пробуй потихоньку переводить в Юникод. Если нет иши ошибку в названии ресурса. Может он не совпадает с тем что в проге прописано


 
Игорь Шевченко ©   (2006-10-20 14:57) [6]

Layner ©   (20.10.06 14:52) [2]

Для китайского например так:
#include "..\language.rh"

STRINGTABLE
{
 SFileMenuCaption L"\x65B0\x95FB"
 SHelpMenuCaption "&?"
 SExitCaption     L"\x6C7D\x8F66"
 SAboutCaption    L"\x4F53\x80B2\x8DB3\x7403\x8D22\x7ECF\x8BC1\x5238"
}


 
Elen ©   (2006-10-20 15:01) [7]


> Игорь Шевченко

Создал файл на латышском, сохранил в Unicode, файл в *.RC - думается мне не ресурс а сам RC автор перевел в Unicode. Так?


 
Layner ©   (2006-10-20 15:08) [8]

Игорь Шевченко ©   (20.10.06 14:57)
Игорь, понятно немного, т.е. получается, я переведу все диалоги на  латышский, далее прогоняю текст с помощью функции (которую не нашел ещё, но поищу) тескт по символьно, и у каждого символа получаю типа такого кода x8DB3, сохраняю в RC, компилирую. И затем все должно прекрасно показатся на Caption, Title, Text...?

Если Да, то загрузить мой файл можно в TRichEdit?
Пришел... В TRichEdit не могу свой файл загрузить. Вопрос, я не могу свой файл в Unicode теперь нигде открыть в Delphi? Как тогда его по "символьно переделать"?


 
Игорь Шевченко ©   (2006-10-20 15:11) [9]

Layner ©   (20.10.06 15:08) [8]

Давай тогда определимся, что ты хочешь сделать. Для того, чтобы Delphi отображала Unicode, нужно использовать компоненты, которые отображают Unicode, например, TNTControls.

Это первое.

Текст для этих компонент можно загружать из ресурсов.

Это второе.


 
Плохиш ©   (2006-10-20 15:12) [10]


> Layner ©   (20.10.06 15:08) [8]


> Если Да, то загрузить мой файл можно в TRichEdit?

Нет, VCL не поддерживает юникод.


 
Layner ©   (2006-10-20 15:31) [11]

Ага, тогда так:
1. Я загружаю в TNTControls (тоже вышел на них по поиску) свой файл
2. Преобразовываю латышский в типа: "x80B2\x8DB3\x7403\x8D22\x7ECF\x8BC1\x5238...."
3. А далее как обычно.

Правильно ли это будет выглядеть?

И второй вопрос, из ресурса когда загружу строку отправленную туда под видом
1, L"\x4F53\x80B2\x8DB3\x7403\x8D22\x7ECF\x8BC1\x5238"
Она нормально значит покажется на форме, китайскими иероглифами в данном примере, не квадратиками т.е., и не кодом как тут?

У меня такая картина: есть 5..6 форм, на каждой форме до 50 элементов, у почти каждого элемента есть Caption(Title/Text..)+Hint, компоненты стандартные + DBGridEh, с русским и английским проблем по переходу нет, а вот на другие вызывает большие трудности. Transl.Tools из Delphi наверное уже не поможет, т.к. все диалоги сохранены в текстовый файл(ini), и хотелось бы этот файл только переводить. Сейчас на ресурсы переключился по понятным причинам, эти INI - русский и анг. перегоню в RC, не проблема, и его подключу к программе. Задача др. языки подключать..


 
Игорь Шевченко ©   (2006-10-20 15:36) [12]

Layner ©   (20.10.06 15:31) [11]

SomeTNTControl.Caption := LoadStringW(ResID, ....)

Я так делал


 
Layner ©   (2006-10-20 15:44) [13]

Игорь, у тебя (если можно я на ты :) ) значит получается все компоненты формы от TNTControls ?


 
Игорь Шевченко ©   (2006-10-20 16:13) [14]

Layner ©   (20.10.06 15:44) [13]


> если можно я на ты :)


Да, конечно.


>  значит получается все компоненты формы от TNTControls ?


Конечно. Иначе не получится работать с Unicode.


 
Anatoly Podgoretsky ©   (2006-10-20 16:35) [15]


> Переведи на нормальный язык и объясни, какое отношение твоя
> фраза имеет к brcc32

Он вообщето про brc32, а это Микрософтовский компилятор ресурсов, который прекрасно понимает Юникод.


 
Anatoly Podgoretsky ©   (2006-10-20 16:38) [16]

Layner ©   (20.10.06 15:44) [13]
Конечно он тоже не порядок, но все таки почти вся базовая функциональность в нем реализовано.
Я использую в своих программах, нужно только быть внимательным и хорошо тестировать, на разных локализациях.
А у меня ситуация такая же, я твой сосед.


 
Игорь Шевченко ©   (2006-10-20 16:47) [17]

Anatoly Podgoretsky ©   (20.10.06 16:35) [15]

Я извиняюсь, но
> Микрософтовский компилятор ресурсов
называется rc.exe


 
Layner ©   (2006-10-23 07:45) [18]

Анатолий, здравствуй! Я только к сожалению не твой сосед, живу на той же широте, только в России :) Попросили добавить язык, не знал что сложно так может оказаться (может только по началу?).
Нашел тут интересную статью, про мультиязычное приложенее, ссылка тут: http://www.delphi3000.com/articles/article_4594.asp?SK=
но там надо сначала зарегистрироваться на их сайте что бы посмотреть статью. С разрешения модераторов вставлю статью тут, сл. постом, а если они сочтут нужным, то можно и удалить. Вопрос по статье, как он компилирует в ресурс юникод?


 
Layner ©   (2006-10-23 07:49) [19]

Question/Problem/Abstract:
For many projects you need to localize your application. An easy solution will be given without license or special tools needed. Just a small component and one straight resource file.

Answer:
I know there"s a lot of solutions to localize, but this one...
Let"s start with the advantages:

1. Separation of strings from the form at design time
2. All languages linked in one executable at runtime (if necessary)
3. Lesser overhead for forms and easy to understand
4. Language change at runtime possible
5. No licence or additional tool needed
6. Runs on all Delphi versions
7. Whole translator engine in one unit (component)
8. Fast and easy to deploy
9. Easy change management of the Stringtable (just edit and compile)
10. Multiple use of one string to many controls possible
11. Extensible to any string or control
12. Event OnLanguagChanged() implemented
13. Resource DLL at runtime

The most obvious task in localizing an application is translating the strings that appear in the user interface from a form, a component or a database. To create an application that can be translated without altering code everywhere, the strings in the user interface should be isolated into a single module or file.
In our case we put all the strings in one resource file called *.rc

This resource file will be compiled with
D:\Programme\Borland\Delphi7\Bin\brc32.exe -r filename.RC

or straight forward in delphi project main form with the following compiler directive

{$R "filenameSTR.res" "filenameSTR.RC"}

so you don"t need a resource batch or the resource compiler! (just in case of problems you get more error logs)

At start- or at runtime we call

 objMultilang:= TMultiLangSC.Create(self);
 objMultilang.LanguageOffset:= objMultilang.currentLanguage;


and all the well prepared strings (caption, hint, lines ...) will be translated.

Note: strings from *.dfm are no longer visible, cause they now come from the linked resource file!

Note: if no registry or ini will be defined you can set and call the language straight forward:

case langRGroup1.itemindex of
   0: objMultilang.LanguageOffset:= 0;
   1: objMultilang.LanguageOffset:= 1000;
   2: objMultilang.LanguageOffset:= 2000;
   3: objMultilang.LanguageOffset:= 3000;
   4: objMultilang.LanguageOffset:= 4000;
 end;


Each language can have 999 strings
{"D": Result:=0;
  "E": Result:=1000;
  "F": Result:=2000;
  "I": Result:=3000;
  "S": result:=4000;}

Now a simple example of a resource file *.rc:
(you can add this file in your delphi project)

STRINGTABLE
{  
   3, "Arbeiten im Team"
   1003, "work in team"
   2003, "travailler en groupe"
   3003, "lavorare nel gruppo"
   4003, "trabajo en equipo
}

In this case we have to assign the value 3.
In practice each language has its own section of STRINGTABLE.

STRINGTABLE
{
1, "Für die Installation brauchen Sie Admininstratoren-Rechte."
2, "Setup kann nicht gestartet werden!"
3, "&Schliessen"
}
/****************************************************************************
** English
*****************************************************************************/
STRINGTABLE
{
1001, "You require administrator rights for the installation."
1002, "Impossible to start setup!"
1003, "&Close"
}
/****************************************************************************
** French
*****************************************************************************/
STRINGTABLE
{
2001, "Pour l"installation, vous avez besoin des droits d"administrateur."
2002, "Impossible de lancer le programme d"installation !"
2003, "&Fermer"
}
/****************************************************************************
** Italian
*****************************************************************************/
STRINGTABLE
{
3001, "Per l"installazione sono necessari diritti d"amministratore."
3002, "L"installazione non può essere avviata!"
3003, "&Chiudere"
}
/****************************************************************************
** Spain
*****************************************************************************/
STRINGTABLE
{
4001, "Necesita derechos de administrador para la instalación."
4002, "No se puede iniciar la instalación"
4003, "&Cerrar"
}


 
Layner ©   (2006-10-23 07:49) [20]

Preparation of the form and the resource file:

The magic behind is the tag property of a control. It stores an integer value as part of a component and has no predefined meaning. The Tag property is provided for the convenience of developers so in our case to define a relationship to the resource file!
Changing the language of captions of controls on a form to a particular language means the tag property of the controls have to
be set to values corresponding with the according resource strings.
     
Leaving a Tag value 0 means that the caption of the according control isn"t changed. Note that languages are distinguished by an offset of a multiple of 1000. For instance german is 0, English has an offset of 1000, French one of 2000 and so on.
Important: each tag has a number between 0..999 :

 object bbtClose: TBitBtn, tag = 3  

The component will add then the offset depending the current language!

Currently the component (class TMultilangSC of the component MultilangTranslator) supports controls defined in :

      procedure ChangeComponent(theComponent: TComponent;  const
                                   theLanguageOffset : integer);


This concept can be easily extended to other controls not yet listed in the procedure ChangeComponent.

How it works:
-------------------------------------------------------------------
Delphi automatically creates a .dfm (.xfm in CLX applications) file that contains the resources for your menus, dialogs, and bitmaps (Streaming and filing of resources are inherited from TPersistent).

After a component reads all its property values from its stored description, it calls a virtual method named Loaded, which performs any required initializations. The call to Loaded occurs before the form and its controls are shown, so you don"t need to worry about initialization causing flicker on the screen.

The sequence is the following:

function TMultiLangSC.currentLanguage: integer;

    property LanguageOffset: integer read fLanguage write
                 SetLanguage;
                 SetLanguage(const Value: integer);

       procedure TMultilangSC.ChangeLanguage(const languageOffset:
                                                     integer);
             ChangeComponent(GetTopComponent,languageOffset);
       if Assigned(fOnLanguageChanged) then
                 fOnLanguageChanged(Self);


Here"s an extract of the important method ChangeComponent:

begin
 if theComponent.ComponentCount>0 then begin
   for x:= 0 to theComponent.ComponentCount-1 do
     ChangeComponent(theComponent.Components[x],theLanguageOffset);
   end;
 if theComponent.tag <> 0 then begin
   if (theComponent is TForm) then
     (theComponent as TForm).Caption:= GetResourceString(theComponent.tag)
   else if (theComponent is TLabel) then
     (theComponent as TLabel).Caption:= GetResourceString(theComponent.tag)
   else if (theComponent is TImage) then
     (theComponent as TImage).Hint:= GetResourceString(theComponent.tag)
    .....

To initialize a component after it loads its property values, override the Loaded method.
This is done when you use the translator component from the component palette.
In addition to these obvious user interface elements, you will need to isolate any strings, such as error messages or string literals, that you present to the user. String resources are not included in the form file. You can isolate them by declaring constants for them using the resourcestring keyword.
In our case we put them also in the resource file!
Therefore its possible to use the function GetResourceString at any time to load MultilangTranslator strings from the language resource file. This is especially necessary if the Translator should be used independently from a TForm or a visual component.
This is how we call the API function:

 showmessage(objMultilang.GetResourceString(21));

or in a memo component without tags:

  memInfo.lines.Add(objMultilang.GetResourceString(11));
  memInfo.lines.Add("");
  memInfo.lines.Add(objMultilang.GetResourceString(12));


Isolating resources simplifies the translation process. The next level of resource separation is the creation of a resource DLL. A resource DLL contains all the resources and only the resources for a program. Resource DLLs allow you to create a program that supports many translations simply by swapping the resource DLL.
Note:
The Translation Manager in Delphi provides a mechanism for viewing and editing translated resources. To open the Translation Manager from within the IDE, choose View|Translation Manager. Before you can use the Translation Manager in the IDE, you must add languages to your project using the Resource DLL wizard.
You will get n directories and n files with a big overhead and complicated rules!


 
Layner ©   (2006-10-23 07:51) [21]

unit MultilangTranslator;
(*
  Author: Beat Straehl, for armasuisse
          Max Kleiner, armasuisse
          max@kleiner.com
  Date:  Mai 2003
         juni 2005, resources, pascal analyzer, spain extension
         juli 2006, Max Kleiner Framework
         aug  2006  set Spain, more comps., resolve update problem
         sep  2006 dynamic change in same form on instance
         locs= 363, 5.9.2006

  Description:
   Changing the language of strings(caption, hint, lines ...) of controls on a form to a particular language. The Tag property of the controls has to be set to values corresponding with the according resource strings.

   Extract of a resource file *.rc:
   1, "Inhalt"
   1001, "Content"
   2001, "Contenu"
   3001, "Contenido"    
   4001, "Contenudo"
   In this case to a Tag of a control which should show this text in the proper language we have to assign the value 1. This can be done with the ObjectInspector.

  Version: 1.3, Implementation with Comp or by runtime
*)

interface

uses
 Windows, Messages, SysUtils, Classes;

type
 tLanguageChanging = procedure(Sender: TObject; theComponent: TComponent) of object;
 tLanguageChanged = procedure(Sender: TObject) of object;

 TMultilangSC = class(TComponent)
 private
   fLanguage: integer;
   fOnLanguageChanging: tLanguageChanging;
   fOnLanguageChanged: tLanguageChanged;
   procedure SetLanguage(const Value: integer);
   procedure ChangeLanguage(const languageOffset: integer);
   procedure ChangeComponent(theComponent: TComponent;
                               const theLanguageOffset : integer);
   function GetTopComponent: TComponent;
   function IsOSMultilanguage: boolean;
   function GetActualSystemLanguage: word;
   { Private declarations }
 protected
   //Loaded Initializes the component after the form file has been
   //read into memory.
   procedure Loaded; override;
 public
   constructor Create(AOwner: TComponent); override;
   function GetResourceString(const number: integer): string;
   function currentLanguage: integer;
   function currentSystemLanguage(mylid:word): integer;
   function currentUserLanguage: integer;
   property LanguageOffset: integer read fLanguage write SetLanguage;
 published
   { Published in ObjectInspector}
   property OnLanguageChanging: tLanguageChanging read fOnLanguageChanging write fOnLanguageChanging;
   property OnLanguageChanged: tLanguageChanged read fOnLanguageChanged write fOnLanguageChanged;
 end;

procedure Register;

 //var objMultilang: TMultilangSC;

implementation

Uses Registry, Forms, StdCtrls, ComCtrls, ExtCtrls, Menus;
// START resource string wizard section

resourcestring
 SSecLangDep_GetUserDefaultUILanguage = "GetUserDefaultUILanguage";
 SSecLangDep_Kernel32Dll = "kernel32.dll";
 SSecLangDep_Language = "Language";
 SSecLangDep_SecureCenterXP = "SecureCenterXP";
 SSecLangDep_SOFTWAREGSTSecureCenterXP = "\SOFTWARE\GST\SecureCenterXP";

// END resource string wizard section

procedure Register;
begin
 RegisterComponents(SSecLangDep_SecureCenterXP, [TMultilangSC]);
end;

{ TMultiLangSC}

constructor TMultiLangSC.Create(AOwner: TComponent);
// this creates an instance of TSecureLanguageDepenend and initializes
// its member variables.
begin
 inherited;
 fLanguage:= 0;
 fOnLanguageChanging:= NIL;
 fOnLanguageChanged:= NIL;
end;

function TMultiLangSC.currentLanguage: integer;
// this function reads from the registry the current language
// use for SecureCenterXP. It returns the base index to the
// the according language strings. A particular string then
// can be accessed adding its offset to this base value.
var
 rReg: TRegistry;
 languageStr: string;
begin
 rReg:= TRegistry.Create;
 languageStr:= "?";
 try
   with rReg do begin
     try
       RootKey:= HKEY_LOCAL_MACHINE;
       OpenKeyReadOnly(SSecLangDep_SOFTWAREGSTSecureCenterXP);
       languageStr:= ReadString(SSecLangDep_Language);
     except
     end;
   end;
 finally
   rReg.Free;
 end;
 if languageStr <> "" then begin
    case languageStr[1] of
      "D": Result:=0;
      "E": Result:=1000;
      "F": Result:=2000;
      "I": Result:=3000;
      "S": result:=4000;
    else
       Result:= 0;
    end;
 end
  else
   Result:= 0;
end;

procedure TMultilangSC.SetLanguage(const Value: integer);
// changes the language of a component tree (usually a form)
begin
 fLanguage:= Value;
 if not (csLoading in ComponentState) then
   ChangeLanguage(fLanguage);
end;

function TMultilangSC.GetResourceString(const number : integer) : string;
// reads a string from the resource file. As a parameter this function takes the
// offset of the string relative to the base index fLanguage.
var pP: array[0..255] of char;
begin
 if LoadString(HInstance, number + fLanguage, pP, sizeof(pP))>0 then
   result:= pP
 else
   result:= "";
end;

function TMultilangSC.GetTopComponent: TComponent;
// searches upwards through a tree of components until its root is found
// or a component is of type TForm.
var x: TComponent;
begin
 x:= Self;
 Result:= x; // prevent compiler warning
 while (Assigned(x)) and not (x is TForm) do begin
   Result:= x;
   x:= x.Owner;
 end;
 if Assigned(x) then
   Result:= x;
end;

procedure TMultilangSC.ChangeLanguage(const languageOffset: integer);
// this method changes the language of a component tree, if we are not in design mode.
// after the whole tree of components has been change the event fOnLanguageChanged is
// called, if a value has been assigned to it. This give the client the opportunity
// to do his own language specific text assignments using GetResourceString.
begin
 if not (csDesigning in ComponentState) then begin
    ChangeComponent(GetTopComponent,languageOffset);
    if Assigned(fOnLanguageChanged) then
      fOnLanguageChanged(Self);
 end;
end;


 
Layner ©   (2006-10-23 07:52) [22]

procedure TMultilangSC.ChangeComponent(theComponent: TComponent;
                            const theLanguageOffset: integer);
// this function changes the language of the components text fields recursively.
// for every component an event fOnLanguageChanging is called if a handler was
// assigned to it. This gives the client the opportunity to do additional language
// specific treatments on a component level. If for instance a component is a grid,
// the client can use this event to test whether this grid is the current processed
// component and if true he could use the opportunity to change column or
// row names using GetResourceString
var x : integer;
begin
 if theComponent.ComponentCount > 0 then begin
   for x:= 0 to theComponent.ComponentCount-1 do
     ChangeComponent(theComponent.Components[x], theLanguageOffset);
 end;
 if theComponent.tag <> 0 then begin
   if (theComponent is TForm) then
     (theComponent as TForm).Caption:= GetResourceString(theComponent.tag)
   else if (theComponent is TLabel) then
     (theComponent as TLabel).Caption:= GetResourceString(theComponent.tag)
   else if (theComponent is TCheckBox) then
     (theComponent as TCheckBox).Caption:= GetResourceString(theComponent.tag)
   else if (theComponent is TToolButton) then
     (theComponent as TToolButton).Hint:= GetResourceString(theComponent.tag)
   else if (theComponent is TButton) then
     (theComponent as TButton).Caption:= GetResourceString(theComponent.tag)
   else if (theComponent is TRadioButton) then
     (theComponent as TRadioButton).Caption:= GetResourceString(theComponent.tag)
   else if (theComponent is TGroupBox) then
     (theComponent as TGroupBox).Caption:= GetResourceString(theComponent.tag)
   else if (theComponent is TPanel) then
     (theComponent as TPanel).Caption:= GetResourceString(theComponent.tag)
   else if (theComponent is TTabSheet) then
     (theComponent as TTabSheet).Caption:= GetResourceString(theComponent.tag)
   else if (theComponent is TMenuItem) then
     (theComponent as TMenuItem).Caption:= GetResourceString(theComponent.tag)
   else if (theComponent is TImage) then
     (theComponent as TImage).Hint:= GetResourceString(theComponent.tag)
   else if (theComponent is TRadioGroup) then
     (theComponent as TRadioGroup).caption:=
                                      GetResourceString(theComponent.tag);
   if Assigned(fOnLanguageChanging) then
     fOnLanguageChanging(Self, theComponent);
 end;
end;

procedure TMultilangSC.Loaded;
begin
 inherited;
 LanguageOffset:= currentLanguage;
end;

function TMultilangSC.currentSystemLanguage(mylid: word): integer;
begin
 case mylid of
     // german dialects
       $0407, {German (Standard)}
       $0807, {German (Switzerland)}
       $0c07, {German (Austria)}
       $1007, {German (Luxembourg)}
       $1407: {German (Liechtenstein)}
               Result := 0;
     // french dialects
       $040c, { French (Standard)}
       $080c, { French (Belgian)}
       $0c0c, { French (Canadian)}
       $100c, { French (Switzerland)}
       $140c, { French (Luxembourg)}
       $180c: { Windows 98/Me, Windows 2000/XP: French (Monaco)}
               Result := 2000;
     // english dialects
       $0409, {  English (United States)}
       $0809, {  English (United Kingdom)}
       $0c09, {  English (Australian)}
       $1009, {  English (Canadian)}
       $1409, {  English (New Zealand)}
       $1809, {  English (Ireland)}
       $1c09, {  English (South Africa)}
       $2009, {  English (Jamaica)}
       $2409, {  English (Caribbean)}
       $2809, {  English (Belize)}
       $2c09, {  English (Trinidad)}
       $3009, {  Windows 98/Me, Windows 2000/XP: English (Zimbabwe)}
       $3409: {  Windows 98/Me, Windows 2000/XP: English (Philippines)}
               Result := 1000;
       $0410, {  Italian (Standard)}
       $0810: {  Italian (Switzerland)}
               Result := 3000;

         //LANG_SPANISH = $0a;
        //{$EXTERNALSYM LANG_SPANISH}
         //$01;    { Spanish (Castilian)
       $040a:
               result:= 4000;
  else
   Result:= 0;
 end;
end;

function TMultilangSC.currentUserLanguage: integer;
var
 lid: word;
begin
 if self.IsOSMultilanguage then begin
   //Nur fur Multilanguage Plattformen wie: W2K, XP, Win2003, etc.
   lid:= self.GetActualSystemLanguage;
   result:= currentSystemLanguage(lid)
 end
 else begin
   //Fur alle andern Plattfomen wie: Win95, Win98, ME, NT
   lid:= GetSystemDefaultLangID;
   result:= currentSystemLanguage(lid);
 end;
end;

function TMultilangSC.IsOSMultilanguage: boolean;
var
 aOsInfo: TOSVersionInfo;
begin
 aOsInfo.dwOSVersionInfoSize:= SizeOf(TOSVersionInfo);
 GetVersionEx(aOsInfo);
 if aOsInfo.dwMajorVersion >= 5 then //Grosser als 5 ist W2K oder XP oder 2003
   result:= true
 else
   result:= false;
end;

//function GetUserDefaultUILanguage:word; stdcall; external "kernel32.dll";
function TMultilangSC.GetActualSystemLanguage: Word;
type
 FunctionWithDWORDReturnValue = function: DWORD; stdcall;
var
 libInstance: HINST;
 GetUserDefaultUILanguage: FunctionWithDWORDReturnValue;
begin
 //result := GetUserDefaultUILanguage;
 result:= 0;
 libInstance:= LoadLibrary("kernel32.dll");
 try
   if libInstance <> 0 then begin
     GetUserDefaultUILanguage:= GetProcAddress(libInstance, "GetUserDefaultUILanguage");
     Result:= GetUserDefaultUILanguage;
   end;
 finally
   FreeLibrary(libInstance);
 end;
end;

initialization
 //objMultilang:= TMultiLangSC.Create(NIL);

finalization
 //objMultilang.Free;

end.



Страницы: 1 вся ветка

Форум: "Прочее";
Текущий архив: 2006.11.12;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.57 MB
Время: 0.041 c
15-1161497227
*Стажер*
2006-10-22 10:07
2006.11.12
"Защита от дураков"


15-1161978224
Sergey Masloff
2006-10-27 23:43
2006.11.12
Вопрос. Не мешает ли руководителю умение программировать.


2-1161778513
kirillrepin
2006-10-25 16:15
2006.11.12
tray с использованием rxlib


15-1161580480
Бугага
2006-10-23 09:14
2006.11.12
В мире есть 10 категорий людей: те, кто знает двоичное исчисление


1-1159106424
fs_more
2006-09-24 18:00
2006.11.12
Передача данных в сообщении (SendMessage / PostMessage)





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский