mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-07 01:57:57 +02:00
PoChecker:
- Refactor Statistics (makes it easier to implement a graphical display in the future) - Less verbosity - Debug and Release mode for po-checker tool - Regenerated language files git-svn-id: trunk@46150 -
This commit is contained in:
parent
2725568fae
commit
5bd58e3e95
@ -18,8 +18,38 @@
|
||||
<VersionInfo>
|
||||
<StringTable ProductVersion=""/>
|
||||
</VersionInfo>
|
||||
<BuildModes Count="1">
|
||||
<Item1 Name="Default" Default="True"/>
|
||||
<BuildModes Count="2">
|
||||
<Item1 Name="Release" Default="True"/>
|
||||
<Item2 Name="Debug">
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="pochecker"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<OtherUnitFiles Value=".."/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<CodeGeneration>
|
||||
<Checks>
|
||||
<IOChecks Value="True"/>
|
||||
<RangeChecks Value="True"/>
|
||||
<OverflowChecks Value="True"/>
|
||||
<StackChecks Value="True"/>
|
||||
</Checks>
|
||||
</CodeGeneration>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<UseHeaptrc Value="True"/>
|
||||
</Debugging>
|
||||
</Linking>
|
||||
<Other>
|
||||
<CustomOptions Value="-dPoCheckerStandAlone"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
</Item2>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
|
@ -175,15 +175,21 @@ msgid "Original"
|
||||
msgstr "Originál"
|
||||
|
||||
#: pocheckerconsts.spercfuzzy
|
||||
msgid "Fuzzy strings: %2.0f%%."
|
||||
#, fuzzy
|
||||
#| msgid "Fuzzy strings: %2.0f%%."
|
||||
msgid "%s: %4.1f%% fuzzy strings."
|
||||
msgstr "Nepřesné překlady: %2.0f%%."
|
||||
|
||||
#: pocheckerconsts.sperctranslated
|
||||
msgid "Translated strings: %2.0f%%."
|
||||
#, fuzzy
|
||||
#| msgid "Translated strings: %2.0f%%."
|
||||
msgid "%s: %4.1f%% translated strings."
|
||||
msgstr "Přeloženo: %2.0f%%."
|
||||
|
||||
#: pocheckerconsts.spercuntranslated
|
||||
msgid "Untranslated strings: %2.0f%%."
|
||||
#, fuzzy
|
||||
#| msgid "Untranslated strings: %2.0f%%."
|
||||
msgid "%s: %4.1f%% untranslated strings."
|
||||
msgstr "Nepřeloženo: %2.0f%%."
|
||||
|
||||
#: pocheckerconsts.sresults
|
||||
@ -235,7 +241,9 @@ msgid "Translation"
|
||||
msgstr "Překlad"
|
||||
|
||||
#: pocheckerconsts.stranslationstatistics
|
||||
msgid "Translation statistics for:"
|
||||
#, fuzzy
|
||||
#| msgid "Translation statistics for:"
|
||||
msgid "Translation statistics per language:"
|
||||
msgstr "Statistiky překladu pro:"
|
||||
|
||||
#: pocheckerconsts.sunselectalltests
|
||||
|
@ -172,15 +172,21 @@ msgid "Original"
|
||||
msgstr "Original"
|
||||
|
||||
#: pocheckerconsts.spercfuzzy
|
||||
msgid "Fuzzy strings: %2.0f%%."
|
||||
#, fuzzy
|
||||
#| msgid "Fuzzy strings: %2.0f%%."
|
||||
msgid "%s: %4.1f%% fuzzy strings."
|
||||
msgstr "Ungeklärte Zeichenketten: %2.0f%%."
|
||||
|
||||
#: pocheckerconsts.sperctranslated
|
||||
msgid "Translated strings: %2.0f%%."
|
||||
#, fuzzy
|
||||
#| msgid "Translated strings: %2.0f%%."
|
||||
msgid "%s: %4.1f%% translated strings."
|
||||
msgstr "Übersetzte Zeichenketten: %2.0f%%."
|
||||
|
||||
#: pocheckerconsts.spercuntranslated
|
||||
msgid "Untranslated strings: %2.0f%%."
|
||||
#, fuzzy
|
||||
#| msgid "Untranslated strings: %2.0f%%."
|
||||
msgid "%s: %4.1f%% untranslated strings."
|
||||
msgstr "Nicht übersetzte Zeichenketten: %2.0f%%."
|
||||
|
||||
#: pocheckerconsts.sresults
|
||||
@ -231,7 +237,9 @@ msgid "Translation"
|
||||
msgstr "Übersetzung"
|
||||
|
||||
#: pocheckerconsts.stranslationstatistics
|
||||
msgid "Translation statistics for:"
|
||||
#, fuzzy
|
||||
#| msgid "Translation statistics for:"
|
||||
msgid "Translation statistics per language:"
|
||||
msgstr "Übersetzungsstatistik für:"
|
||||
|
||||
#: pocheckerconsts.sunselectalltests
|
||||
|
@ -172,15 +172,15 @@ msgid "Original"
|
||||
msgstr "Original"
|
||||
|
||||
#: pocheckerconsts.spercfuzzy
|
||||
msgid "Fuzzy strings: %2.0f%%."
|
||||
msgid "%s: %4.1f%% fuzzy strings."
|
||||
msgstr ""
|
||||
|
||||
#: pocheckerconsts.sperctranslated
|
||||
msgid "Translated strings: %2.0f%%."
|
||||
msgid "%s: %4.1f%% translated strings."
|
||||
msgstr ""
|
||||
|
||||
#: pocheckerconsts.spercuntranslated
|
||||
msgid "Untranslated strings: %2.0f%%."
|
||||
msgid "%s: %4.1f%% untranslated strings."
|
||||
msgstr ""
|
||||
|
||||
#: pocheckerconsts.sresults
|
||||
@ -232,7 +232,7 @@ msgid "Translation"
|
||||
msgstr "Traducción"
|
||||
|
||||
#: pocheckerconsts.stranslationstatistics
|
||||
msgid "Translation statistics for:"
|
||||
msgid "Translation statistics per language:"
|
||||
msgstr ""
|
||||
|
||||
#: pocheckerconsts.sunselectalltests
|
||||
|
@ -172,15 +172,21 @@ msgid "Original"
|
||||
msgstr "Eredeti"
|
||||
|
||||
#: pocheckerconsts.spercfuzzy
|
||||
msgid "Fuzzy strings: %2.0f%%."
|
||||
#, fuzzy
|
||||
#| msgid "Fuzzy strings: %2.0f%%."
|
||||
msgid "%s: %4.1f%% fuzzy strings."
|
||||
msgstr "Bizonytalan szövegek: %2.0f%%."
|
||||
|
||||
#: pocheckerconsts.sperctranslated
|
||||
msgid "Translated strings: %2.0f%%."
|
||||
#, fuzzy
|
||||
#| msgid "Translated strings: %2.0f%%."
|
||||
msgid "%s: %4.1f%% translated strings."
|
||||
msgstr "Lefordított szövegek: %2.0f%%."
|
||||
|
||||
#: pocheckerconsts.spercuntranslated
|
||||
msgid "Untranslated strings: %2.0f%%."
|
||||
#, fuzzy
|
||||
#| msgid "Untranslated strings: %2.0f%%."
|
||||
msgid "%s: %4.1f%% untranslated strings."
|
||||
msgstr "Lefordítatlan szövegek: %2.0f%%."
|
||||
|
||||
#: pocheckerconsts.sresults
|
||||
@ -231,7 +237,9 @@ msgid "Translation"
|
||||
msgstr "Fordítás"
|
||||
|
||||
#: pocheckerconsts.stranslationstatistics
|
||||
msgid "Translation statistics for:"
|
||||
#, fuzzy
|
||||
#| msgid "Translation statistics for:"
|
||||
msgid "Translation statistics per language:"
|
||||
msgstr "Fordítási statisztika ehhez:"
|
||||
|
||||
#: pocheckerconsts.sunselectalltests
|
||||
|
@ -170,15 +170,21 @@ msgid "Original"
|
||||
msgstr "Originale"
|
||||
|
||||
#: pocheckerconsts.spercfuzzy
|
||||
msgid "Fuzzy strings: %2.0f%%."
|
||||
#, fuzzy
|
||||
#| msgid "Fuzzy strings: %2.0f%%."
|
||||
msgid "%s: %4.1f%% fuzzy strings."
|
||||
msgstr "Stringhe incerte: %2.0f%%."
|
||||
|
||||
#: pocheckerconsts.sperctranslated
|
||||
msgid "Translated strings: %2.0f%%."
|
||||
#, fuzzy
|
||||
#| msgid "Translated strings: %2.0f%%."
|
||||
msgid "%s: %4.1f%% translated strings."
|
||||
msgstr "Stringhe tradotte: %2.0f%%."
|
||||
|
||||
#: pocheckerconsts.spercuntranslated
|
||||
msgid "Untranslated strings: %2.0f%%."
|
||||
#, fuzzy
|
||||
#| msgid "Untranslated strings: %2.0f%%."
|
||||
msgid "%s: %4.1f%% untranslated strings."
|
||||
msgstr "Stringhe non tradotte: %2.0f%%."
|
||||
|
||||
#: pocheckerconsts.sresults
|
||||
@ -228,7 +234,9 @@ msgid "Translation"
|
||||
msgstr "Traduzione"
|
||||
|
||||
#: pocheckerconsts.stranslationstatistics
|
||||
msgid "Translation statistics for:"
|
||||
#, fuzzy
|
||||
#| msgid "Translation statistics for:"
|
||||
msgid "Translation statistics per language:"
|
||||
msgstr "Statistiche di traduzione per:"
|
||||
|
||||
#: pocheckerconsts.sunselectalltests
|
||||
|
@ -172,15 +172,21 @@ msgid "Original"
|
||||
msgstr "原文"
|
||||
|
||||
#: pocheckerconsts.spercfuzzy
|
||||
msgid "Fuzzy strings: %2.0f%%."
|
||||
#, fuzzy
|
||||
#| msgid "Fuzzy strings: %2.0f%%."
|
||||
msgid "%s: %4.1f%% fuzzy strings."
|
||||
msgstr "未確定文字列:%2.0f%%"
|
||||
|
||||
#: pocheckerconsts.sperctranslated
|
||||
msgid "Translated strings: %2.0f%%."
|
||||
#, fuzzy
|
||||
#| msgid "Translated strings: %2.0f%%."
|
||||
msgid "%s: %4.1f%% translated strings."
|
||||
msgstr "翻訳された文字列:%2.0f%%"
|
||||
|
||||
#: pocheckerconsts.spercuntranslated
|
||||
msgid "Untranslated strings: %2.0f%%."
|
||||
#, fuzzy
|
||||
#| msgid "Untranslated strings: %2.0f%%."
|
||||
msgid "%s: %4.1f%% untranslated strings."
|
||||
msgstr "未翻訳文字列:%2.0f%%"
|
||||
|
||||
#: pocheckerconsts.sresults
|
||||
@ -232,7 +238,9 @@ msgid "Translation"
|
||||
msgstr "訳文"
|
||||
|
||||
#: pocheckerconsts.stranslationstatistics
|
||||
msgid "Translation statistics for:"
|
||||
#, fuzzy
|
||||
#| msgid "Translation statistics for:"
|
||||
msgid "Translation statistics per language:"
|
||||
msgstr "翻訳状況:"
|
||||
|
||||
#: pocheckerconsts.sunselectalltests
|
||||
|
@ -174,15 +174,15 @@ msgid "Original"
|
||||
msgstr "Originalas"
|
||||
|
||||
#: pocheckerconsts.spercfuzzy
|
||||
msgid "Fuzzy strings: %2.0f%%."
|
||||
msgid "%s: %4.1f%% fuzzy strings."
|
||||
msgstr ""
|
||||
|
||||
#: pocheckerconsts.sperctranslated
|
||||
msgid "Translated strings: %2.0f%%."
|
||||
msgid "%s: %4.1f%% translated strings."
|
||||
msgstr ""
|
||||
|
||||
#: pocheckerconsts.spercuntranslated
|
||||
msgid "Untranslated strings: %2.0f%%."
|
||||
msgid "%s: %4.1f%% untranslated strings."
|
||||
msgstr ""
|
||||
|
||||
#: pocheckerconsts.sresults
|
||||
@ -232,7 +232,7 @@ msgid "Translation"
|
||||
msgstr "Vertimas"
|
||||
|
||||
#: pocheckerconsts.stranslationstatistics
|
||||
msgid "Translation statistics for:"
|
||||
msgid "Translation statistics per language:"
|
||||
msgstr ""
|
||||
|
||||
#: pocheckerconsts.sunselectalltests
|
||||
|
@ -150,15 +150,15 @@ msgid "Original"
|
||||
msgstr ""
|
||||
|
||||
#: pocheckerconsts.spercfuzzy
|
||||
msgid "Fuzzy strings: %2.0f%%."
|
||||
msgid "%s: %4.1f%% fuzzy strings."
|
||||
msgstr ""
|
||||
|
||||
#: pocheckerconsts.sperctranslated
|
||||
msgid "Translated strings: %2.0f%%."
|
||||
msgid "%s: %4.1f%% translated strings."
|
||||
msgstr ""
|
||||
|
||||
#: pocheckerconsts.spercuntranslated
|
||||
msgid "Untranslated strings: %2.0f%%."
|
||||
msgid "%s: %4.1f%% untranslated strings."
|
||||
msgstr ""
|
||||
|
||||
#: pocheckerconsts.sresults
|
||||
@ -204,7 +204,7 @@ msgid "Translation"
|
||||
msgstr ""
|
||||
|
||||
#: pocheckerconsts.stranslationstatistics
|
||||
msgid "Translation statistics for:"
|
||||
msgid "Translation statistics per language:"
|
||||
msgstr ""
|
||||
|
||||
#: pocheckerconsts.sunselectalltests
|
||||
|
@ -172,15 +172,15 @@ msgid "Original"
|
||||
msgstr "Original"
|
||||
|
||||
#: pocheckerconsts.spercfuzzy
|
||||
msgid "Fuzzy strings: %2.0f%%."
|
||||
msgid "%s: %4.1f%% fuzzy strings."
|
||||
msgstr ""
|
||||
|
||||
#: pocheckerconsts.sperctranslated
|
||||
msgid "Translated strings: %2.0f%%."
|
||||
msgid "%s: %4.1f%% translated strings."
|
||||
msgstr ""
|
||||
|
||||
#: pocheckerconsts.spercuntranslated
|
||||
msgid "Untranslated strings: %2.0f%%."
|
||||
msgid "%s: %4.1f%% untranslated strings."
|
||||
msgstr ""
|
||||
|
||||
#: pocheckerconsts.sresults
|
||||
@ -232,7 +232,7 @@ msgid "Translation"
|
||||
msgstr "Tradução"
|
||||
|
||||
#: pocheckerconsts.stranslationstatistics
|
||||
msgid "Translation statistics for:"
|
||||
msgid "Translation statistics per language:"
|
||||
msgstr ""
|
||||
|
||||
#: pocheckerconsts.sunselectalltests
|
||||
|
@ -171,15 +171,21 @@ msgid "Original"
|
||||
msgstr "Исходная строка"
|
||||
|
||||
#: pocheckerconsts.spercfuzzy
|
||||
msgid "Fuzzy strings: %2.0f%%."
|
||||
#, fuzzy
|
||||
#| msgid "Fuzzy strings: %2.0f%%."
|
||||
msgid "%s: %4.1f%% fuzzy strings."
|
||||
msgstr "Неточные строки: %2.0f%%."
|
||||
|
||||
#: pocheckerconsts.sperctranslated
|
||||
msgid "Translated strings: %2.0f%%."
|
||||
#, fuzzy
|
||||
#| msgid "Translated strings: %2.0f%%."
|
||||
msgid "%s: %4.1f%% translated strings."
|
||||
msgstr "Переведённые строки: %2.0f%%."
|
||||
|
||||
#: pocheckerconsts.spercuntranslated
|
||||
msgid "Untranslated strings: %2.0f%%."
|
||||
#, fuzzy
|
||||
#| msgid "Untranslated strings: %2.0f%%."
|
||||
msgid "%s: %4.1f%% untranslated strings."
|
||||
msgstr "Непереведённые строки: %2.0f%%."
|
||||
|
||||
#: pocheckerconsts.sresults
|
||||
@ -230,7 +236,9 @@ msgid "Translation"
|
||||
msgstr "Перевод"
|
||||
|
||||
#: pocheckerconsts.stranslationstatistics
|
||||
msgid "Translation statistics for:"
|
||||
#, fuzzy
|
||||
#| msgid "Translation statistics for:"
|
||||
msgid "Translation statistics per language:"
|
||||
msgstr "Статистика перевода для:"
|
||||
|
||||
#: pocheckerconsts.sunselectalltests
|
||||
|
@ -171,15 +171,15 @@ msgid "Original"
|
||||
msgstr "Оригінал"
|
||||
|
||||
#: pocheckerconsts.spercfuzzy
|
||||
msgid "Fuzzy strings: %2.0f%%."
|
||||
msgid "%s: %4.1f%% fuzzy strings."
|
||||
msgstr ""
|
||||
|
||||
#: pocheckerconsts.sperctranslated
|
||||
msgid "Translated strings: %2.0f%%."
|
||||
msgid "%s: %4.1f%% translated strings."
|
||||
msgstr ""
|
||||
|
||||
#: pocheckerconsts.spercuntranslated
|
||||
msgid "Untranslated strings: %2.0f%%."
|
||||
msgid "%s: %4.1f%% untranslated strings."
|
||||
msgstr ""
|
||||
|
||||
#: pocheckerconsts.sresults
|
||||
@ -229,7 +229,7 @@ msgid "Translation"
|
||||
msgstr "Переклад"
|
||||
|
||||
#: pocheckerconsts.stranslationstatistics
|
||||
msgid "Translation statistics for:"
|
||||
msgid "Translation statistics per language:"
|
||||
msgstr ""
|
||||
|
||||
#: pocheckerconsts.sunselectalltests
|
||||
|
@ -36,7 +36,7 @@ resourcestring
|
||||
sOriginal = 'Original';
|
||||
sTranslation = 'Translation';
|
||||
sErrorsByTest = 'Errors / warnings reported by %s for:';
|
||||
sTranslationStatistics = 'Translation statistics for:';
|
||||
sTranslationStatistics = 'Translation statistics per language:';
|
||||
sCheckNumberOfItems = 'Check number of items';
|
||||
sCheckForIncompatibleFormatArguments = 'Check for incompatible format '
|
||||
+'arguments';
|
||||
@ -65,9 +65,9 @@ resourcestring
|
||||
sDuplicateOriginals = 'The (untranslated) value "%s" is used for more than 1 entry:';
|
||||
|
||||
sDuplicateLineNrWithValue = '[Line %d] %s';
|
||||
sPercTranslated = 'Translated strings: %2.0f%%.';
|
||||
sPercUntranslated = 'Untranslated strings: %2.0f%%.';
|
||||
sPercFuzzy = 'Fuzzy strings: %2.0f%%.';
|
||||
sPercTranslated = '%s: %4.1f%% translated strings.';
|
||||
sPercUntranslated = '%s: %4.1f%% untranslated strings.';
|
||||
sPercFuzzy = '%s: %4.1f%% fuzzy strings.';
|
||||
implementation
|
||||
|
||||
end.
|
||||
|
@ -107,6 +107,7 @@ begin
|
||||
{$IFDEF POCHECKERSTANDALONE}
|
||||
//Initializing translation
|
||||
Lang := GetEnvironmentVariableUTF8('LANG');
|
||||
T := '';
|
||||
if Lang = '' then
|
||||
LCLGetLanguageIDs(Lang, T);
|
||||
if Lang <> '' then
|
||||
@ -203,11 +204,10 @@ end;
|
||||
|
||||
|
||||
procedure TPoCheckerForm.OnTestEnd(const ATestName: string; const ErrorCount: integer);
|
||||
|
||||
begin
|
||||
//CurTestLabel.Caption := '';
|
||||
//CurPoLabel.Caption := '';
|
||||
debugln('OnTestEnd [', ATestName, ']: ErrorCount = ', DbgS(ErrorCount));
|
||||
//debugln('OnTestEnd [', ATestName, ']: ErrorCount = ', DbgS(ErrorCount));
|
||||
//Application.ProcessMessages;
|
||||
end;
|
||||
|
||||
|
@ -7,7 +7,7 @@ unit PoFamilies;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LCLProc, FileUtil, StringHashList,
|
||||
Classes, SysUtils, LCLProc, FileUtil, StringHashList, ContNrs, Math,
|
||||
//{$IFDEF UNIX}{$IFNDEF DisableCWString}, cwstring{$ENDIF}{$ENDIF},
|
||||
SimplePoFiles, pocheckerconsts;
|
||||
|
||||
@ -38,6 +38,8 @@ Type
|
||||
TTestStartEvent = procedure(const ATestName, APoFileName: String) of object;
|
||||
TTestEndEvent = procedure(const ATestName: String; const ErrorCount: Integer) of object;
|
||||
|
||||
TPoFamilyStats = class;
|
||||
|
||||
TPoFamily = class
|
||||
private
|
||||
FMaster: TSimplePoFile;
|
||||
@ -46,6 +48,7 @@ Type
|
||||
FChildName: String;
|
||||
FOnTestStart: TTestStartEvent;
|
||||
FOnTestEnd: TTestEndEvent;
|
||||
FPoFamilyStats: TPoFamilyStats;
|
||||
procedure SetChildName(AValue: String);
|
||||
procedure SetMasterName(AValue: String);
|
||||
function GetShortMasterName: String;
|
||||
@ -65,7 +68,7 @@ Type
|
||||
procedure CheckMissingIdentifiers(out ErrorCount: Integer; ErrorLog: TStrings);
|
||||
procedure CheckMismatchedOriginals(out ErrorCount: Integer; ErrorLog: TStrings);
|
||||
procedure CheckDuplicateOriginals(out WarningCount: Integer; ErrorLog: TStrings);
|
||||
procedure CheckStatistics(out WarningCount: Integer; ErrorLog: TStrings);
|
||||
procedure CheckStatistics;
|
||||
|
||||
public
|
||||
procedure RunTests(const TestTypes: TPoTestTypes; const TestOptions: TPoTestOptions;
|
||||
@ -75,12 +78,50 @@ Type
|
||||
property Child: TSimplePoFile read FChild;
|
||||
property MasterName: String read FMasterName write SetMasterName;
|
||||
property ChildName: String read FChildName write SetChildName;
|
||||
property PoFamilyStats: TPoFamilyStats read FPoFamilyStats;
|
||||
property ShortMasterName: String read GetShortMasterName;
|
||||
property ShortChildName: String read GetShortChildName;
|
||||
property OnTestStart: TTestStartEvent read FOnTestStart write FOnTestStart;
|
||||
property OnTestEnd: TTestEndEvent read FOnTestEnd write FOnTestEnd;
|
||||
end;
|
||||
|
||||
{ TPoFamilyStats }
|
||||
|
||||
{ TStat }
|
||||
|
||||
TStat = class
|
||||
private
|
||||
FPoName: String;
|
||||
FNrTotal: Integer;
|
||||
FNrTranslated: Integer;
|
||||
FNrUnTranslated: Integer;
|
||||
FNrFuzzy: Integer;
|
||||
public
|
||||
constructor Create(APoName: String; ANrTotal, ANrTranslated, ANrUntranslated, ANrFuzzy: Integer);
|
||||
property PoName: string read FPoName;
|
||||
property NrTotal: Integer read FNrTotal;
|
||||
property NrTranslated: Integer read FNrTranslated;
|
||||
property NrUnTranslated: Integer read FNrUnTranslated;
|
||||
property NrFuzzy: Integer read FNrFuzzy;
|
||||
function PercTranslated: Double;
|
||||
function PercUnTranslated: Double;
|
||||
function PercFuzzy: Double;
|
||||
end;
|
||||
|
||||
TPoFamilyStats = class
|
||||
private
|
||||
FList: TFPObjectList;
|
||||
function GetCount: Integer;
|
||||
public
|
||||
procedure Clear;
|
||||
procedure Add(AName: String; ANrTotal, ANrTranslated, ANrUnTranslated, ANrFuzzy: Integer);
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
procedure AddStatisticsToLog(ALog: TStrings);
|
||||
|
||||
property Count: Integer read GetCount;
|
||||
end;
|
||||
|
||||
function ExtractFormatArgs(S: String; out ArgumentError: Integer): String;
|
||||
function IsMasterPoName(const Fn: String): Boolean;
|
||||
function ExtractMasterNameFromChildName(const AChildName: String): String;
|
||||
@ -271,6 +312,95 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TStat }
|
||||
|
||||
constructor TStat.Create(APoName: String; ANrTotal, ANrTranslated, ANrUntranslated, ANrFuzzy: Integer);
|
||||
begin
|
||||
FPoName := APoName;
|
||||
FNrTotal := ANrTotal;
|
||||
FNrTranslated := ANrTranslated;
|
||||
FNrUntranslated := ANrUntranslated;
|
||||
FNrFuzzy := ANrFuzzy;
|
||||
end;
|
||||
|
||||
function TStat.PercTranslated: Double;
|
||||
begin
|
||||
Result := 100 * (FNrTranslated / FNrTotal);
|
||||
end;
|
||||
|
||||
function TStat.PercUnTranslated: Double;
|
||||
begin
|
||||
Result := 100 * (FNrUnTranslated / FNrTotal);
|
||||
end;
|
||||
|
||||
function TStat.PercFuzzy: Double;
|
||||
begin
|
||||
Result := 100 * (FNrFuzzy / FNrTotal);
|
||||
end;
|
||||
|
||||
{ TPoFamilyStats }
|
||||
|
||||
function TPoFamilyStats.GetCount: Integer;
|
||||
begin
|
||||
Result := FList.Count;
|
||||
end;
|
||||
|
||||
procedure TPoFamilyStats.Clear;
|
||||
begin
|
||||
FList.Clear;
|
||||
end;
|
||||
|
||||
procedure TPoFamilyStats.Add(AName: String; ANrTotal, ANrTranslated, ANrUnTranslated, ANrFuzzy: Integer);
|
||||
begin
|
||||
FList.Add(TStat.Create(AName, ANrTotal, ANrTranslated, ANrUntranslated, ANrFuzzy));
|
||||
end;
|
||||
|
||||
constructor TPoFamilyStats.Create;
|
||||
begin
|
||||
FList := TFPObjectList.Create(True);
|
||||
end;
|
||||
|
||||
destructor TPoFamilyStats.Destroy;
|
||||
begin
|
||||
FList.Free;
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TPoFamilyStats.AddStatisticsToLog(ALog: TStrings);
|
||||
var
|
||||
i: Integer;
|
||||
Stat: TStat;
|
||||
function Bar(Nr, Total: Integer; RoundDown: Boolean): String;
|
||||
const
|
||||
Max = 50;
|
||||
var
|
||||
Count: Integer;
|
||||
begin
|
||||
if RoundDown then
|
||||
Count := Floor(Max * (Nr/Total))
|
||||
else
|
||||
Count := Ceil(Max * (Nr/Total));
|
||||
Result := StringOfChar('x', Count);
|
||||
Result := Result + StringOfChar(#32, Max - Count);
|
||||
end;
|
||||
begin
|
||||
if (FList.Count = 0) then Exit;
|
||||
ALog.Add(Divider);
|
||||
ALog.Add(sTranslationStatistics);
|
||||
ALog.Add('');
|
||||
for i := 0 to FList.Count - 1 do
|
||||
begin
|
||||
Stat := TStat(FList.Items[i]);
|
||||
ALog.Add(Stat.PoName);
|
||||
ALog.Add(Format(sPercTranslated,[Bar(Stat.NrTranslated, Stat.NrTotal, True),Stat.PercTranslated]));
|
||||
ALog.Add(Format(sPercUntranslated,[Bar(Stat.NrUnTranslated, Stat.NrTotal, False), Stat.PercUnTranslated]));
|
||||
ALog.Add(Format(sPercFuzzy,[Bar(Stat.NrFuzzy, Stat.NrTotal, False), Stat.PercFuzzy]));
|
||||
ALog.Add('');
|
||||
ALog.Add('');
|
||||
end;
|
||||
ALog.Add(Divider);
|
||||
end;
|
||||
|
||||
{ TPoFamily }
|
||||
|
||||
procedure TPoFamily.SetMasterName(AValue: String);
|
||||
@ -338,12 +468,14 @@ begin
|
||||
FChildName := AChildName;
|
||||
//debugln('TPoFamily.Create: created ',FChildName);
|
||||
end;
|
||||
FPoFamilyStats := TPoFamilyStats.Create;
|
||||
end;
|
||||
|
||||
destructor TPoFamily.Destroy;
|
||||
begin
|
||||
if Assigned(FMaster) then FMaster.Free;
|
||||
if Assigned(FChild) then FChild.Free;
|
||||
FPoFamilyStats.Free;
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
@ -595,24 +727,21 @@ begin
|
||||
//debugln('TPoFamily.CheckDuplicateOriginals: ',Dbgs(WarningCount),' Errors');
|
||||
end;
|
||||
|
||||
procedure TPoFamily.CheckStatistics(out WarningCount: Integer; ErrorLog: TStrings);
|
||||
procedure TPoFamily.CheckStatistics;
|
||||
var
|
||||
i: Integer;
|
||||
CPoItem: TPOFileItem;
|
||||
NrTranslated, NrUntranslated, NrFuzzy, NrTotal: Integer;
|
||||
begin
|
||||
//debugln('TPoFamily.CheckFormatArgs');
|
||||
//debugln('TPoFamily.CheckStatistics');
|
||||
DoTestStart(sCheckStatistics, ShortChildName);
|
||||
NrTranslated := 0;
|
||||
NrUntranslated := 0;
|
||||
NrFuzzy := 0;
|
||||
//for i := 0 to FMaster.Count - 1 do
|
||||
for i := 0 to FChild.Count - 1 do
|
||||
begin
|
||||
//debugln(' i = ',DbgS(i));
|
||||
//MPoItem := FMaster.PoItems[i];
|
||||
CPoItem := FChild.PoItems[i];
|
||||
//CPoItem := FChild.FindPoItem(MPoItem.Identifier);
|
||||
if Assigned(CPoItem) then
|
||||
begin
|
||||
if (Length(CPoItem.Translation) > 0) then
|
||||
@ -631,17 +760,9 @@ begin
|
||||
NrTotal := NrTranslated + NrUntranslated + NrFuzzy;
|
||||
if (NrTotal > 0) then
|
||||
begin
|
||||
ErrorLog.Add(Divider);
|
||||
ErrorLog.Add(sTranslationStatistics);
|
||||
ErrorLog.Add(ShortChildName);
|
||||
ErrorLog.Add(Format(sPercTranslated,[100.0*(NrTranslated/NrTotal)]));
|
||||
ErrorLog.Add(Format(sPercUntranslated,[100.0*(NrUntranslated/NrTotal)]));
|
||||
ErrorLog.Add(Format(sPercFuzzy,[100.0*(NrFuzzy/NrTotal)]));
|
||||
ErrorLog.Add('');
|
||||
ErrorLog.Add('');
|
||||
FPoFamilyStats.Add(ShortChildName, NrTotal, NrTranslated, NrUntranslated, NrFuzzy);
|
||||
end;
|
||||
WarningCount := NrTotal;
|
||||
DoTestEnd(PoTestTypeNames[pttCheckFormatArgs], WarningCount);
|
||||
DoTestEnd(PoTestTypeNames[pttCheckFormatArgs], 0);
|
||||
//debugln('TPoFamily.CheckIncompatibleFormatArgs: ',Dbgs(ErrorCount),' Errors');
|
||||
end;
|
||||
|
||||
@ -661,6 +782,7 @@ var
|
||||
S: String;
|
||||
begin
|
||||
SL := nil;
|
||||
FPoFamilyStats.Clear;
|
||||
ErrorCount := NoError;
|
||||
WarningCount := NoError;
|
||||
if (not Assigned(FMaster)) and (not Assigned(FChild)) then
|
||||
@ -773,10 +895,11 @@ begin
|
||||
ErrorCount := CurrErrCnt + ErrorCount;
|
||||
end;
|
||||
|
||||
|
||||
//Always run this as the last test please
|
||||
if (pttCheckStatistics in TestTypes) then
|
||||
begin
|
||||
CheckStatistics(CurrErrCnt, ErrorLog);
|
||||
ErrorCount := CurrErrCnt + ErrorCount;
|
||||
CheckStatistics;
|
||||
end;
|
||||
{
|
||||
if (ptt in TestTypes) then
|
||||
@ -786,6 +909,11 @@ begin
|
||||
end;
|
||||
}
|
||||
end;
|
||||
//Add statistics at the end of the log
|
||||
if (pttCheckStatistics in TestTypes) and (FPoFamilyStats.Count > 0) then
|
||||
begin
|
||||
FPoFamilyStats.AddStatisticsToLog(ErrorLog);
|
||||
end;
|
||||
finally
|
||||
SL.Free;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user