Skip to content

Fix translation comment parsing to use updated developer notes from g.xlf#531

Draft
Copilot wants to merge 3 commits into
mainfrom
copilot/fix-issue-526
Draft

Fix translation comment parsing to use updated developer notes from g.xlf#531
Copilot wants to merge 3 commits into
mainfrom
copilot/fix-issue-526

Conversation

Copilot AI commented Nov 15, 2025

Copy link
Copy Markdown
Contributor

Translation comments in AL code (e.g., Comment = 'DEU="Translation"') were not applied when source text changed, requiring up to 4 refresh runs to eventually pick up the new translation.

Root Cause

addTranslationIfFound() parsed translation comments from the stale developer note in the existing XLF file instead of the current developer note from the generated g.xlf file.

Changes

src/XliffFunctions.ts

  • Parse translation regex match from gTransUnit.developerNoteContent() instead of langTransUnit.developerNoteContent()
  • Remove matched comment from gTransUnit.developerNote().textContent to maintain consistency

src/test/bugs/526.test.ts

  • Test translation update when source changes
  • Test translation pickup for new trans-units
  • Test single-run stability (no repeated refreshes needed)

Example

// Before: Checked old note, missed updated translations
const matchResult = langTransUnit.developerNoteContent().match(regex);

// After: Checks current note from g.xlf
const matchResult = gTransUnit.developerNoteContent().match(regex);

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • main.vscode-cdn.net
    • Triggering command: /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --no-sandbox --crashpad-handler-pid=4633 --enable-crash-reporter=d534ed92-7ded-4fe7-af13-38c69f5d39ac,no_channel --user-data-dir=/home/REDACTED/work/nab-al-tools/nab-al-tools/extension/.vscode-test/user-data --standard-schemes=vscode-webview,vscode-file --secure-schemes=vscode-webview,vscode-file --cors-schemes=vscode-webview,vscode-file --fetch-schemes=vscode-webview,vscode-file --service-worker-schemes=vscode-webview --code-cache-schemes=vscode-webview,vscode-file --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,13601525828189025339,14784169998167285601,262144 --enable-features=DocumentPolicyIncludeJSCallStacksInCrashReports,EarlyEstablishGpuChannel,EstablishGpuChannelAsync --disable-features=CalculateNativeWinOcclusion,FontationsLinuxSystemFonts,ScreenAIOCREnabled,SpareRendererForSitePerProcess --variations-seed-version (dns block)
    • Triggering command: /home/REDACTED/work/nab-al-tools/nab-al-tools/extension/.vscode-test/vscode-linux-x64-1.106.0/code /home/REDACTED/work/nab-al-tools/nab-al-tools/test-app/TestApp.code-workspace --disable-extensions --skip-welcome --skip-release-notes --disable-workspace-trust --no-sandbox --disable-gpu-sandbox --disable-updates --skip-welcome --skip-release-notes --disable-workspace-trust --extensionTestsPath=/home/REDACTED/work/nab-al-tools/nab-al-tools/extension/out/test/suite/index --extensionDevelopmentPath=/home/REDACTED/work/nab-al-tools/nab-al-tools/extension --extensions-dir=/home/REDACTED/work/nab-al-tools/nab-al-tools/extension/.vscode-test/extensions --user-data-dir=/home/REDACTED/work/nab-al-tools/nab-al-tools/extension/.vscode-test/user-data (dns block)
    • Triggering command: /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --no-sandbox --crashpad-handler-pid=5262 --enable-crash-reporter=d534ed92-7ded-4fe7-af13-38c69f5d39ac,no_channel --user-data-dir=/home/REDACTED/work/nab-al-tools/nab-al-tools/extension/.vscode-test/user-data --standard-schemes=vscode-webview,vscode-file --secure-schemes=vscode-webview,vscode-file --cors-schemes=vscode-webview,vscode-file --fetch-schemes=vscode-webview,vscode-file --service-worker-schemes=vscode-webview --code-cache-schemes=vscode-webview,vscode-file --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,13447346082135577572,5030536373148666354,262144 --enable-features=DocumentPolicyIncludeJSCallStacksInCrashReports,EarlyEstablishGpuChannel,EstablishGpuChannelAsync --disable-features=CalculateNativeWinOcclusion,FontationsLinuxSystemFonts,ScreenAIOCREnabled,SpareRendererForSitePerProcess --variations-seed-version (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

fix #526


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: jwikman <23032645+jwikman@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issue #526 Fix translation comment parsing to use updated developer notes from g.xlf Nov 15, 2025
Copilot AI requested a review from jwikman November 15, 2025 20:51
@jwikman

jwikman commented Nov 15, 2025

Copy link
Copy Markdown
Owner

@copilot I think there was two problems reported in that issue. Make sure that you address all problems in the issue

Copilot AI commented Nov 15, 2025

Copy link
Copy Markdown
Contributor Author

@copilot I think there was two problems reported in that issue. Make sure that you address all problems in the issue

The fix addresses both problems reported in issue #526:

  1. Translation not picked up when source changes: Fixed by checking gTransUnit.developerNoteContent() instead of langTransUnit.developerNoteContent() to get the updated translation from the comment.

  2. Multiple runs needed (4 runs → 1 run): This was caused by the same root issue. Since the translation wasn't applied on the first run, the developer note kept being updated on subsequent runs until it eventually converged. Now it works correctly on the first run.

The test "Multiple runs should not cause unnecessary changes" verifies that subsequent runs produce no changes, confirming both issues are resolved (commit 4e0a3c3).

@jwikman jwikman removed their assignment Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NAB only suggests translations for language comments with additional info

2 participants