[request] TC-language in FsDefaultParamStruct

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
Jonas
Senior Member
Senior Member
Posts: 325
Joined: 2003-05-27, 16:59 UTC
Location: Germany
Contact:

[request] TC-language in FsDefaultParamStruct

Post by *Jonas »

Would it be possible to pass the language of TC to the plugin?
I'm running with 'wcmd_deu.lng' and want my plugin to know that. Of is there an other way to figure that out?
User avatar
djk
Power Member
Power Member
Posts: 1651
Joined: 2003-03-17, 11:33 UTC
Location: Poland
Contact:

Re: [request] TC-language in FsDefaultParamStruct

Post by *djk »

Jonas wrote:Would it be possible to pass the language of TC to the plugin?
I'm running with 'wcmd_deu.lng' and want my plugin to know that. Of is there an other way to figure that out?
Which plugin do you mean?
AFAIK plugins don't use TC language files. Only some of them are multilanguage but they use their own language files. In this case you can choose your favourite one or translate the orignal one into your language (and share it to others :-) )
DJK
Totally addicted to Total Commander
totalcmd.pl
en.totalcmd.pl
Jonas
Senior Member
Senior Member
Posts: 325
Joined: 2003-05-27, 16:59 UTC
Location: Germany
Contact:

Post by *Jonas »

I know that plugins are using thier own lanuagepackages. But it would be nice if my ipod.wfx on which I'm working could get TC's language and so automaticly read for ex. the [de]-section of it's languagefile.... or the 'wcmd_deu.lng' in it's own directory or what ever
User avatar
djk
Power Member
Power Member
Posts: 1651
Joined: 2003-03-17, 11:33 UTC
Location: Poland
Contact:

Post by *djk »

Sorry, I haven't understood you :oops:
DJK
Totally addicted to Total Commander
totalcmd.pl
en.totalcmd.pl
User avatar
Hacker
Moderator
Moderator
Posts: 13067
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

Jonas,
Well you can always check the wincmd.ini...

HTH
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
VadiMGP
Power Member
Power Member
Posts: 672
Joined: 2003-04-05, 12:11 UTC
Location: Israel

Post by *VadiMGP »

2Hacker It is not so easy to detect which .ini file currently in use.
User avatar
Hacker
Moderator
Moderator
Posts: 13067
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

Oh it is. First check the registry, then the windows dir. If not found then let the user tell you, use default or forget about it.

A bit of TCME code:

Code: Select all

// returns the wincmd.ini location
function GetIniLoc: string;
var
  reg: tregistry;
  strn: string;
  i: integer;
begin
  // check if the wincmd.ini location wasn't specified as a command line parameter
  for i := 1 to paramcount do
    if ansistartstext('ini=', paramstr(i)) then
      begin
        strn := copy(paramstr(i), 5, length(paramstr(i)));
        break;
      end;

  // if it wasn't specified we'll have to look in the registry
  if strn = '' then
    begin
      reg := tregistry.create;
      if reg.KeyExists('SOFTWARE\Ghisler\Total Commander') then
        begin
          reg.openkeyreadonly('SOFTWARE\Ghisler\Total Commander');
          if reg.ValueExists('IniFileName') then
            strn := reg.ReadString('IniFileName');
        end;
      if strn = '' then // as it wasn't in HKCU we're switching to HKLM
        begin
          reg.RootKey := HKEY_LOCAL_MACHINE;
          if reg.KeyExists('SOFTWARE\Ghisler\Total Commander') then
            begin
              reg.openkeyreadonly('SOFTWARE\Ghisler\Total Commander');
              if reg.ValueExists('IniFileName') then
                strn := reg.ReadString('IniFileName');
            end;
        end;
          // if it still isn't found or is just wincmd.ini we assume it's in the windows dir
          if (strn = '') or (lowercase(strn) = 'wincmd.ini') then
            if fileexists(GetEnvironmentVariable('windir') + '\wincmd.ini') then
              strn := GetEnvironmentVariable('windir') + '\wincmd.ini';
      reg.Free;
    end;

  getiniloc := strn;
end;
HTH
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
VadiMGP
Power Member
Power Member
Posts: 672
Joined: 2003-04-05, 12:11 UTC
Location: Israel

Post by *VadiMGP »

Hacker wrote:Oh it is. First check the registry, then the windows dir. If not found then let the user tell you, use default or forget about it.
Of course, registry ckecking isn't difficult, but...

Code: Select all

// returns the wincmd.ini location
  // check if the wincmd.ini location wasn't specified as a command line parameter
  for i := 1 to paramcount do
    if ansistartstext('ini=', paramstr(i)) then
      begin
        strn := copy(paramstr(i), 5, length(paramstr(i)));
        break;
      end;
This is very interesting point. You check parameters for TCME! Not for TC. The problem is how to detect which .ini file currently in use by TC. Take in account possibility of several instances of TC at the same time with different .ini files. I really want to know if you have an idea how to handle this case. When i wrote Tcmenu i spend a lot of time to solve this problem but didn't find right solution. :cry:
User avatar
Hacker
Moderator
Moderator
Posts: 13067
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

Ask the user (or use some default). There is really no other feasible way I'd know of (except getting into TC's memory and look there somewhere :) ).

Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
Post Reply