View Single Post
  #157  
Old 09-09-2025, 23:39
nodesire7 nodesire7 is offline
Registered User
 
Join Date: Sep 2025
Location: China
Posts: 15
Thanks: 4
Thanked 2 Times in 2 Posts
nodesire7 is on a distinguished road
Quote:
Originally Posted by audiofeel View Post
I won't help you here, try translating everything in the russian.ini or english.ini file yourself. that's where it's translated.
I've tried these methods, but I can't translate this part. It needs to be forcibly replaced in Inno Setup because it's a parameter in the DLL. If I want to change it, I have to modify the DLL.

Code:
// 替换时分秒
function ReplaceTimeUnits(TimeStr: WideString): WideString;
var
i: Integer;
begin
Result := TimeStr;

// 先处理复数形式,再处理单数形式,避免替换不完整
while Pos(' hrs', Result) > 0 do
Result := Copy(Result, 1, Pos(' hrs', Result) - 1) + ' 小时' + Copy(Result, Pos(' hrs', Result) + 4, Length(Result));

while Pos(' hr', Result) > 0 do
Result := Copy(Result, 1, Pos(' hr', Result) - 1) + ' 小时' + Copy(Result, Pos(' hr', Result) + 3, Length(Result));

while Pos(' secs', Result) > 0 do
Result := Copy(Result, 1, Pos(' secs', Result) - 1) + ' 秒' + Copy(Result, Pos(' secs', Result) + 5, Length(Result));

while Pos(' sec', Result) > 0 do
Result := Copy(Result, 1, Pos(' sec', Result) - 1) + ' 秒' + Copy(Result, Pos(' sec', Result) + 4, Length(Result));

while Pos(' mins', Result) > 0 do
Result := Copy(Result, 1, Pos(' mins', Result) - 1) + ' 分钟' + Copy(Result, Pos(' mins', Result) + 5, Length(Result));

while Pos(' min', Result) > 0 do
Result := Copy(Result, 1, Pos(' min', Result) - 1) + ' 分钟' + Copy(Result, Pos(' min', Result) + 4, Length(Result));
end;

function ProgressCallbackEx(OverallPct, CurrentPct, DiskTotalMB, DiskExtractedMB, TotalFiles, CurFiles: Integer; DiskName, CurrentFile, RemainsTime, ElapsedTime, CurSpeed, AvgSpeed: WideString): longword;
begin
Page4Arc.Angle(OverallPct, 1000);
Page4Lbl[2].Text(IntToStr(OverallPct div 10) + '%');
Page4Lbl[11].Text(': ' + CurrentFile);
Page4Lbl[12].Text(': ' + ReplaceTimeUnits(RemainsTime));
Page4Lbl[13].Text(': ' + ReplaceTimeUnits(ElapsedTime));
Page5Lbl[3].Text(CustomMessage(UILang + 'Page5Lbl3') + #9 + ': ' + ReplaceTimeUnits(ElapsedTime));

Result:= ISArcExCancel;
end;
I succeeded by modifying it this way.



I checked other script, and it's all similar. Making slight modifications, similar to what I sent, allows for successful replacement.

Last edited by nodesire7; 09-09-2025 at 23:41.
Reply With Quote
The Following User Says Thank You to nodesire7 For This Useful Post:
audiofeel (28-12-2025)