Skip to content

Commit 465fbdf

Browse files
committed
Skip ResXFileRef entries in resx parsing
File references (icons, images, sounds) with type="System.Resources.ResXFileRef" are now excluded from parsing as they are not translatable strings. This fixes false "missing translation" reports when analyzing projects like ShareX that store both text strings and binary resource references in the same .resx file.
1 parent 36eeb98 commit 465fbdf

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

LocalizationManager.Core/Backends/Resx/ResxResourceReader.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,14 @@ private static ResourceFile ParseXDocument(XDocument xdoc, LanguageInfo language
108108

109109
foreach (var dataElement in dataElements)
110110
{
111+
// Skip file/binary references (icons, images, sounds, etc.)
112+
// These have type="System.Resources.ResXFileRef, ..." and should not be translated
113+
var typeAttr = dataElement.Attribute("type");
114+
if (typeAttr != null && typeAttr.Value.Contains("ResXFileRef"))
115+
{
116+
continue;
117+
}
118+
111119
var key = dataElement.Attribute("name")?.Value;
112120
if (string.IsNullOrEmpty(key))
113121
{

vscode-extension/src/parsers/resxDocumentParser.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ export class ResxDocumentParser implements IResourceDocumentParser {
2424

2525
let match;
2626
while ((match = this.dataBlockRegex.exec(text)) !== null) {
27+
// Skip file/binary references (icons, images, sounds, etc.)
28+
// These have type="System.Resources.ResXFileRef" and should not be translated
29+
if (match[0].includes('type="System.Resources.ResXFileRef')) {
30+
continue;
31+
}
32+
2733
const keyName = match[1];
2834
const blockContent = match[2];
2935
const startIndex = match.index;

0 commit comments

Comments
 (0)