mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-19 13:21:46 +02:00
LazUtils: if existing item being updated has empty translation, search for possible translation variants just like for newly added item. This should allow to avoid the need to do two regenerations of .po files in a row in some cases.
git-svn-id: trunk@56967 -
This commit is contained in:
parent
65d289f941
commit
7c33223dae
@ -1643,7 +1643,7 @@ procedure TPOFile.UpdateItem(const Identifier: string; Original: string);
|
||||
end;
|
||||
|
||||
var
|
||||
Item: TPOFileItem;
|
||||
Item, ItemTmp: TPOFileItem;
|
||||
AContext,AComment,ATranslation,AFlags,APrevStr: string;
|
||||
SetFuzzy: boolean;
|
||||
begin
|
||||
@ -1666,6 +1666,26 @@ begin
|
||||
end;
|
||||
Item.Original:=Original;
|
||||
Item.Tag:=FTag;
|
||||
if Item.Translation = '' then
|
||||
begin
|
||||
ItemTmp := TPOFileItem(FOriginalToItem.Data[Original]);
|
||||
if ItemTmp <> nil then
|
||||
begin
|
||||
// if old item is already translated use translation
|
||||
if ItemTmp.Translation<>'' then
|
||||
begin
|
||||
// if old item doesn't have context, add one
|
||||
if ItemTmp.Context='' then
|
||||
ItemTmp.Context := ItemTmp.IdentifierLow;
|
||||
// if current item doesn't have context, add one
|
||||
if Item.Context='' then
|
||||
Item.Context := Item.IdentifierLow;
|
||||
Item.Translation := ItemTmp.Translation;
|
||||
Item.ModifyFlag(sFuzzyFlag, true);
|
||||
FModified := True;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
VerifyItemFormatting(Item);
|
||||
exit;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user