DelphiWorlds / Codex

Codex is an add-in for RAD Studio
MIT License
64 stars 10 forks source link

Feature request: Codex localization matches the IDE localization settings #41

Open SoftFour opened 3 weeks ago

SoftFour commented 3 weeks ago

Hi Dave,

I'm using the great Codex tool under my RadStudio IDE in Germany, but with English localization in the IDE. This means, all my IDE menu's were in usually in English.

When I use Codex, I notice that their menu's were translated to German, which looks a little odd with the mixed languages. It seems IDE translated to German grafik grafik

while other pages stay still in English grafik

I assume you choose the PC'S local language for the translation selection, would it be possible to use the IDE language selection instead, so that the menu text language will match all other IDE text language?

DelphiWorlds commented 3 weeks ago

Yes, it would make sense for the Codex translations be based on the language that was used for Delphi. Just wondering whether this should be a configurable option? To me the answer would be: "no"

SoftFour commented 3 weeks ago

Perhaps this would be possible via registry grafik

or the locales

grafik

Not sure if this can be reached via IOTA, like that

uses
  ToolsAPI, System.Win.Registry, Winapi.Windows, System.SysUtils;

function GetIDELanguage: string;
var
  BaseRegistryKey: string;
  Registry: TRegistry;
begin
  Result := '';
  // Zugriff auf das IOTAServices-Interface, um den Basis-Registrierungsschlüssel zu erhalten
  BaseRegistryKey := (BorlandIDEServices as IOTAServices).GetBaseRegistryKey;
  Registry := TRegistry.Create(KEY_READ);
  try
    Registry.RootKey := HKEY_CURRENT_USER;
    // Öffnen des Basis-Registrierungspfads
    if Registry.OpenKeyReadOnly(BaseRegistryKey) then
    begin
      if Registry.ValueExists('InstallLanguage') then
      begin
        Result := Registry.ReadString('InstallLanguage');
        Exit;
      end;
    end;
    // Falls 'InstallLanguage' nicht vorhanden ist, 'Localization\Language' prüfen
    if Registry.OpenKeyReadOnly(BaseRegistryKey + '\Localization') then
    begin
      if Registry.ValueExists('Language') then
        Result := Registry.ReadString('Language');
    end;
  finally
    Registry.Free;
  end;
end;

It seems to be "InstallLanguage" in newer IDE and "Language" in older, but I have not tested this code.