Business Central 2023 wave 1 (BC22) new features: New Language Selection table (2000000050)

Dynamics 365 Business Central

Hi, Readers.
Dynamics 365 Business Central 2023 wave 1 (BC22) is generally available yesterday. More details: Dynamics 365 Business Central 2023 release wave 1 (BC22)

I will continue to test and share some new features that I hope will be helpful.

In this post, I would like to talk about New Language Selection table. This new feature is not mentioned in the 2023 wave1 release plan, but it is in Business Central Launch Event (2023 release wave 1) and AL Language extension changelog version 11.0.

New virtual table to support Language selection
The following virtual table is added to allow drop-down selection of languages and regions in pages (and request page):

  • Language Selection (ID 2000000050)
    • This table contains information about languages display name, language ID, culture tag, and application enabled. Primary key is “Name” (the display name).
https://marketplace.visualstudio.com/items/ms-dynamics-smb.al/changelog

In multi-language development, Language IDs (1041,1033…) and Locale IDs (ja-JP,en-US…) are what every developer should know.

We have discussed this before:

We can use table Windows Language (2000000045) to get Language IDs, and then use procedure LanguageIDToCultureName() in codeunit 10 “Type Helper” to get Locale IDs

Source Code:

page 50101 "Windows Language"
{
    ApplicationArea = All;
    Caption = 'Windows Language';
    PageType = List;
    SourceTable = "Windows Language";
    UsageCategory = Lists;
    Editable = false;
    layout
    {
        area(content)
        {
            repeater(General)
            {
                field("Language ID"; Rec."Language ID")
                {
                    ToolTip = 'Specifies the unique language ID for the Windows language.';
                    ApplicationArea = All;
                }
                field("Primary Language ID"; Rec."Primary Language ID")
                {
                    ToolTip = 'Specifies the value of the Primary Language ID field.';
                    ApplicationArea = All;
                }
                field(Name; Rec.Name)
                {
                    ToolTip = 'Specifies the names of the available Windows languages.';
                    ApplicationArea = All;
                }
                field("Abbreviated Name"; Rec."Abbreviated Name")
                {
                    ToolTip = 'Specifies the value of the Abbreviated Name field.';
                    ApplicationArea = All;
                }
                field(LocaleIDs; LocaleIDs)
                {
                    Caption = 'Locale ID/Culture Name';
                    ApplicationArea = All;
                }
            }
        }
    }
    var
        LocaleIDs: Text[20];
    trigger OnAfterGetRecord()
    var
        TypeHelper: Codeunit "Type Helper";
    begin
        LocaleIDs := TypeHelper.LanguageIDToCultureName(Rec."Language ID");
    end;
}

With this wave, this is changed. Microsoft has new virtual table to support Language selection for us, table 2000000050 “Language Selection”

Language Tag: https://www.w3.org/International/articles/language-tags/

PS: In the previous versions

Note that you cannot view this virtual table directly. More details: Viewing Table Data

And system and virtual tables can’t be extended. More details: Table Object

The system or virtual table ‘Language Selection’ cannot be extended.

But here is a little trick, you can use this table to create a new page that can display the data in the virtual table.
For example,

Then you can see Language IDs (1041,1033…) and Language Tag/Locale IDs (ja-JP,en-US…)

Source Code:

page 50101 "Language Selection Page"
{
    ApplicationArea = All;
    Caption = 'Language Selection Page';
    PageType = List;
    SourceTable = "Language Selection";
    UsageCategory = Lists;

    layout
    {
        area(content)
        {
            repeater(General)
            {
                field(Name; Rec.Name)
                {
                    ToolTip = 'Specifies the value of the Name field.';
                }
                field("Language ID"; Rec."Language ID")
                {
                    ToolTip = 'Specifies the value of the Language ID field.';
                }
                field("Primary Language ID"; Rec."Primary Language ID")
                {
                    ToolTip = 'Specifies the value of the Primary Language ID field.';
                }
                field("Abbreviated Name"; Rec."Abbreviated Name")
                {
                    ToolTip = 'Specifies the value of the Abbreviated Name field.';
                }
                field(Enabled; Rec.Enabled)
                {
                    ToolTip = 'Specifies the value of the Enabled field.';
                }
                field("Language Tag"; Rec."Language Tag")
                {
                    ToolTip = 'Specifies the value of the Language Tag field.';
                }
            }
        }
    }
}

Another point to note is that Name is the primary key in the table.

Very nice! Give it a try!!!😁

PS: This new table also facilitates the use of the new feature below.
Business Central 2023 wave 1 (BC22) new features: Define regional settings per report using a region property

Business Central Launch Event (2023 release wave 1) 
Session: What’s new in VS Code and AL (It is recommended to check out the Business Central Launch Event directly to learn more about new features)

END

Hope this will help.

Thanks for reading.

ZHU

コメント

Copied title and URL