PoChecker:

- Add capability to open file in external editor (stand-alone version).
- Regenerate language files.

git-svn-id: trunk@46386 -
This commit is contained in:
bart 2014-09-30 22:43:59 +00:00
parent 948659f90d
commit 325ae8915a
15 changed files with 340 additions and 16 deletions

View File

@ -6,7 +6,11 @@ interface
uses
Classes, SysUtils, Types, FileUtil, Forms, Controls, Graphics, Dialogs,
{$ifndef POCHECKERSTANDALONE} LazIDEIntf, {$endif}
{$ifndef POCHECKERSTANDALONE}
LazIDEIntf,
{$else}
Process, Utf8Process,
{$endif}
ExtCtrls, PoFamilies, PoCheckerConsts, LCLProc, StdCtrls, ComCtrls,
PoCheckerSettings;
@ -117,14 +121,16 @@ end;
procedure TGraphStatForm.ListViewMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
{$ifndef POCHECKERSTANDALONE}
var
anItem: TListItem;
anIndex: Integer;
AStat: TStat;
mr: TModalResult;
{$ifndef POCHECKERSTANDALONE}
PageIndex,WindowIndex: Integer;
OpenFlags: TOpenFlags;
mr: TModalResult;
{$else}
Proc: TProcessUtf8;
{$endif}
begin
{$ifndef POCHECKERSTANDALONE}
@ -144,6 +150,37 @@ begin
end
else ShowMessage(Format(SOpenFail,[AStat.PoName]));
end;
{$else}
anItem := Listview.GetItemAt(X, Y);
if Assigned(anItem) and (Settings.ExternalEditorName <> '') then
begin
anIndex := anItem.Index;
AStat := FPoFamilyStats.Items[anIndex];
if MessageDlg('PoChecker',Format(sOpenFileExternal,[AStat.PoName,Settings.ExternalEditorName]),
mtConfirmation,mbOKCancel,0) = mrOk then
begin
Proc := TProcessUtf8.Create(nil);
try
Proc.Options := [];
Proc.Executable := Settings.ExternalEditorName;
Proc.Parameters.Add(AStat.PoName);
try
Proc.Execute;
except
on E: EProcess do
begin
debugln('TGraphStatForm.ListViewMouseUp:');
debugln(' Exception occurred of type ',E.ClassName);
debugln(' Message: ',E.Message);
ShowMessage(Format(SOpenFailExternal,[AStat.PoName,Settings.ExternalEditorName]));
end;
end;
finally
Proc.Free;
end;
end;
end;
{$endif}
end;

View File

@ -57,6 +57,10 @@ msgstr "Spočítat procentuální zastoupení (ne)přeložených a nepřesných
msgid "Copy to clipboard"
msgstr "Kopírovat do schránky"
#: pocheckerconsts.scurrenttest
msgid "Test: %s on %s"
msgstr ""
#: pocheckerconsts.sduplicatelinenrwithvalue
msgid "[Line %d] %s"
msgstr "[Řádek %d] %s"
@ -171,13 +175,31 @@ msgid "&Open a po-file"
msgstr "&Otevřít PO soubor"
#: pocheckerconsts.sopenfail
msgid "Unable to open file %s"
msgid ""
"Unable to open file:\n"
"\"%s\"\n"
msgstr ""
#: pocheckerconsts.sopenfailexternal
msgid ""
"Unable to open file\n"
"\"%s\"\n"
"in external editor\n"
"\"%s\"\n"
msgstr ""
#: pocheckerconsts.sopenfile
msgid "Open file %s in Ide Editor?"
msgstr ""
#: pocheckerconsts.sopenfileexternal
msgid ""
"Open file:\n"
"\"%s\"\n"
"in external editor:\n"
"\"%s\"?\n"
msgstr ""
#: pocheckerconsts.soriginal
msgid "Original"
msgstr "Originál"

View File

@ -54,6 +54,10 @@ msgstr "Zeige Prozente (nicht) übersetzter und ungeklärter Zeichenketten"
msgid "Copy to clipboard"
msgstr "In Zwischenablage kopieren"
#: pocheckerconsts.scurrenttest
msgid "Test: %s on %s"
msgstr ""
#: pocheckerconsts.sduplicatelinenrwithvalue
msgid "[Line %d] %s"
msgstr "[Zeile %d] %s"
@ -168,13 +172,31 @@ msgid "&Open a po-file"
msgstr "p&o-Datei öffnen"
#: pocheckerconsts.sopenfail
msgid "Unable to open file %s"
msgid ""
"Unable to open file:\n"
"\"%s\"\n"
msgstr ""
#: pocheckerconsts.sopenfailexternal
msgid ""
"Unable to open file\n"
"\"%s\"\n"
"in external editor\n"
"\"%s\"\n"
msgstr ""
#: pocheckerconsts.sopenfile
msgid "Open file %s in Ide Editor?"
msgstr ""
#: pocheckerconsts.sopenfileexternal
msgid ""
"Open file:\n"
"\"%s\"\n"
"in external editor:\n"
"\"%s\"?\n"
msgstr ""
#: pocheckerconsts.soriginal
msgid "Original"
msgstr "Original"
@ -250,6 +272,10 @@ msgstr "Zeige Statistik-Graphik"
#| "%3d UnTranslated (%3.1f%%)\n"
#| "%3d Fuzzy (%3.1f%%)\n"
#| "%d Error(s) in Selected Tests\n"
#| "%3d Translated (%3.1f%%)\n"
#| "%3d UnTranslated (%3.1f%%)\n"
#| "%3d Fuzzy (%3.1f%%)\n"
#| "%d Error(s) in Selected Tests\n"
msgid ""
"%3d Translated (%3.1f%%)\n"
"%3d UnTranslated (%3.1f%%)\n"

View File

@ -53,6 +53,10 @@ msgstr ""
msgid "Copy to clipboard"
msgstr "Copiar en el portapapeles"
#: pocheckerconsts.scurrenttest
msgid "Test: %s on %s"
msgstr ""
#: pocheckerconsts.sduplicatelinenrwithvalue
msgid "[Line %d] %s"
msgstr "[Línea %d] %s"
@ -168,13 +172,31 @@ msgid "&Open a po-file"
msgstr "Abrir un fichero p&o"
#: pocheckerconsts.sopenfail
msgid "Unable to open file %s"
msgid ""
"Unable to open file:\n"
"\"%s\"\n"
msgstr ""
#: pocheckerconsts.sopenfailexternal
msgid ""
"Unable to open file\n"
"\"%s\"\n"
"in external editor\n"
"\"%s\"\n"
msgstr ""
#: pocheckerconsts.sopenfile
msgid "Open file %s in Ide Editor?"
msgstr ""
#: pocheckerconsts.sopenfileexternal
msgid ""
"Open file:\n"
"\"%s\"\n"
"in external editor:\n"
"\"%s\"?\n"
msgstr ""
#: pocheckerconsts.soriginal
msgid "Original"
msgstr "Original"

View File

@ -55,6 +55,10 @@ msgstr "A lefordított és lefordítatlan szövegek százalékának ellenőrzés
msgid "Copy to clipboard"
msgstr "Másolás vágólapra"
#: pocheckerconsts.scurrenttest
msgid "Test: %s on %s"
msgstr ""
#: pocheckerconsts.sduplicatelinenrwithvalue
msgid "[Line %d] %s"
msgstr "[Sor: %d] %s"
@ -168,13 +172,31 @@ msgid "&Open a po-file"
msgstr "PO fájl megnyitása"
#: pocheckerconsts.sopenfail
msgid "Unable to open file %s"
msgid ""
"Unable to open file:\n"
"\"%s\"\n"
msgstr ""
#: pocheckerconsts.sopenfailexternal
msgid ""
"Unable to open file\n"
"\"%s\"\n"
"in external editor\n"
"\"%s\"\n"
msgstr ""
#: pocheckerconsts.sopenfile
msgid "Open file %s in Ide Editor?"
msgstr ""
#: pocheckerconsts.sopenfileexternal
msgid ""
"Open file:\n"
"\"%s\"\n"
"in external editor:\n"
"\"%s\"?\n"
msgstr ""
#: pocheckerconsts.soriginal
msgid "Original"
msgstr "Eredeti"

View File

@ -53,6 +53,10 @@ msgstr "Verifica le percentuali di stringhe tradotte o incerte"
msgid "Copy to clipboard"
msgstr "Copia negli appunti"
#: pocheckerconsts.scurrenttest
msgid "Test: %s on %s"
msgstr ""
#: pocheckerconsts.sduplicatelinenrwithvalue
msgid "[Line %d] %s"
msgstr "[Riga %d] %s"
@ -166,13 +170,31 @@ msgid "&Open a po-file"
msgstr "&Aprire un file po"
#: pocheckerconsts.sopenfail
msgid "Unable to open file %s"
msgid ""
"Unable to open file:\n"
"\"%s\"\n"
msgstr ""
#: pocheckerconsts.sopenfailexternal
msgid ""
"Unable to open file\n"
"\"%s\"\n"
"in external editor\n"
"\"%s\"\n"
msgstr ""
#: pocheckerconsts.sopenfile
msgid "Open file %s in Ide Editor?"
msgstr ""
#: pocheckerconsts.sopenfileexternal
msgid ""
"Open file:\n"
"\"%s\"\n"
"in external editor:\n"
"\"%s\"?\n"
msgstr ""
#: pocheckerconsts.soriginal
msgid "Original"
msgstr "Originale"

View File

@ -55,6 +55,10 @@ msgstr "翻訳/未翻訳、未確定文字列の割合を検査"
msgid "Copy to clipboard"
msgstr "クリップボードへコピー"
#: pocheckerconsts.scurrenttest
msgid "Test: %s on %s"
msgstr ""
#: pocheckerconsts.sduplicatelinenrwithvalue
msgid "[Line %d] %s"
msgstr "[行 %d] %s"
@ -168,13 +172,31 @@ msgid "&Open a po-file"
msgstr "po ファイルを開く(&O)"
#: pocheckerconsts.sopenfail
msgid "Unable to open file %s"
msgid ""
"Unable to open file:\n"
"\"%s\"\n"
msgstr ""
#: pocheckerconsts.sopenfailexternal
msgid ""
"Unable to open file\n"
"\"%s\"\n"
"in external editor\n"
"\"%s\"\n"
msgstr ""
#: pocheckerconsts.sopenfile
msgid "Open file %s in Ide Editor?"
msgstr ""
#: pocheckerconsts.sopenfileexternal
msgid ""
"Open file:\n"
"\"%s\"\n"
"in external editor:\n"
"\"%s\"?\n"
msgstr ""
#: pocheckerconsts.soriginal
msgid "Original"
msgstr "原文"

View File

@ -55,6 +55,10 @@ msgstr ""
msgid "Copy to clipboard"
msgstr "Kopijuoti į iškarpinę"
#: pocheckerconsts.scurrenttest
msgid "Test: %s on %s"
msgstr ""
#: pocheckerconsts.sduplicatelinenrwithvalue
msgid "[Line %d] %s"
msgstr "[Eilutė %d] %s"
@ -170,13 +174,31 @@ msgid "&Open a po-file"
msgstr "At&verti PO failą"
#: pocheckerconsts.sopenfail
msgid "Unable to open file %s"
msgid ""
"Unable to open file:\n"
"\"%s\"\n"
msgstr ""
#: pocheckerconsts.sopenfailexternal
msgid ""
"Unable to open file\n"
"\"%s\"\n"
"in external editor\n"
"\"%s\"\n"
msgstr ""
#: pocheckerconsts.sopenfile
msgid "Open file %s in Ide Editor?"
msgstr ""
#: pocheckerconsts.sopenfileexternal
msgid ""
"Open file:\n"
"\"%s\"\n"
"in external editor:\n"
"\"%s\"?\n"
msgstr ""
#: pocheckerconsts.soriginal
msgid "Original"
msgstr "Originalas"

View File

@ -41,6 +41,10 @@ msgstr ""
msgid "Copy to clipboard"
msgstr ""
#: pocheckerconsts.scurrenttest
msgid "Test: %s on %s"
msgstr ""
#: pocheckerconsts.sduplicatelinenrwithvalue
msgid "[Line %d] %s"
msgstr ""
@ -146,13 +150,31 @@ msgid "&Open a po-file"
msgstr ""
#: pocheckerconsts.sopenfail
msgid "Unable to open file %s"
msgid ""
"Unable to open file:\n"
"\"%s\"\n"
msgstr ""
#: pocheckerconsts.sopenfailexternal
msgid ""
"Unable to open file\n"
"\"%s\"\n"
"in external editor\n"
"\"%s\"\n"
msgstr ""
#: pocheckerconsts.sopenfile
msgid "Open file %s in Ide Editor?"
msgstr ""
#: pocheckerconsts.sopenfileexternal
msgid ""
"Open file:\n"
"\"%s\"\n"
"in external editor:\n"
"\"%s\"?\n"
msgstr ""
#: pocheckerconsts.soriginal
msgid "Original"
msgstr ""

View File

@ -54,6 +54,10 @@ msgstr ""
msgid "Copy to clipboard"
msgstr "Copiar para área de transferência"
#: pocheckerconsts.scurrenttest
msgid "Test: %s on %s"
msgstr ""
#: pocheckerconsts.sduplicatelinenrwithvalue
msgid "[Line %d] %s"
msgstr "[Linha %d] %s"
@ -168,13 +172,31 @@ msgid "&Open a po-file"
msgstr "&Abrir um arquivo PO"
#: pocheckerconsts.sopenfail
msgid "Unable to open file %s"
msgid ""
"Unable to open file:\n"
"\"%s\"\n"
msgstr ""
#: pocheckerconsts.sopenfailexternal
msgid ""
"Unable to open file\n"
"\"%s\"\n"
"in external editor\n"
"\"%s\"\n"
msgstr ""
#: pocheckerconsts.sopenfile
msgid "Open file %s in Ide Editor?"
msgstr ""
#: pocheckerconsts.sopenfileexternal
msgid ""
"Open file:\n"
"\"%s\"\n"
"in external editor:\n"
"\"%s\"?\n"
msgstr ""
#: pocheckerconsts.soriginal
msgid "Original"
msgstr "Original"

View File

@ -53,6 +53,10 @@ msgstr "Вывод статистики по (не)переведённым и
msgid "Copy to clipboard"
msgstr "Копировать в буфер обмена"
#: pocheckerconsts.scurrenttest
msgid "Test: %s on %s"
msgstr ""
#: pocheckerconsts.sduplicatelinenrwithvalue
msgid "[Line %d] %s"
msgstr "[Строка %d] %s"
@ -167,13 +171,33 @@ msgid "&Open a po-file"
msgstr "&Открыть файл PO"
#: pocheckerconsts.sopenfail
msgid "Unable to open file %s"
#, fuzzy
#| msgid "Unable to open file %s"
msgid ""
"Unable to open file:\n"
"\"%s\"\n"
msgstr "Невозможно открыть файл %s"
#: pocheckerconsts.sopenfailexternal
msgid ""
"Unable to open file\n"
"\"%s\"\n"
"in external editor\n"
"\"%s\"\n"
msgstr ""
#: pocheckerconsts.sopenfile
msgid "Open file %s in Ide Editor?"
msgstr "Открыть файл %s в редакторе IDE?"
#: pocheckerconsts.sopenfileexternal
msgid ""
"Open file:\n"
"\"%s\"\n"
"in external editor:\n"
"\"%s\"?\n"
msgstr ""
#: pocheckerconsts.soriginal
msgid "Original"
msgstr "Исходная строка"
@ -232,6 +256,7 @@ msgid "Show statistics graph"
msgstr "Показать графическую сводку"
#: pocheckerconsts.sstathint
#, fuzzy
#| msgid ""
#| "%3.1f %% Translated\n"
#| "%3.1f %% UnTranslated\n"
@ -252,6 +277,10 @@ msgstr "Показать графическую сводку"
#| "%3d UnTranslated (%3.1f%%)\n"
#| "%3d Fuzzy (%3.1f%%)\n"
#| "%d Error(s) in Selected Tests\n"
#| "%3d Translated (%3.1f%%)\n"
#| "%3d UnTranslated (%3.1f%%)\n"
#| "%3d Fuzzy (%3.1f%%)\n"
#| "%d Error(s) in Selected Tests\n"
msgid ""
"%3d Translated (%3.1f%%)\n"
"%3d UnTranslated (%3.1f%%)\n"

View File

@ -52,6 +52,10 @@ msgstr ""
msgid "Copy to clipboard"
msgstr "Копіювати в буфер"
#: pocheckerconsts.scurrenttest
msgid "Test: %s on %s"
msgstr ""
#: pocheckerconsts.sduplicatelinenrwithvalue
msgid "[Line %d] %s"
msgstr "[Рядок %d] %s"
@ -167,13 +171,31 @@ msgid "&Open a po-file"
msgstr "&Відкрити po-файл"
#: pocheckerconsts.sopenfail
msgid "Unable to open file %s"
msgid ""
"Unable to open file:\n"
"\"%s\"\n"
msgstr ""
#: pocheckerconsts.sopenfailexternal
msgid ""
"Unable to open file\n"
"\"%s\"\n"
"in external editor\n"
"\"%s\"\n"
msgstr ""
#: pocheckerconsts.sopenfile
msgid "Open file %s in Ide Editor?"
msgstr ""
#: pocheckerconsts.sopenfileexternal
msgid ""
"Open file:\n"
"\"%s\"\n"
"in external editor:\n"
"\"%s\"?\n"
msgstr ""
#: pocheckerconsts.soriginal
msgid "Original"
msgstr "Оригінал"

View File

@ -24,6 +24,7 @@ resourcestring
sTotalErrors = 'Total errors found: %d';
sTotalWarnings = 'Total warnings found: %d';
sNoErrorsFound = 'No errors found';
sCurrentTest = 'Test: %s on %s';
sNoTestSelected = 'There are no tests selected.';
//Result form
@ -43,7 +44,12 @@ resourcestring
'%3d Fuzzy (%3.1f%%)' + LineEnding +
'%d Error(s) in Selected Tests';
sOpenFile = 'Open file %s in Ide Editor?';
SOpenFail = 'Unable to open file %s';
sOpenFileExternal = 'Open file:' + LineEnding + '"%s"' +
LineEnding + 'in external editor:' +
LineEnding + '"%s"?';
SOpenFail = 'Unable to open file:' + LineEnding + '"%s"';
SOpenFailExternal = 'Unable to open file' + LineEnding +
'"%s"' + LineEnding + 'in external editor' + LineEnding + '"%s"';
//PoFamiles
sOriginal = 'Original';

View File

@ -202,7 +202,7 @@ procedure TPoCheckerForm.OnTestStart(const ATestName, APoFileName: string);
begin
//debugln('OnTestStart: ATestName = "',AtestName,'" APoFileName = "',APoFileName);
StatusBar.SimplePanel := True;
StatusBar.SimpleText := Format('Test: %s on %s',[ATestName,APoFileName]);
StatusBar.SimpleText := Format(sCurrentTest,[ATestName,APoFileName]);
Application.ProcessMessages;
end;

View File

@ -20,6 +20,7 @@ type
TPoCheckerSettings = class
private
FConfig: TConfigStorage;
FExternalEditorName: String;
FFilename: String;
FTestTypes: TPoTestTypes;
FTestOptions: TPoTestOptions;
@ -35,12 +36,14 @@ type
function LoadTestTypes: TPoTestTypes;
function LoadTestOptions: TPoTestOptions;
procedure LoadWindowsGeometry;
function LoadExternalEditorName: String;
procedure LoadMasterPoList(List: TStrings);
procedure LoadChildrenPoList(List: TStrings);
procedure SaveLastSelectedFile;
procedure SaveTestTypes;
procedure SaveTestOptions;
procedure SaveWindowsGeometry;
procedure SaveExternalEditorName;
procedure SaveMasterPoList;
procedure SaveChildrenPoList;
@ -55,6 +58,7 @@ type
property SaveSettingsOnExit: Boolean read FSaveSettingsOnExit write FSaveSettingsOnExit;
property TestTypes: TPoTestTypes read FTestTypes write FTestTypes;
property TestOptions: TPoTestOptions read FTestOptions write FTestOptions;
property ExternalEditorName: String read FExternalEditorName write FExternalEditorName;
property MasterPoList: TStrings read FMasterPoList write FMasterPoList;
property ChildrenPoList: TStrings read FChildrenPoList write FChildrenPoList;
property LastSelectedFile: String read FLastSelectedFile write FLastSelectedFile;
@ -135,6 +139,7 @@ const
pTestTypes = 'TestTypes/';
pTestOptions = 'TestOptions/';
pWindowsGeometry = 'General/WindowsGeometry/';
pExternalEditor = 'ExternalEditor/';
pMasterPoFiles = 'MasterPoFiles/';
pChildrenPoFiles = 'ChildrenPoFiles/';
@ -250,6 +255,20 @@ begin
FConfig.GetValue(pWindowsGeometry+'GraphForm/Value',FGraphFormGeometry,DefaultRect);
end;
function TPoCheckerSettings.LoadExternalEditorName: String;
begin
{$IFDEF POCHECKERSTANDALONE}
//allow override on commandline
if Application.HasOption('editor') then
Result := Application.GetOptionValue('editor')
else
Result := FConfig.GetValue(pExternalEditor+'Value','');
{$ELSE}
Result := '';
{$eNDIF}
end;
procedure TPoCheckerSettings.LoadMasterPoList(List: TStrings);
begin
if not Assigned(List) then Exit;
@ -298,6 +317,13 @@ begin
FConfig.SetDeleteValue(pWindowsGeometry+'GraphForm/Value',FGraphFormGeometry,DefaultRect);
end;
procedure TPoCheckerSettings.SaveExternalEditorName;
begin
{$IFDEF POCHECKERSTANDALONE}
FConfig.SetDeleteValue(pExternalEditor+'Value',FExternalEditorName,'');
{$ENDIF}
end;
procedure TPoCheckerSettings.SaveMasterPoList;
begin
FConfig.DeletePath(pMasterPoFiles);
@ -351,6 +377,7 @@ begin
FTestTypes := LoadTestTypes;
FTestOptions := LoadTestOptions;
FLastSelectedFile := LoadLastSelectedFile;
FExternalEditorName := LoadExternalEditorName;
LoadWindowsGeometry;
LoadMasterPoList(FMasterPoList);
LoadChildrenPoList(FChildrenPoList);
@ -372,6 +399,7 @@ begin
SaveLastSelectedFile;
SaveTestTypes;
SaveTestOptions;
SaveExternalEditorName;
SaveWindowsGeometry;
SaveMasterPoList;
SaveChildrenPoList;