microsoft / AL

Home of the Dynamics 365 Business Central AL Language extension for Visual Studio Code. Used to track issues regarding the latest version of the AL compiler and developer tools available in the Visual Studio Code Marketplace or as part of the AL Developer Preview builds for Dynamics 365 Business Central.
MIT License
724 stars 241 forks source link

Support for multiple extensions to same target introduce the translations bug #7790

Open zabcik opened 2 weeks ago

zabcik commented 2 weeks ago

1. Describe the bug

When using multiple table extensions to same table then translations does not work correctly. Only first table extension is translated.

It is probably due to bad "trans-unit id" in XLF file.

2. To Reproduce

Steps to reproduce the behavior:

  1. Go to 'AL: Go' - Create new project "ALProject".
  2. Add feature "TranslationFile" in manifest file app.json.
  3. Copy source code bellow.
  4. Compile project.
  5. Create translation file "ALProject.cs-CZ.xlf" (target-language="cs-CZ") and translate all.
  6. Publish project.
  7. See page Customers and last columns - there are not translated fields...
namespace DefaultNamespace;

using Microsoft.Sales.Customer;

tableextension 50101 CustomerExt1 extends Customer
{
    fields
    {
        field(50001; "Welcome Message 1"; Text[50])
        {
            Caption = 'Welcome Message 1';
        }
    }
}

tableextension 50102 CustomerExt2 extends Customer
{
    fields
    {
        field(50002; "Welcome Message 2"; Text[50])
        {
            Caption = 'Welcome Message 2';
        }
    }
}

pageextension 50101 CustomerList extends "Customer List"
{
    layout
    {
        addlast(Control1)
        {
            field("Welcome Message 1"; Rec."Welcome Message 1")
            {
                ApplicationArea = All;
                ToolTip = 'Specifies the value of the Welcome Message 1 field.';
            }
            field("Welcome Message 2"; Rec."Welcome Message 2")
            {
                ApplicationArea = All;
                ToolTip = 'Specifies the value of the Welcome Message 2 field.';
            }
        }
    }
}
<?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
  <file datatype="xml" source-language="en-US" target-language="cs-CZ" original="ALProject5">
    <body>
      <group id="body">
        <trans-unit id="PageExtension 363045002 - Control 1245603148 - Property 1295455071" size-unit="char" translate="yes" xml:space="preserve" al-object-target="Page 2901867346">
          <source>Specifies the value of the Welcome Message 1 field.</source>
          <target state="translated">Ur??uje hodnotu pole Uv??tac?? zpr??va 1.</target>
          <note from="Developer" annotates="general" priority="2"></note>
          <note from="Xliff Generator" annotates="general" priority="3">PageExtension CustomerList - Control Welcome Message 1 - Property ToolTip</note>
        </trans-unit>
        <trans-unit id="PageExtension 363045002 - Control 1883299765 - Property 1295455071" size-unit="char" translate="yes" xml:space="preserve" al-object-target="Page 2901867346">
          <source>Specifies the value of the Welcome Message 2 field.</source>
          <target state="translated">Ur??uje hodnotu pole Uv??tac?? zpr??va 2.</target>
          <note from="Developer" annotates="general" priority="2"></note>
          <note from="Xliff Generator" annotates="general" priority="3">PageExtension CustomerList - Control Welcome Message 2 - Property ToolTip</note>
        </trans-unit>
        <trans-unit id="TableExtension 3520207680 - Field 1245603148 - Property 2879900210" size-unit="char" translate="yes" xml:space="preserve" al-object-target="Table 1994964448">
          <source>Welcome Message 1</source>
          <target state="translated">Uv??tac?? zpr??va 1</target>
          <note from="Developer" annotates="general" priority="2"></note>
          <note from="Xliff Generator" annotates="general" priority="3">TableExtension CustomerExt1 - Field Welcome Message 1 - Property Caption</note>
        </trans-unit>
        <trans-unit id="TableExtension 3520207680 - Field 1883299765 - Property 2879900210" size-unit="char" translate="yes" xml:space="preserve" al-object-target="Table 1994964448">
          <source>Welcome Message 2</source>
          <target state="translated">Uv??tac?? zpr??va 2</target>
          <note from="Developer" annotates="general" priority="2"></note>
          <note from="Xliff Generator" annotates="general" priority="3">TableExtension CustomerExt2 - Field Welcome Message 2 - Property Caption</note>
        </trans-unit>
      </group>
    </body>
  </file>
</xliff>

image

image

3. Expected behavior

The all fields from all table extension are translated.

4. Actual behavior

Only fields from first table extension are translated.

5. Versions:

NKarolak commented 2 weeks ago

Thanks for bringing this also to my attention - I am currently splitting my objects, and only now I'm seeing that I'm affected as well. It also affects page extensions. The first page extension caption changes are considered, the second page extension (in my case for an action) is not.

@BazookaMusic Losing translations is a major issue for every AppSource developer. It would be good to give this issue some higher priority.

BazookaMusic commented 2 weeks ago

I'll accept this as it's clearly a bug across compiler and runtime and has direct customer impact

ChrisBlankDe commented 2 weeks ago

Microsoft does not fully follow the xliff standard when creating the *.g.xlf we use to copy. The original attribute in the file node should contain a file name, not the app name. If you reference the g file in the node both translations will be shown.

-  <file datatype="xml" source-language="en-US" target-language="de-DE" original="Awesome App" tool-id="MultilingualAppToolkit" product-name="n/a" product-version="n/a" build-num="n/a">
+  <file datatype="xml" source-language="en-US" target-language="de-DE" original="Awesome App.g.xlf" tool-id="MultilingualAppToolkit" product-name="n/a" product-version="n/a" build-num="n/a">

Colleagues created a support request ~a view weeks ago~ in may '24.