mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-07 08:19:26 +01:00
* use the setresourcestirng iterator
git-svn-id: trunk@2900 -
This commit is contained in:
parent
0899f0fbf7
commit
2fb94ece94
@ -211,54 +211,18 @@ end;
|
|||||||
// Resourcestring translation procedures
|
// Resourcestring translation procedures
|
||||||
// -------------------------------------------------------
|
// -------------------------------------------------------
|
||||||
|
|
||||||
{
|
|
||||||
Define USEITERATOR if you want to translate the strings using
|
|
||||||
the SetResourceStrings call. This is not recommended for this
|
|
||||||
particular iplementation, since we must pass through a global
|
|
||||||
variable TheFile : TMOFile. However that works too.
|
|
||||||
}
|
|
||||||
|
|
||||||
{$ifdef USEITERATOR}
|
|
||||||
var
|
|
||||||
Thefile : TMOFile;
|
|
||||||
|
|
||||||
function Translate (Name,Value : AnsiString; Hash : Longint) : AnsiString;
|
|
||||||
|
|
||||||
|
function Translate (Name,Value : AnsiString; Hash : Longint; arg:pointer) : AnsiString;
|
||||||
begin
|
begin
|
||||||
Result:=TheFile.Translate(Value,Hash);
|
Result:=TMOFile(arg).Translate(Value,Hash);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TranslateResourceStrings(AFile: TMOFile);
|
procedure TranslateResourceStrings(AFile: TMOFile);
|
||||||
var
|
|
||||||
i,j : Integer;
|
|
||||||
s : String;
|
|
||||||
begin
|
begin
|
||||||
TheFile:=AFile;
|
SetResourceStrings(@Translate,AFile);
|
||||||
SetResourceStrings(@Translate);
|
|
||||||
end;
|
end;
|
||||||
{$else}
|
|
||||||
|
|
||||||
procedure TranslateResourceStrings(AFile: TMOFile);
|
|
||||||
var
|
|
||||||
i, j, count: Integer;
|
|
||||||
s: String;
|
|
||||||
begin
|
|
||||||
for i:=0 to ResourceStringTableCount - 1 do
|
|
||||||
begin
|
|
||||||
count := ResourceStringCount(I);
|
|
||||||
for j := 0 to count - 1 do
|
|
||||||
begin
|
|
||||||
s := AFile.Translate(GetResourceStringDefaultValue(i, j),
|
|
||||||
GetResourceStringHash(i, j));
|
|
||||||
if Length(s) > 0 then
|
|
||||||
begin
|
|
||||||
SetResourceStringValue(i, j, s);
|
|
||||||
GettextUsed := True;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
{$endif}
|
|
||||||
|
|
||||||
{$ifdef win32}
|
{$ifdef win32}
|
||||||
procedure GetLanguageIDs(var Lang, FallbackLang: string);
|
procedure GetLanguageIDs(var Lang, FallbackLang: string);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user