Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supported Languages #2463

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/System Application/App/Language/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,12 @@
{
"from": 535,
"to": 535
},
{
"from": 3563,
"to": 3563
}
],
"target": "OnPrem",
"contextSensitiveHelpUrl": "https://learn.microsoft.com/dynamics365/business-central/"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace System.Globalization;

/// <summary>
/// This permission set allows editing of the list of languages.
/// This permission set allows editing of the list of languages and supported languages.
/// </summary>
permissionset 43 "Language - Edit"
{
Expand All @@ -15,5 +15,6 @@ permissionset 43 "Language - Edit"

IncludedPermissionSets = "Language - View";

Permissions = tabledata Language = IMD;
Permissions = tabledata "Allowed Language" = IMD,
tabledata Language = IMD;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ permissionset 164 "Language - Objects"
Access = Internal;
Assignable = false;

Permissions = page Languages = X,
Permissions = page "Allowed Languages" = X,
page Languages = X,
page "Windows Languages" = X;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// ------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// ------------------------------------------------------------------------------------------------

namespace System.Globalization;

/// <summary>
/// Table that contains a list of specific application languages available for the users. If the table is empty, then all installed application languages will be available.
/// </summary>
table 3563 "Allowed Language"
{
Caption = 'Allowed Language';
DataClassification = SystemMetadata;
DataPerCompany = false;
InherentEntitlements = X;
InherentPermissions = X;

fields
{
field(1; "Language Id"; Integer)
{
Caption = 'Language Id';
NotBlank = true;
BlankZero = true;
TableRelation = "Windows Language" where("Localization Exist" = const(true), "Globally Enabled" = const(true));
ToolTip = 'Specifies the language id(s) that should be available for this environment.';
}
field(2; Language; Text[80])
{
Caption = 'Language';
Editable = false;
FieldClass = FlowField;
CalcFormula = lookup("Windows Language".Name where("Language ID" = field("Language Id")));
ToolTip = 'Specifies the language that should be available for this environment.';
}
}

keys
{
key(PK; "Language Id")
{
Clustered = true;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// ------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// ------------------------------------------------------------------------------------------------

namespace System.Globalization;

/// <summary>
/// Page that shows the list of allows languages which is enabled for this environment. If nothing is specified, then the user will be able to use all available languages.
/// </summary>
page 3563 "Allowed Languages"
{
Caption = 'Allowed Languages';
PageType = List;
ApplicationArea = All;
UsageCategory = Administration;
SourceTable = "Allowed Language";
HelpLink = 'https://go.microsoft.com/fwlink/?linkid=2149387';
AdditionalSearchTerms = 'company,role center,role,language';
AboutTitle = 'About allowed languages.';
AboutText = 'Define a list of allowed languages which is enabled for this environment. If nothing is specified, then the user will be able to use all available languages.';
Permissions = tabledata "Allowed Language" = r;

layout
{
area(Content)
{
repeater(AllowedLanguages)
{
field("Language Id"; Rec."Language Id")
{ }
JesperSchulz marked this conversation as resolved.
Show resolved Hide resolved
field(Language; Rec.Language)
{ }
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@
namespace System.Globalization;

using System;
using System.Environment.Configuration;
using System.Environment;
using System.Environment.Configuration;

codeunit 54 "Language Impl."
{
Access = Internal;
SingleInstance = true;
InherentEntitlements = X;
InherentPermissions = X;
Permissions = tabledata Language = rimd,
Permissions = tabledata "Allowed Language" = rimd,
tabledata Language = rimd,
tabledata "Language Selection" = r,
tabledata "User Personalization" = rm,
tabledata "Windows Language" = r;
Expand Down Expand Up @@ -151,18 +152,38 @@ codeunit 54 "Language Impl."

procedure GetApplicationLanguages(var TempWindowsLanguage: Record "Windows Language" temporary)
var
AllowedLanguage: Record "Allowed Language";
WindowsLanguage: Record "Windows Language";
LanguageFilter: Text;
begin
AllowedLanguage.ReadIsolation := IsolationLevel::ReadCommitted;
AllowedLanguage.LoadFields("Language Id");
if AllowedLanguage.FindSet() then
repeat
AddToFilter(Format(AllowedLanguage."Language Id"), LanguageFilter);
until AllowedLanguage.Next() = 0;

WindowsLanguage.ReadIsolation := IsolationLevel::ReadCommitted;
if LanguageFilter <> '' then
WindowsLanguage.SetFilter("Language ID", LanguageFilter);

WindowsLanguage.SetRange("Localization Exist", true);
WindowsLanguage.SetRange("Globally Enabled", true);

if WindowsLanguage.FindSet() then
repeat
TempWindowsLanguage := WindowsLanguage;
TempWindowsLanguage.Insert();
until WindowsLanguage.Next() = 0;
end;

local procedure AddToFilter(Value: Text; var ValueFilter: Text)
begin
if ValueFilter = '' then
ValueFilter := Value
else
ValueFilter += '|' + Value;
end;

procedure GetDefaultApplicationLanguageId(): Integer
begin
exit(1033); // en-US
Expand Down Expand Up @@ -248,14 +269,16 @@ codeunit 54 "Language Impl."

procedure LookupWindowsLanguageId(var LanguageId: Integer)
var
WindowsLanguage: Record "Windows Language";
TempWindowsLanguage: Record "Windows Language" temporary;
begin
WindowsLanguage.SetCurrentKey(Name);
GetApplicationLanguages(TempWindowsLanguage);

TempWindowsLanguage.SetCurrentKey(Name);

if WindowsLanguage.Get(LanguageId) then;
if TempWindowsLanguage.Get(LanguageId) then;

if Page.RunModal(Page::"Windows Languages", WindowsLanguage) = Action::LookupOK then
LanguageId := WindowsLanguage."Language ID";
if Page.RunModal(Page::"Windows Languages", TempWindowsLanguage) = Action::LookupOK then
LanguageId := TempWindowsLanguage."Language ID";
end;

procedure GetParentLanguageId(LanguageId: Integer) ParentLanguageId: Integer
Expand Down
4 changes: 2 additions & 2 deletions src/System Application/App/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"name": "System Application Test Library",
"publisher": "Microsoft"
},
{
{
"id": "1a3ac64b-0e25-2345-8e9b-eab2a74b9e9a",
"name": "Agent Developer Toolkit",
"publisher": "Microsoft"
Expand All @@ -47,4 +47,4 @@
"includeSourceInSymbolFile": true
},
"contextSensitiveHelpUrl": "https://learn.microsoft.com/dynamics365/business-central/"
}
}
Loading