diff --git a/.gitattributes b/.gitattributes index f86a81a3c5..c12aa6520d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2017,8 +2017,11 @@ components/pochecker/Proj/pochecker.lpr svneol=native#text/plain components/pochecker/Proj/pocheckermain.lfm svneol=native#text/plain components/pochecker/Proj/pocheckermain.pp svneol=native#text/plain components/pochecker/README.txt svneol=native#text/plain +components/pochecker/languages/pocheckerconsts.po svneol=native#text/plain +components/pochecker/languages/pocheckerconsts.ru.po svneol=native#text/plain components/pochecker/pochecker.lpk svneol=native#text/plain components/pochecker/pochecker.pas svneol=native#text/plain +components/pochecker/pocheckerconsts.pas svneol=native#text/pascal components/pochecker/pocheckermain.lfm svneol=native#text/plain components/pochecker/pocheckermain.pp svneol=native#text/plain components/pochecker/pofamilies.pp svneol=native#text/plain diff --git a/components/pochecker/Proj/pochecker.lpi b/components/pochecker/Proj/pochecker.lpi index f3d935fc27..fe27abdde0 100644 --- a/components/pochecker/Proj/pochecker.lpi +++ b/components/pochecker/Proj/pochecker.lpi @@ -4,11 +4,13 @@ + + + - @@ -37,7 +39,7 @@ - + @@ -46,25 +48,34 @@ + + - + + - + + + + + + + diff --git a/components/pochecker/Proj/pochecker.lpr b/components/pochecker/Proj/pochecker.lpr index 88a6ea8d0c..5c2660e44d 100644 --- a/components/pochecker/Proj/pochecker.lpr +++ b/components/pochecker/Proj/pochecker.lpr @@ -7,7 +7,7 @@ uses cthreads, {$ENDIF}{$ENDIF} Interfaces, // this includes the LCL widgetset - Forms, pocheckermain, pofamilies, resultdlg, simplepofiles; + Forms, pocheckermain, pofamilies, resultdlg, simplepofiles, pocheckerconsts; {$R *.res} diff --git a/components/pochecker/Proj/pocheckermain.lfm b/components/pochecker/Proj/pocheckermain.lfm index ad603fe0c9..2b17241eba 100644 --- a/components/pochecker/Proj/pocheckermain.lfm +++ b/components/pochecker/Proj/pocheckermain.lfm @@ -15,7 +15,7 @@ object PoCheckerForm: TPoCheckerForm AnchorSideTop.Control = SelectTestLabel AnchorSideTop.Side = asrBottom Left = 201 - Height = 174 + Height = 150 Top = 28 Width = 373 Anchors = [akTop, akLeft, akRight, akBottom] @@ -38,10 +38,16 @@ object PoCheckerForm: TPoCheckerForm ParentFont = False end object OpenBtn: TBitBtn + AnchorSideLeft.Control = RunBtn + AnchorSideRight.Control = RunBtn + AnchorSideRight.Side = asrBottom + AnchorSideBottom.Control = RunBtn Left = 8 Height = 63 Top = 33 Width = 184 + Anchors = [akLeft, akRight, akBottom] + BorderSpacing.Bottom = 6 Caption = '&Open a po-file' Glyph.Data = { 36040000424D3604000000000000360000002800000010000000100000000100 @@ -83,16 +89,12 @@ object PoCheckerForm: TPoCheckerForm TabOrder = 1 end object RunBtn: TBitBtn - AnchorSideLeft.Control = OpenBtn - AnchorSideTop.Control = OpenBtn AnchorSideTop.Side = asrBottom - AnchorSideRight.Control = OpenBtn AnchorSideRight.Side = asrBottom Left = 8 Height = 63 Top = 102 Width = 184 - Anchors = [akTop, akLeft, akRight] BorderSpacing.Top = 6 Caption = '&Run Selected Tests' Enabled = False @@ -114,7 +116,7 @@ object PoCheckerForm: TPoCheckerForm Left = 8 Height = 14 Top = 8 - Width = 62 + Width = 66 Caption = 'Current Test:' ParentColor = False end @@ -125,7 +127,7 @@ object PoCheckerForm: TPoCheckerForm Left = 8 Height = 14 Top = 22 - Width = 69 + Width = 75 Caption = 'Current po-file:' ParentColor = False end @@ -134,7 +136,7 @@ object PoCheckerForm: TPoCheckerForm AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = CurTestHeaderLabel AnchorSideTop.Side = asrCenter - Left = 76 + Left = 80 Height = 14 Top = 8 Width = 64 @@ -147,10 +149,10 @@ object PoCheckerForm: TPoCheckerForm AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = CurPoHeaderLabel AnchorSideTop.Side = asrCenter - Left = 83 + Left = 89 Height = 14 Top = 22 - Width = 56 + Width = 55 BorderSpacing.Around = 6 Caption = 'CurPoLabel' ParentColor = False @@ -158,9 +160,9 @@ object PoCheckerForm: TPoCheckerForm end object NoErrLabel: TLabel Left = 8 - Height = 25 - Top = 231 - Width = 149 + Height = 24 + Top = 232 + Width = 152 Anchors = [akLeft, akBottom] Caption = 'No errors found' Font.Color = clGreen @@ -175,14 +177,26 @@ object PoCheckerForm: TPoCheckerForm AnchorSideTop.Side = asrBottom Left = 201 Height = 17 - Top = 208 - Width = 64 + Top = 184 + Width = 61 BorderSpacing.Top = 6 Caption = 'Select All' Enabled = False OnClick = SelectAllCheckBoxClick TabOrder = 4 end + object FindAllPOsCheckBox: TCheckBox + AnchorSideLeft.Control = SelectAllCheckBox + AnchorSideTop.Control = SelectAllCheckBox + AnchorSideTop.Side = asrBottom + Left = 201 + Height = 17 + Top = 207 + Width = 142 + BorderSpacing.Top = 6 + Caption = 'Find all translated PO files' + TabOrder = 5 + end object OpenDialog: TOpenDialog Filter = 'po-files (*.po)|*.po|all files|*' Options = [ofFileMustExist, ofEnableSizing, ofViewDetail] diff --git a/components/pochecker/Proj/pocheckermain.pp b/components/pochecker/Proj/pocheckermain.pp index 5473c4c97b..98aba5bb7f 100644 --- a/components/pochecker/Proj/pocheckermain.pp +++ b/components/pochecker/Proj/pocheckermain.pp @@ -25,14 +25,15 @@ interface uses Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, - StdCtrls, LCLProc, CheckLst, Buttons, ExtCtrls, - SimplePoFiles, PoFamilies, ResultDlg; + StdCtrls, LCLProc, CheckLst, Buttons, ExtCtrls, Translations, + SimplePoFiles, PoFamilies, ResultDlg, pocheckerconsts; type { TPoCheckerForm } TPoCheckerForm = class(TForm) + FindAllPOsCheckBox: TCheckBox; SelectAllCheckBox: TCheckBox; CurTestHeaderLabel: TLabel; CurPoHeaderLabel: TLabel; @@ -67,20 +68,6 @@ type end; -resourcestring - rsPoChecker = 'PO File Checker'; - sSelectAllTests = 'Select all tests'; - sUnSelectAllTests = 'Unselect all tests'; - sCannotFindMaster = 'Cannot find master po file:' + LineEnding + '%s' + LineEnding + 'for selected file' + LineEnding + '%s'; - sNotAProperFileName = 'Selected filename' + LineEnding + '%s' + LineEnding + 'does not seem to be a proper name for a po-file'; - sErrorOnCreate = 'Error creating an instance of TPoFamily:' + LineEnding + '%s'; - sErrorOnCleanup = 'An unrecoverable error occurred' + LineEnding + '%s' + LineEnding + 'Please close the program'; - - sTotalErrors = 'Total errors found : %d'; - sTotalWarnings = 'Total warnings found: %d'; - //sNoErrorsFound = 'No errors found.'; - sNoTestSelected = 'There are no tests selected.'; - var PoCheckerForm: TPoCheckerForm; @@ -91,10 +78,31 @@ implementation { TPoCheckerForm } procedure TPoCheckerForm.FormCreate(Sender: TObject); +var + Lang, T: string; begin + //Initializing translation + Lang := GetEnvironmentVariableUTF8('LANG'); + if Lang = '' then + LCLGetLanguageIDs(Lang, T); + if Lang <> '' then + begin + Lang := copy(Lang, 1, 2); + Translations.TranslateUnitResourceStrings('PoCheckerConsts', '..'+DirectorySeparator+'languages'+DirectorySeparator+'pocheckerconsts.'+Lang+'.po'); + Translations.TranslateUnitResourceStrings('LCLStrConsts', '..'+DirectorySeparator+'languages'+DirectorySeparator+'lclstrconsts.'+Lang+'.po'); + end; + + Caption := sGUIPoFileCheckingTool; + SelectTestLabel.Caption := sSelectTestTypes; + FindAllPOsCheckBox.Caption := sFindAllTranslatedPoFiles; + OpenBtn.Caption := sOpenAPoFile; + RunBtn.Caption := sRunSelectedTests; + NoErrLabel.Caption := sNoErrorsFound; FillTestListBox; ClearAndDisableStatusPanel; NoErrLabel.Visible := False; + CurTestHeaderLabel.Caption := sCurrentTest; + CurPoHeaderLabel.Caption := sCurrentPoFile; end; procedure TPoCheckerForm.FormDestroy(Sender: TObject); @@ -158,8 +166,16 @@ procedure TPoCheckerForm.FillTestListBox; var Opt: TPoTestOption; begin - for Opt := Low(PoTestOptionNames) to High(PoTestOptionNames) do - TestListBox.Items.Add(PoTestOptionNames[Opt]); + for Opt := Low(PoTestOptionNames) to Pred(High(PoTestOptionNames)) do + case Opt of + ptoCheckNrOfItems: TestListBox.Items.Add(sCheckNumberOfItems); + ptoCheckFormatArgs: TestListBox.Items.Add(sCheckForIncompatibleFormatArguments); + ptoCheckMissingIdentifiers: TestListBox.Items.Add(sCheckMissingIdentifiers); + ptoCheckMismatchedOriginals: TestListBox.Items.Add(sCheckForMismatchesInUntranslatedStrings); + ptoCheckDuplicateOriginals: TestListBox.Items.Add(sCheckForDuplicateUntranslatedValues); + else + TestListBox.Items.Add(PoTestOptionNames[Opt]); + end; SelectAllCheckBox.Caption := sSelectAllTests; end; @@ -169,7 +185,7 @@ var Index: Integer; begin Result := []; - for Opt := Low(TpoTestOption) to High(TPoTestOption) do + for Opt := Low(TpoTestOption) to Pred(High(TPoTestOption)) do begin Index := Ord(Opt); if (Index < TestListBox.Count) then @@ -178,6 +194,8 @@ begin Result := Result + [Opt]; end; end; + if FindAllPOsCheckBox.Checked then + Result := Result + [High(TPoTestOption)]; end; procedure TPoCheckerForm.ShowError(const Msg: String); diff --git a/components/pochecker/languages/pocheckerconsts.po b/components/pochecker/languages/pocheckerconsts.po new file mode 100644 index 0000000000..636036763d --- /dev/null +++ b/components/pochecker/languages/pocheckerconsts.po @@ -0,0 +1,181 @@ +msgid "" +msgstr "Content-Type: text/plain; charset=UTF-8" + +#: pocheckerconsts.rspochecker +msgid "PO File Checker" +msgstr "" + +#: pocheckerconsts.scannotfindmaster +msgid "" +"Cannot find master po file:\n" +"%s\n" +"for selected file\n" +"%s\n" +msgstr "" + +#: pocheckerconsts.scheckforduplicateuntranslatedvalues +msgid "Check for duplicate untranslated values" +msgstr "" + +#: pocheckerconsts.scheckforincompatibleformatarguments +msgid "Check for incompatible format arguments" +msgstr "" + +#: pocheckerconsts.scheckformismatchesinuntranslatedstrings +msgid "Check for mismatches in untranslated strings" +msgstr "" + +#: pocheckerconsts.scheckmissingidentifiers +msgid "Check missing identifiers" +msgstr "" + +#: pocheckerconsts.schecknumberofitems +msgid "Check number of items" +msgstr "" + +#: pocheckerconsts.scopycaption +msgid "Copy to clipboard" +msgstr "" + +#: pocheckerconsts.scurrentpofile +msgid "Current po-file:" +msgstr "" + +#: pocheckerconsts.scurrenttest +msgid "Current Test:" +msgstr "" + +#: pocheckerconsts.sduplicatelinenrwithvalue +msgid "[Line %d] %s" +msgstr "" + +#: pocheckerconsts.sduplicateoriginals +msgid "The (untranslated) value \"%s\" is used for more than 1 entry:" +msgstr "" + +#: pocheckerconsts.serroroncleanup +msgid "" +"An unrecoverable error occurred\n" +"%s\n" +"Please close the program\n" +msgstr "" + +#: pocheckerconsts.serroroncreate +msgid "" +"Error creating an instance of TPoFamily:\n" +"%s\n" +msgstr "" + +#: pocheckerconsts.serrorsbytest +msgid "Errors / warnings reported by %s for:" +msgstr "" + +#: pocheckerconsts.sfindalltranslatedpofiles +msgid "Find all translated po-files" +msgstr "" + +#: pocheckerconsts.sguipofilecheckingtool +msgid "GUI Po-file checking tool" +msgstr "" + +#: pocheckerconsts.sidentifiernotfoundin +msgid "Identifier [%s] not found in %s" +msgstr "" + +#: pocheckerconsts.sincompatibleformatargs +msgid "[Line: %d] Incompatible format() arguments for:" +msgstr "" + +#: pocheckerconsts.slineinfilename +msgid "[Line %d] in %s:" +msgstr "" + +#: pocheckerconsts.slinenr +msgid "[Line: %d]" +msgstr "" + +#: pocheckerconsts.smissingmasteridentifier +msgid "Identifier [%s] found in %s, but it does not exist in %s" +msgstr "" + +#: pocheckerconsts.snoerrorsfound +msgid "No errors found" +msgstr "" + +#: pocheckerconsts.snotaproperfilename +msgid "" +"Selected filename\n" +"%s\n" +"does not seem to be a proper name for a po-file\n" +msgstr "" + +#: pocheckerconsts.snotestselected +msgid "There are no tests selected." +msgstr "" + +#: pocheckerconsts.snrerrorsfound +msgid "Found %d errors." +msgstr "" + +#: pocheckerconsts.snrofitemsmismatch +msgid "Mismatch in number of items for master and child" +msgstr "" + +#: pocheckerconsts.snrofitemsmismatchd +msgid "%s: %d items" +msgstr "" + +#: pocheckerconsts.snrwarningsfound +msgid "Found %d warnings." +msgstr "" + +#: pocheckerconsts.sopenapofile +msgid "&Open a po-file" +msgstr "" + +#: pocheckerconsts.soriginal +msgid "Original" +msgstr "" + +#: pocheckerconsts.sresults +msgid "Results" +msgstr "" + +#: pocheckerconsts.srunselectedtests +msgid "&Run Selected Tests" +msgstr "" + +#: pocheckerconsts.ssavecaption +msgid "Save to file" +msgstr "" + +#: pocheckerconsts.ssaveerror +msgid "" +"Error saving file:\n" +"%s\n" +msgstr "" + +#: pocheckerconsts.sselectalltests +msgid "Select all tests" +msgstr "" + +#: pocheckerconsts.sselecttesttypes +msgid "Select test types" +msgstr "" + +#: pocheckerconsts.stotalerrors +msgid "Total errors / warnings found: %d" +msgstr "" + +#: pocheckerconsts.stotalwarnings +msgid "Total warnings found: %d" +msgstr "" + +#: pocheckerconsts.stranslation +msgid "Translation" +msgstr "" + +#: pocheckerconsts.sunselectalltests +msgid "Unselect all tests" +msgstr "" + diff --git a/components/pochecker/languages/pocheckerconsts.ru.po b/components/pochecker/languages/pocheckerconsts.ru.po new file mode 100644 index 0000000000..be173202b5 --- /dev/null +++ b/components/pochecker/languages/pocheckerconsts.ru.po @@ -0,0 +1,203 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" +"Project-Id-Version: \n" +"POT-Creation-Date: \n" +"PO-Revision-Date: \n" +"Last-Translator: Maxim Ganetsky \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Transfer-Encoding: 8bit\n" + +#: pocheckerconsts.rspochecker +msgid "PO File Checker" +msgstr "Проверка файлов PO" + +#: pocheckerconsts.scannotfindmaster +msgid "" +"Cannot find master po file:\n" +"%s\n" +"for selected file\n" +"%s\n" +msgstr "" +"Невозможно найти главный файл PO:\n" +"%s\n" +"для выбранного файла\n" +"%s\n" + +#: pocheckerconsts.scheckforduplicateuntranslatedvalues +msgid "Check for duplicate untranslated values" +msgstr "Поиск дублирующихся непереведённых строк" + +#: pocheckerconsts.scheckforincompatibleformatarguments +msgid "Check for incompatible format arguments" +msgstr "Поиск несовместимых аргументов форматирования" + +#: pocheckerconsts.scheckformismatchesinuntranslatedstrings +msgid "Check for mismatches in untranslated strings" +msgstr "Поиск несоответствий непереведённых строк" + +#: pocheckerconsts.scheckmissingidentifiers +msgid "Check missing identifiers" +msgstr "Поиск отсутствующих идентификаторов" + +#: pocheckerconsts.schecknumberofitems +msgid "Check number of items" +msgstr "Проверка числа строк" + +#: pocheckerconsts.scopycaption +msgid "Copy to clipboard" +msgstr "Копировать в буфер обмена" + +#: pocheckerconsts.scurrentpofile +msgid "Current po-file:" +msgstr "Текущий файл PO:" + +#: pocheckerconsts.scurrenttest +msgid "Current Test:" +msgstr "Текущий тест:" + +#: pocheckerconsts.sduplicatelinenrwithvalue +msgid "[Line %d] %s" +msgstr "[Строка %d] %s" + +#: pocheckerconsts.sduplicateoriginals +msgid "The (untranslated) value \"%s\" is used for more than 1 entry:" +msgstr "Исходное значение \"%s\" имеется в нескольких элементах:" + +#: pocheckerconsts.serroroncleanup +msgid "" +"An unrecoverable error occurred\n" +"%s\n" +"Please close the program\n" +msgstr "" +"Возникла неустранимая ошибка\n" +"%s\n" +"Программу следует закрыть\n" + +#: pocheckerconsts.serroroncreate +msgid "" +"Error creating an instance of TPoFamily:\n" +"%s\n" +msgstr "" +"Ошибка создания экземпляра класса TPoFamily:\n" +"%s\n" + +#: pocheckerconsts.serrorsbytest +msgid "Errors / warnings reported by %s for:" +msgstr "Ошибки и предупреждения, найденные %s для:" + +#: pocheckerconsts.sfindalltranslatedpofiles +msgid "Find all translated po-files" +msgstr "Найти все переведённые файлы PO" + +#: pocheckerconsts.sguipofilecheckingtool +msgid "GUI Po-file checking tool" +msgstr "Средство проверки файлов PO" + +#: pocheckerconsts.sidentifiernotfoundin +msgid "Identifier [%s] not found in %s" +msgstr "Идентификатор [%s] не найден в %s" + +#: pocheckerconsts.sincompatibleformatargs +msgid "[Line: %d] Incompatible format() arguments for:" +msgstr "[Строка: %d] Несовместимые аргументы для Format() в:" + +#: pocheckerconsts.slineinfilename +msgid "[Line %d] in %s:" +msgstr "[Строка %d] в %s:" + +#: pocheckerconsts.slinenr +msgid "[Line: %d]" +msgstr "[Строка: %d]" + +#: pocheckerconsts.smissingmasteridentifier +msgid "Identifier [%s] found in %s, but it does not exist in %s" +msgstr "Идентификатор [%s] найден в %s, но отсутствует в %s" + +#: pocheckerconsts.snoerrorsfound +msgid "No errors found" +msgstr "Ошибок не найдено" + +#: pocheckerconsts.snotaproperfilename +msgid "" +"Selected filename\n" +"%s\n" +"does not seem to be a proper name for a po-file\n" +msgstr "" +"Выбранное имя файла\n" +"%s\n" +"не выглядит корректно для файла PO\n" + +#: pocheckerconsts.snotestselected +msgid "There are no tests selected." +msgstr "Не выбрано ни одного теста." + +#: pocheckerconsts.snrerrorsfound +msgid "Found %d errors." +msgstr "Найдено ошибок: %d" + +#: pocheckerconsts.snrofitemsmismatch +msgid "Mismatch in number of items for master and child" +msgstr "Несоответствие количества элементов в главном и дочернем файлах" + +#: pocheckerconsts.snrofitemsmismatchd +msgid "%s: %d items" +msgstr "%s: %d элементов" + +#: pocheckerconsts.snrwarningsfound +msgid "Found %d warnings." +msgstr "Найдено предупреждений: %d" + +#: pocheckerconsts.sopenapofile +msgid "&Open a po-file" +msgstr "&Открыть файл PO" + +#: pocheckerconsts.soriginal +msgid "Original" +msgstr "Исходная строка" + +#: pocheckerconsts.sresults +msgid "Results" +msgstr "Результаты" + +#: pocheckerconsts.srunselectedtests +msgid "&Run Selected Tests" +msgstr "&Запустить выбранные тесты" + +#: pocheckerconsts.ssavecaption +msgid "Save to file" +msgstr "Сохранить в файл" + +#: pocheckerconsts.ssaveerror +msgid "" +"Error saving file:\n" +"%s\n" +msgstr "" +"Ошибка сохранения файла:\n" +"%s\n" + +#: pocheckerconsts.sselectalltests +msgid "Select all tests" +msgstr "Выбрать все тесты" + +#: pocheckerconsts.sselecttesttypes +msgid "Select test types" +msgstr "Выбор тестов" + +#: pocheckerconsts.stotalerrors +msgid "Total errors / warnings found: %d" +msgstr "Всего найдено ошибок и предупреждений: %d" + +#: pocheckerconsts.stotalwarnings +msgid "Total warnings found: %d" +msgstr "Всего найдено предупреждений: %d" + +#: pocheckerconsts.stranslation +msgid "Translation" +msgstr "Перевод" + +#: pocheckerconsts.sunselectalltests +msgid "Unselect all tests" +msgstr "Отменить выбор всех тестов" + diff --git a/components/pochecker/pochecker.lpk b/components/pochecker/pochecker.lpk index c32d47c8b7..b6cd2a4138 100644 --- a/components/pochecker/pochecker.lpk +++ b/components/pochecker/pochecker.lpk @@ -20,7 +20,7 @@ - + @@ -46,7 +46,15 @@ + + + + + + + + @@ -65,5 +73,8 @@ + + <_ExternHelp Items="Count"/> + diff --git a/components/pochecker/pochecker.pas b/components/pochecker/pochecker.pas index c019d21924..61ec9c21d4 100644 --- a/components/pochecker/pochecker.pas +++ b/components/pochecker/pochecker.pas @@ -2,20 +2,21 @@ This source is only used to compile and install the package. } -unit PoChecker; +unit PoChecker; interface uses - ResultDlg, PoFamilies, pocheckermain, SimplePoFiles, LazarusPackageIntf; + ResultDlg, PoFamilies, pocheckermain, SimplePoFiles, pocheckerconsts, + LazarusPackageIntf; implementation -procedure Register; +procedure Register; begin - RegisterUnit('pocheckermain', @pocheckermain.Register); -end; + RegisterUnit('pocheckermain', @pocheckermain.Register); +end; initialization - RegisterPackage('PoChecker', @Register); + RegisterPackage('PoChecker', @Register); end. diff --git a/components/pochecker/pocheckerconsts.pas b/components/pochecker/pocheckerconsts.pas new file mode 100644 index 0000000000..3aaf3e0ab5 --- /dev/null +++ b/components/pochecker/pocheckerconsts.pas @@ -0,0 +1,64 @@ +unit pocheckerconsts; + +{$mode objfpc}{$H+} + +interface + +resourcestring + //Main form + rsPoChecker = 'PO File Checker'; + sSelectAllTests = 'Select all tests'; + sUnSelectAllTests = 'Unselect all tests'; + sGUIPoFileCheckingTool = 'GUI Po-file checking tool'; + sSelectTestTypes = 'Select test types'; + sOpenAPoFile = '&Open a po-file'; + sRunSelectedTests = '&Run Selected Tests'; + sCannotFindMaster = 'Cannot find master po file:' + LineEnding + '%s' + LineEnding + 'for selected file' + LineEnding + '%s'; + sNotAProperFileName = 'Selected filename' + LineEnding + '%s' + LineEnding + 'does not seem to be a proper name for a po-file'; + sErrorOnCreate = 'Error creating an instance of TPoFamily:' + LineEnding + '%s'; + sErrorOnCleanup = 'An unrecoverable error occurred' + LineEnding + '%s' + LineEnding + 'Please close the program'; + + sTotalErrors = 'Total errors / warnings found: %d'; + sTotalWarnings = 'Total warnings found: %d'; + sNoErrorsFound = 'No errors found'; + sCurrentTest = 'Current Test:'; + sCurrentPoFile = 'Current po-file:'; + sNoTestSelected = 'There are no tests selected.'; + + //Result form + sSaveError = 'Error saving file:' + LineEnding + '%s'; + sSaveCaption = 'Save to file'; + sResults = 'Results'; + sCopyCaption = 'Copy to clipboard'; + + //PoFamiles + sOriginal = 'Original'; + sTranslation = 'Translation'; + sErrorsByTest = 'Errors / warnings reported by %s for:'; + sCheckNumberOfItems = 'Check number of items'; + sCheckForIncompatibleFormatArguments = 'Check for incompatible format ' + +'arguments'; + sCheckMissingIdentifiers = 'Check missing identifiers'; + sCheckForMismatchesInUntranslatedStrings = 'Check for mismatches in ' + +'untranslated strings'; + sCheckForDuplicateUntranslatedValues = 'Check for duplicate untranslated ' + +'values'; + sFindAllTranslatedPoFiles = 'Find all translated po-files'; + sIncompatibleFormatArgs = '[Line: %d] Incompatible format() arguments for:' ; + + sNrErrorsFound = 'Found %d errors.'; + sNrWarningsFound = 'Found %d warnings.'; + sLineInFileName = '[Line %d] in %s:'; + sIdentifierNotFoundIn = 'Identifier [%s] not found in %s'; + sMissingMasterIdentifier = 'Identifier [%s] found in %s, but it does not exist in %s'; + sLineNr = '[Line: %d]'; + + sNrOfItemsMisMatch = 'Mismatch in number of items for master and child'; + sNrOfItemsMismatchD = '%s: %d items'; + + sDuplicateOriginals = 'The (untranslated) value "%s" is used for more than 1 entry:'; + sDuplicateLineNrWithValue = '[Line %d] %s'; +implementation + +end. + diff --git a/components/pochecker/pocheckermain.lfm b/components/pochecker/pocheckermain.lfm index 925f4971f6..2b17241eba 100644 --- a/components/pochecker/pocheckermain.lfm +++ b/components/pochecker/pocheckermain.lfm @@ -15,8 +15,8 @@ object PoCheckerForm: TPoCheckerForm AnchorSideTop.Control = SelectTestLabel AnchorSideTop.Side = asrBottom Left = 201 - Height = 169 - Top = 33 + Height = 150 + Top = 28 Width = 373 Anchors = [akTop, akLeft, akRight, akBottom] BorderSpacing.Top = 6 @@ -28,9 +28,9 @@ object PoCheckerForm: TPoCheckerForm AnchorSideLeft.Control = OpenBtn AnchorSideLeft.Side = asrBottom Left = 201 - Height = 19 + Height = 14 Top = 8 - Width = 144 + Width = 97 BorderSpacing.Left = 9 Caption = 'Select test types' Font.Style = [fsBold] @@ -38,10 +38,16 @@ object PoCheckerForm: TPoCheckerForm ParentFont = False end object OpenBtn: TBitBtn + AnchorSideLeft.Control = RunBtn + AnchorSideRight.Control = RunBtn + AnchorSideRight.Side = asrBottom + AnchorSideBottom.Control = RunBtn Left = 8 Height = 63 Top = 33 Width = 184 + Anchors = [akLeft, akRight, akBottom] + BorderSpacing.Bottom = 6 Caption = '&Open a po-file' Glyph.Data = { 36040000424D3604000000000000360000002800000010000000100000000100 @@ -83,16 +89,12 @@ object PoCheckerForm: TPoCheckerForm TabOrder = 1 end object RunBtn: TBitBtn - AnchorSideLeft.Control = OpenBtn - AnchorSideTop.Control = OpenBtn AnchorSideTop.Side = asrBottom - AnchorSideRight.Control = OpenBtn AnchorSideRight.Side = asrBottom Left = 8 Height = 63 Top = 102 Width = 184 - Anchors = [akTop, akLeft, akRight] BorderSpacing.Top = 6 Caption = '&Run Selected Tests' Enabled = False @@ -112,9 +114,9 @@ object PoCheckerForm: TPoCheckerForm TabOrder = 3 object CurTestHeaderLabel: TLabel Left = 8 - Height = 19 + Height = 14 Top = 8 - Width = 96 + Width = 66 Caption = 'Current Test:' ParentColor = False end @@ -123,9 +125,9 @@ object PoCheckerForm: TPoCheckerForm AnchorSideTop.Control = CurTestHeaderLabel AnchorSideTop.Side = asrBottom Left = 8 - Height = 19 - Top = 27 - Width = 111 + Height = 14 + Top = 22 + Width = 75 Caption = 'Current po-file:' ParentColor = False end @@ -134,10 +136,10 @@ object PoCheckerForm: TPoCheckerForm AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = CurTestHeaderLabel AnchorSideTop.Side = asrCenter - Left = 110 - Height = 19 + Left = 80 + Height = 14 Top = 8 - Width = 95 + Width = 64 BorderSpacing.Around = 6 Caption = 'CurTestLabel' ParentColor = False @@ -147,10 +149,10 @@ object PoCheckerForm: TPoCheckerForm AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = CurPoHeaderLabel AnchorSideTop.Side = asrCenter - Left = 125 - Height = 19 - Top = 27 - Width = 82 + Left = 89 + Height = 14 + Top = 22 + Width = 55 BorderSpacing.Around = 6 Caption = 'CurPoLabel' ParentColor = False @@ -160,7 +162,7 @@ object PoCheckerForm: TPoCheckerForm Left = 8 Height = 24 Top = 232 - Width = 171 + Width = 152 Anchors = [akLeft, akBottom] Caption = 'No errors found' Font.Color = clGreen @@ -174,15 +176,27 @@ object PoCheckerForm: TPoCheckerForm AnchorSideTop.Control = TestListBox AnchorSideTop.Side = asrBottom Left = 201 - Height = 23 - Top = 208 - Width = 97 + Height = 17 + Top = 184 + Width = 61 BorderSpacing.Top = 6 Caption = 'Select All' Enabled = False OnClick = SelectAllCheckBoxClick TabOrder = 4 end + object FindAllPOsCheckBox: TCheckBox + AnchorSideLeft.Control = SelectAllCheckBox + AnchorSideTop.Control = SelectAllCheckBox + AnchorSideTop.Side = asrBottom + Left = 201 + Height = 17 + Top = 207 + Width = 142 + BorderSpacing.Top = 6 + Caption = 'Find all translated PO files' + TabOrder = 5 + end object OpenDialog: TOpenDialog Filter = 'po-files (*.po)|*.po|all files|*' Options = [ofFileMustExist, ofEnableSizing, ofViewDetail] diff --git a/components/pochecker/pocheckermain.pp b/components/pochecker/pocheckermain.pp index 46e0c2f251..18e9e9135a 100644 --- a/components/pochecker/pocheckermain.pp +++ b/components/pochecker/pocheckermain.pp @@ -26,13 +26,14 @@ interface uses Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, LCLProc, CheckLst, Buttons, ExtCtrls, IDEIntf, MenuIntf, - SimplePoFiles, PoFamilies, ResultDlg; + SimplePoFiles, PoFamilies, ResultDlg, pocheckerconsts; type { TPoCheckerForm } TPoCheckerForm = class(TForm) + FindAllPOsCheckBox: TCheckBox; SelectAllCheckBox: TCheckBox; CurTestHeaderLabel: TLabel; CurPoHeaderLabel: TLabel; @@ -67,20 +68,6 @@ type end; -resourcestring - rsPoChecker = 'PO File Checker'; - sSelectAllTests = 'Select all tests'; - sUnSelectAllTests = 'Unselect all tests'; - sCannotFindMaster = 'Cannot find master po file:' + LineEnding + '%s' + LineEnding + 'for selected file' + LineEnding + '%s'; - sNotAProperFileName = 'Selected filename' + LineEnding + '%s' + LineEnding + 'does not seem to be a proper name for a po-file'; - sErrorOnCreate = 'Error creating an instance of TPoFamily:' + LineEnding + '%s'; - sErrorOnCleanup = 'An unrecoverable error occurred' + LineEnding + '%s' + LineEnding + 'Please close the program'; - - sTotalErrors = 'Total errors / warnings found: %d'; - sTotalWarnings = 'Total warnings found: %d'; - //sNoErrorsFound = 'No errors found.'; - sNoTestSelected = 'There are no tests selected.'; - var PoCheckerForm: TPoCheckerForm; @@ -102,9 +89,17 @@ end; procedure TPoCheckerForm.FormCreate(Sender: TObject); begin + Caption := sGUIPoFileCheckingTool; + SelectTestLabel.Caption := sSelectTestTypes; + FindAllPOsCheckBox.Caption := sFindAllTranslatedPoFiles; + OpenBtn.Caption := sOpenAPoFile; + RunBtn.Caption := sRunSelectedTests; + NoErrLabel.Caption := sNoErrorsFound; FillTestListBox; ClearAndDisableStatusPanel; NoErrLabel.Visible := False; + CurTestHeaderLabel.Caption := sCurrentTest; + CurPoHeaderLabel.Caption := sCurrentPoFile; end; procedure TPoCheckerForm.FormDestroy(Sender: TObject); @@ -168,8 +163,16 @@ procedure TPoCheckerForm.FillTestListBox; var Opt: TPoTestOption; begin - for Opt := Low(PoTestOptionNames) to High(PoTestOptionNames) do - TestListBox.Items.Add(PoTestOptionNames[Opt]); + for Opt := Low(PoTestOptionNames) to Pred(High(PoTestOptionNames)) do + case Opt of + ptoCheckNrOfItems: TestListBox.Items.Add(sCheckNumberOfItems); + ptoCheckFormatArgs: TestListBox.Items.Add(sCheckForIncompatibleFormatArguments); + ptoCheckMissingIdentifiers: TestListBox.Items.Add(sCheckMissingIdentifiers); + ptoCheckMismatchedOriginals: TestListBox.Items.Add(sCheckForMismatchesInUntranslatedStrings); + ptoCheckDuplicateOriginals: TestListBox.Items.Add(sCheckForDuplicateUntranslatedValues); + else + TestListBox.Items.Add(PoTestOptionNames[Opt]); + end; SelectAllCheckBox.Caption := sSelectAllTests; end; @@ -179,7 +182,7 @@ var Index: Integer; begin Result := []; - for Opt := Low(TpoTestOption) to High(TPoTestOption) do + for Opt := Low(TpoTestOption) to Pred(High(TPoTestOption)) do begin Index := Ord(Opt); if (Index < TestListBox.Count) then @@ -188,6 +191,8 @@ begin Result := Result + [Opt]; end; end; + if FindAllPOsCheckBox.Checked then + Result := Result + [High(TPoTestOption)]; end; procedure TPoCheckerForm.ShowError(const Msg: String); diff --git a/components/pochecker/pofamilies.pp b/components/pochecker/pofamilies.pp index 885a09ef0c..17e74d63c1 100644 --- a/components/pochecker/pofamilies.pp +++ b/components/pochecker/pofamilies.pp @@ -9,7 +9,7 @@ interface uses Classes, SysUtils, LCLProc, FileUtil, StringHashList, //{$IFDEF UNIX}{$IFNDEF DisableCWString}, cwstring{$ENDIF}{$ENDIF}, - SimplePoFiles; + SimplePoFiles, pocheckerconsts; Type @@ -99,37 +99,18 @@ const Divider = '-------------------------------------------------------'; -resourcestring - sOriginal = 'Original'; - sTranslation = 'Translation'; - sErrorsByTest = 'Errors / warnings reported by %s for:'; - sCheckFormatArgs = 'CheckFormatArgs'; - sCheckMissingIdentifiers = 'CheckMissingIdentifiers'; - sCheckNrOfItems = 'CheckNrOfItems'; - sCheckMismatchedOriginals = 'CheckMismatchedOriginals'; - sCheckDuplicateOriginals = 'CheckDuplicateOriginals'; - sIncompatibleFormatArgs = '[Line: %d] Incompatible format() arguments for:' ; - - sNrErrorsFound = 'Found %d errors.'; - sNrWarningsFound = 'Found %d warnings.'; - sLineInFileName = '[Line %d] in %s:'; - sIdentifierNotFoundIn = 'Identifier [%s] not found in %s'; - sMissingMasterIdentifier = 'Identifier [%s] found in %s, but it does not exist in %s'; - sLineNr = '[Line: %d]'; - sFormatArgsID = '%s %s'; sFormatArgsValues = '%s%s" (= %s)'; - sNrOfItemsMisMatch = 'Mismatch in number of items for master and child'; - sNrOfItemsMismatchM = '%s: %d items'; - sNrOfItemsMismatchC = '%s: %d items'; - sMismatchOriginalsID = '%s'; sMismatchOriginalsM = '%s: %s'; sMismatchOriginalsC = '%s: %s'; - sDuplicateOriginals = 'The (untranslated) value "%s" is used for more than 1 entry:'; - sDuplicateLineNrWithValue = '[Line %d] %s'; + sCheckFormatArgs = 'CheckFormatArgs'; + sCheckNrOfItems = 'CheckNrOfItems'; + sCheckMissingIdentifiers = 'CheckMissingIdentifiers'; + sCheckMismatchedOriginals = 'CheckMismatchedOriginals'; + sCheckDuplicateOriginals = 'CheckDuplicateOriginals'; //Helper functions @@ -338,8 +319,8 @@ begin ErrorLog.Add(Divider); ErrorLog.Add(''); ErrorLog.Add(sNrOfItemsMismatch); - ErrorLog.Add(Format(sNrOfItemsMismatchM,[ShortMasterName,FMaster.Count])); - ErrorLog.Add(Format(sNrOfItemsMismatchC,[ShortChildName,FChild.Count])); + ErrorLog.Add(Format(sNrOfItemsMismatchD,[ShortMasterName,FMaster.Count])); + ErrorLog.Add(Format(sNrOfItemsMismatchD,[ShortChildName,FChild.Count])); ErrorLog.Add(Divider); ErrorLog.Add(''); ErrorLog.Add(''); diff --git a/components/pochecker/resultdlg.lfm b/components/pochecker/resultdlg.lfm index 86f34628f5..fbf7886890 100644 --- a/components/pochecker/resultdlg.lfm +++ b/components/pochecker/resultdlg.lfm @@ -27,10 +27,10 @@ object ResultDlgForm: TResultDlgForm object CloseBtn: TBitBtn AnchorSideRight.Control = Panel1 AnchorSideRight.Side = asrBottom - Left = 661 + Left = 643 Height = 26 Top = 12 - Width = 71 + Width = 89 Anchors = [akRight] AutoSize = True BorderSpacing.Right = 10 @@ -41,10 +41,10 @@ object ResultDlgForm: TResultDlgForm end object SaveBtn: TBitBtn AnchorSideRight.Control = CloseBtn - Left = 553 + Left = 534 Height = 26 Top = 12 - Width = 98 + Width = 99 Anchors = [akRight] AutoSize = True BorderSpacing.Around = 10 @@ -90,10 +90,10 @@ object ResultDlgForm: TResultDlgForm end object CopyBtn: TBitBtn AnchorSideRight.Control = SaveBtn - Left = 416 + Left = 395 Height = 26 Top = 12 - Width = 127 + Width = 129 Anchors = [akRight] AutoSize = True BorderSpacing.Around = 10 @@ -668,6 +668,16 @@ object ResultDlgForm: TResultDlgForm ReadOnly = True ScrollBars = ssAutoBoth BracketHighlightStyle = sbhsBoth + BracketMatchColor.Background = clNone + BracketMatchColor.Foreground = clNone + BracketMatchColor.Style = [fsBold] + FoldedCodeColor.Background = clNone + FoldedCodeColor.Foreground = clGray + FoldedCodeColor.FrameColor = clGray + MouseLinkColor.Background = clNone + MouseLinkColor.Foreground = clBlue + LineHighlightColor.Background = clNone + LineHighlightColor.Foreground = clNone inline SynLeftGutterPartList1: TSynGutterPartList object SynGutterLineNumber1: TSynGutterLineNumber Width = 17 diff --git a/components/pochecker/resultdlg.pp b/components/pochecker/resultdlg.pp index 89d9b36ee4..8f594f30a9 100644 --- a/components/pochecker/resultdlg.pp +++ b/components/pochecker/resultdlg.pp @@ -6,7 +6,8 @@ interface uses Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, - ExtCtrls, Buttons, ClipBrd, LCLType, LCLProc, SynEdit, SynHighlighterPo; + ExtCtrls, Buttons, ClipBrd, LCLType, LCLProc, SynEdit, SynHighlighterPo, + pocheckerconsts; type @@ -38,16 +39,11 @@ implementation {$R *.lfm} -ResourceString - sSaveError = 'Error saving file:' + LineEnding + '%s'; - sSaveCaption = 'Save to file'; - sCopyCaption = 'Copy to clipboard'; - - { TResultDlgForm } procedure TResultDlgForm.FormCreate(Sender: TObject); begin + Caption := sResults; LogMemo.Lines.Clear; LogMemo.Align := alClient; FLog := TStringList.Create;