mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-07-23 08:45:55 +02:00
POChecker: removed unused ExtractLanguageFromChildName function and eliminated code duplication in ExtractMasterNameFromChildName function
git-svn-id: trunk@60251 -
This commit is contained in:
parent
ec7a5c0cd1
commit
370f9a57e6
@ -138,7 +138,6 @@ Type
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function ExtractMasterNameFromChildName(const AChildName: String): String;
|
function ExtractMasterNameFromChildName(const AChildName: String): String;
|
||||||
function ExtractLanguageFromChildName(const AChildName: string): TLangID;
|
|
||||||
procedure LocalizePoTestTypeNames;
|
procedure LocalizePoTestTypeNames;
|
||||||
|
|
||||||
const
|
const
|
||||||
@ -174,42 +173,16 @@ const
|
|||||||
|
|
||||||
function ExtractMasterNameFromChildName(const AChildName: String): String;
|
function ExtractMasterNameFromChildName(const AChildName: String): String;
|
||||||
{
|
{
|
||||||
Pre condition: AChildName is like: somename.some_language_specifier.po
|
Input: AChildName is like: somename.some_language_specifier.po
|
||||||
Post condition: Result = somename.po
|
Output: Result = somename.pot
|
||||||
}
|
}
|
||||||
var
|
var
|
||||||
Ext: String;
|
CurUnitName: String;
|
||||||
EndSep: Set of Char;
|
CurLang: String;
|
||||||
Len: Integer;
|
|
||||||
begin
|
begin
|
||||||
EndSep := AllowDirectorySeparators + AllowDriveSeparators + [ExtensionSeparator];
|
Result := '';
|
||||||
Ext := ExtractFileExt(AChildName);
|
if GetPOFilenameParts(AChildName, CurUnitName, CurLang) then
|
||||||
Result := Copy(AChildName, 1, Length(AChildName) - Length(Ext));
|
Result := CurUnitName + ExtensionSeparator + 'pot';
|
||||||
Len := Length(Result);
|
|
||||||
While (Len > 0) and (not (Result[Len] in EndSep)) do Dec(Len);
|
|
||||||
|
|
||||||
//debugln('Len = ',DbgS(Len));
|
|
||||||
//debugln('Length(Result) = ',DbgS(Length(result)));
|
|
||||||
//if Len > 0 then debugln('Result[Len] = ',Result[len]);
|
|
||||||
|
|
||||||
if (Len > 1) and (Len < Length(Result)) and (Result[Len] = ExtensionSeparator) then
|
|
||||||
Result := Copy(Result, 1, Len - 1) + ExtensionSeparator + 'pot'
|
|
||||||
else
|
|
||||||
Result := '';
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ExtractLanguageFromChildName(const AChildName: string): TLangID;
|
|
||||||
Var
|
|
||||||
Mn, Abbr: string;
|
|
||||||
P1,P2: Integer;
|
|
||||||
begin
|
|
||||||
Mn := ExtractMasterNameFromChildName(AChildName);
|
|
||||||
Mn := ExtractFileNameWithoutExt(Mn);
|
|
||||||
P1 := Length(Mn);
|
|
||||||
P2 := Length(AChildName);
|
|
||||||
Abbr := Copy(AChildName,P1+2,P2-(P1+1));
|
|
||||||
Abbr := ExtractFileNameWithoutExt(Abbr);
|
|
||||||
Result := LangAbbrToLangId(Abbr);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure LocalizePoTestTypeNames;
|
procedure LocalizePoTestTypeNames;
|
||||||
|
Loading…
Reference in New Issue
Block a user