diff --git a/packages/fcl-res/src/rcparser.pas b/packages/fcl-res/src/rcparser.pas index b68016041a..a9e887db3f 100644 --- a/packages/fcl-res/src/rcparser.pas +++ b/packages/fcl-res/src/rcparser.pas @@ -266,7 +266,7 @@ begin yyval := yyv[yysp-1]; end; 63 : begin - aktresource.LangID:= MakeLangID(yyv[yysp-2].yyrcnumtype.v, yyv[yysp-0].yyrcnumtype.v); + change_lang_id(MakeLangID(yyv[yysp-2].yyrcnumtype.v, yyv[yysp-0].yyrcnumtype.v)); end; 64 : begin aktresource.Characteristics:= yyv[yysp-0].yyrcnumtype.v; diff --git a/packages/fcl-res/src/rcparser.y b/packages/fcl-res/src/rcparser.y index 515f4f53e0..3fe3072524 100644 --- a/packages/fcl-res/src/rcparser.y +++ b/packages/fcl-res/src/rcparser.y @@ -145,7 +145,7 @@ suboptions ; suboption - : _LANGUAGE numpos ',' numpos { aktresource.LangID:= MakeLangID($2.v, $4.v); } + : _LANGUAGE numpos ',' numpos { change_lang_id(MakeLangID($2.v, $4.v)); } | _CHARACTERISTICS numpos { aktresource.Characteristics:= $2.v; } | _VERSION numpos { aktresource.Version:= $2.v; } | _MOVEABLE { aktresource.MemoryFlags:= aktresource.MemoryFlags or MF_MOVEABLE; } diff --git a/packages/fcl-res/src/rcparserfn.inc b/packages/fcl-res/src/rcparserfn.inc index 3636bb2790..b982df034f 100644 --- a/packages/fcl-res/src/rcparserfn.inc +++ b/packages/fcl-res/src/rcparserfn.inc @@ -295,6 +295,14 @@ begin create_resource(aId, nil, cls); end; +procedure change_lang_id(newlang: TLangID); +begin + // cannot change a language id while it is contained in a list, so remove and re-add + aktresources.Remove(aktresource); + aktresource.LangID:= newlang; + aktresources.Add(aktresource); +end; + procedure raw_write_string(Stream: TMemoryStream; str: rcstrtype); var i: integer;