From 40c16a417817a052eed4415219ad3538d0b3d76e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20Hartvig=20Gr=C3=B8nbech?= Date: Thu, 8 Feb 2024 10:49:28 +0100 Subject: [PATCH 1/8] add integration events --- .../App/Language/src/Language.Codeunit.al | 25 +++++++++++++++++++ .../App/Language/src/LanguageImpl.Codeunit.al | 12 +++++++++ 2 files changed, 37 insertions(+) diff --git a/src/System Application/App/Language/src/Language.Codeunit.al b/src/System Application/App/Language/src/Language.Codeunit.al index 777a3aa11f..9d0139afc7 100644 --- a/src/System Application/App/Language/src/Language.Codeunit.al +++ b/src/System Application/App/Language/src/Language.Codeunit.al @@ -270,5 +270,30 @@ codeunit 43 Language internal procedure OnGetUserLanguageCode(var UserLanguageCode: Code[10]; var Handled: Boolean) begin end; + + /// + /// Integration event, emitted from . + /// Subscribe to this event to change language id returned by GetLanguageIdOrDefault. + /// + /// + /// Language code that GetLanguageIdOrDefault was provided with. + /// Exit parameter that holds the language id set by function. + /// True when this event is handled. + [IntegrationEvent(false, false)] + internal procedure OnGetLanguageIdOrDefault(LanguageCode: Code[10]; var LanguageId: Integer; var Handled: Boolean) + begin + end; + + /// + /// Integration event, emitted from . + /// Subscribe to this event to change format region returned by GetFormatRegionOrDefault. + /// + /// + /// Exit parameter that holds the format region returned by function. + /// True when this event is handled. + [IntegrationEvent(false, false)] + internal procedure OnGetFormatRegionOrDefault(var FormatRegion: Text[80]; var Handled: Boolean) + begin + end; } diff --git a/src/System Application/App/Language/src/LanguageImpl.Codeunit.al b/src/System Application/App/Language/src/LanguageImpl.Codeunit.al index 6beb860cc9..c4d7b847f1 100644 --- a/src/System Application/App/Language/src/LanguageImpl.Codeunit.al +++ b/src/System Application/App/Language/src/LanguageImpl.Codeunit.al @@ -36,8 +36,14 @@ codeunit 54 "Language Impl." procedure GetLanguageIdOrDefault(LanguageCode: Code[10]): Integer; var + Language: Codeunit Language; LanguageId: Integer; + Handled: Boolean; begin + Language.OnGetLanguageIdOrDefault(LanguageCode, LanguageId, Handled); + if Handled then + exit(LanguageId); + LanguageId := GetLanguageId(LanguageCode); if LanguageId = 0 then @@ -49,9 +55,15 @@ codeunit 54 "Language Impl." procedure GetFormatRegionOrDefault(FormatRegion: Text[80]): Text[80] var LanguageSelection: Record "Language Selection"; + Language: Codeunit Language; UserSessionSettings: SessionSettings; LocalId: Integer; + Handled: Boolean; begin + Language.OnGetFormatRegionOrDefault(FormatRegion, Handled); + if Handled then + exit(FormatRegion); + if FormatRegion <> '' then exit(FormatRegion); From c99020c89052cf757d2f4775a546ccc0d4bb236a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20Hartvig=20Gr=C3=B8nbech?= Date: Wed, 14 Feb 2024 09:03:37 +0100 Subject: [PATCH 2/8] add override functions --- .../App/Language/src/Language.Codeunit.al | 61 +++++++++++-------- .../App/Language/src/LanguageImpl.Codeunit.al | 27 ++++---- 2 files changed, 52 insertions(+), 36 deletions(-) diff --git a/src/System Application/App/Language/src/Language.Codeunit.al b/src/System Application/App/Language/src/Language.Codeunit.al index 9d0139afc7..46763ece44 100644 --- a/src/System Application/App/Language/src/Language.Codeunit.al +++ b/src/System Application/App/Language/src/Language.Codeunit.al @@ -67,6 +67,42 @@ codeunit 43 Language exit(LanguageImpl.GetLanguageId(LanguageCode)); end; + /// + /// Sets an override for the language ID. + /// This function is used to override the default or user-selected language ID. + /// Once set, the system will return this language ID for any subsequent calls to `GetLanguageIdOrDefault` method, until the override is cleared. + /// + /// The language ID that should be used as an override. + /// + /// + /// LanguageImpl.SetOverrideLanguageId(1031); // Sets the override language ID to German (1031) + /// + /// + procedure SetOverrideLanguageId(LanguageId: Integer) + var + LanguageImpl: Codeunit "Language Impl."; + begin + LanguageImpl.SetOverrideLanguageId(LanguageId); + end; + + /// + /// Sets an override for the format region. + /// This function is used to override the default or user-selected format region. + /// Once set, the system will return this format region for any subsequent calls to `GetFormatRegionOrDefault` method, until the override is cleared. + /// + /// The format region that should be used as an override. + /// + /// + /// LanguageImpl.SetOverrideFormatRegion("de-DE"); // Sets the override format region to German (de-DE) + /// + /// + procedure SetOverrideFormatRegion(FormatRegion: Text[80]) + var + LanguageImpl: Codeunit "Language Impl."; + begin + LanguageImpl.SetOverrideFormatRegion(FormatRegion); + end; + /// /// Gets the code for a language based on its ID. /// @@ -270,30 +306,5 @@ codeunit 43 Language internal procedure OnGetUserLanguageCode(var UserLanguageCode: Code[10]; var Handled: Boolean) begin end; - - /// - /// Integration event, emitted from . - /// Subscribe to this event to change language id returned by GetLanguageIdOrDefault. - /// - /// - /// Language code that GetLanguageIdOrDefault was provided with. - /// Exit parameter that holds the language id set by function. - /// True when this event is handled. - [IntegrationEvent(false, false)] - internal procedure OnGetLanguageIdOrDefault(LanguageCode: Code[10]; var LanguageId: Integer; var Handled: Boolean) - begin - end; - - /// - /// Integration event, emitted from . - /// Subscribe to this event to change format region returned by GetFormatRegionOrDefault. - /// - /// - /// Exit parameter that holds the format region returned by function. - /// True when this event is handled. - [IntegrationEvent(false, false)] - internal procedure OnGetFormatRegionOrDefault(var FormatRegion: Text[80]; var Handled: Boolean) - begin - end; } diff --git a/src/System Application/App/Language/src/LanguageImpl.Codeunit.al b/src/System Application/App/Language/src/LanguageImpl.Codeunit.al index c4d7b847f1..09b24a7dba 100644 --- a/src/System Application/App/Language/src/LanguageImpl.Codeunit.al +++ b/src/System Application/App/Language/src/LanguageImpl.Codeunit.al @@ -21,6 +21,8 @@ codeunit 54 "Language Impl." tabledata "Windows Language" = r; var + LanguageIdOverride: Integer; + FormatRegionOverride: Text[80]; LanguageNotFoundErr: Label 'The language %1 could not be found.', Comment = '%1 = Language ID'; procedure GetUserLanguageCode() UserLanguageCode: Code[10] @@ -36,16 +38,12 @@ codeunit 54 "Language Impl." procedure GetLanguageIdOrDefault(LanguageCode: Code[10]): Integer; var - Language: Codeunit Language; LanguageId: Integer; - Handled: Boolean; begin - Language.OnGetLanguageIdOrDefault(LanguageCode, LanguageId, Handled); - if Handled then - exit(LanguageId); + if LanguageIdOverride <> 0 then + exit(LanguageIdOverride); LanguageId := GetLanguageId(LanguageCode); - if LanguageId = 0 then LanguageId := GlobalLanguage(); @@ -55,14 +53,11 @@ codeunit 54 "Language Impl." procedure GetFormatRegionOrDefault(FormatRegion: Text[80]): Text[80] var LanguageSelection: Record "Language Selection"; - Language: Codeunit Language; UserSessionSettings: SessionSettings; LocalId: Integer; - Handled: Boolean; begin - Language.OnGetFormatRegionOrDefault(FormatRegion, Handled); - if Handled then - exit(FormatRegion); + if FormatRegionOverride <> '' then + exit(FormatRegionOverride); if FormatRegion <> '' then exit(FormatRegion); @@ -77,6 +72,16 @@ codeunit 54 "Language Impl." exit('en-US'); end; + procedure SetOverrideLanguageId(LanguageId: Integer) + begin + LanguageIdOverride := LanguageId; + end; + + procedure SetOverrideFormatRegion(FormatRegion: Text[80]) + begin + FormatRegionOverride := FormatRegion; + end; + procedure GetLanguageId(LanguageCode: Code[10]): Integer var Language: Record Language; From e2ef7570fb9f88f86d96830d966ec7e948a6e9e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20Hartvig=20Gr=C3=B8nbech?= Date: Wed, 14 Feb 2024 12:28:05 +0100 Subject: [PATCH 3/8] reset + telemetry --- .../App/Language/src/Language.Codeunit.al | 53 ++++++++++++------- .../App/Language/src/LanguageImpl.Codeunit.al | 30 ++++++++--- 2 files changed, 57 insertions(+), 26 deletions(-) diff --git a/src/System Application/App/Language/src/Language.Codeunit.al b/src/System Application/App/Language/src/Language.Codeunit.al index 46763ece44..17d1c35a54 100644 --- a/src/System Application/App/Language/src/Language.Codeunit.al +++ b/src/System Application/App/Language/src/Language.Codeunit.al @@ -68,39 +68,52 @@ codeunit 43 Language end; /// - /// Sets an override for the language ID. - /// This function is used to override the default or user-selected language ID. - /// Once set, the system will return this language ID for any subsequent calls to `GetLanguageIdOrDefault` method, until the override is cleared. + /// Overrides the language ID returned by the GetLanguageIdOrDefault function. /// - /// The language ID that should be used as an override. - /// - /// - /// LanguageImpl.SetOverrideLanguageId(1031); // Sets the override language ID to German (1031) - /// - /// + /// The ID of the language to use. This must be a valid language ID. + /// + /// This override will be reset after it's used once in the GetLanguageIdOrDefault function. To keep the override throughout the application, use SetOverrideLanguageId(LanguageId: Integer; ResetOverride: Boolean) method. + /// procedure SetOverrideLanguageId(LanguageId: Integer) + begin + SetOverrideLanguageId(LanguageId, true); + end; + + /// + /// Overrides the language ID returned by the GetLanguageIdOrDefault function. + /// + /// The ID of the language to use. This must be a valid language ID. + /// A boolean value indicating whether the override should be reset after use in the GetLanguageIdOrDefault function. If set to true, the override is reset after it's used once. If set to false, the override remains until it's manually reset or the session is restarted. + + procedure SetOverrideLanguageId(LanguageId: Integer; ResetOverride: Boolean) var LanguageImpl: Codeunit "Language Impl."; begin - LanguageImpl.SetOverrideLanguageId(LanguageId); + LanguageImpl.SetOverrideLanguageId(LanguageId, ResetOverride); end; /// - /// Sets an override for the format region. - /// This function is used to override the default or user-selected format region. - /// Once set, the system will return this format region for any subsequent calls to `GetFormatRegionOrDefault` method, until the override is cleared. + /// Overrides the format region returned by the GetFormatRegionOrDefault function. /// - /// The format region that should be used as an override. - /// - /// - /// LanguageImpl.SetOverrideFormatRegion("de-DE"); // Sets the override format region to German (de-DE) - /// - /// + /// The region to use for formatting purposes. This must be a valid region code. + /// + /// This override will be reset after it's used once in the GetFormatRegionOrDefault function. To keep the override throughout the session, use SetOverrideFormatRegion(FormatRegion: Text[80]; ResetOverride: Boolean) method. + /// procedure SetOverrideFormatRegion(FormatRegion: Text[80]) + begin + SetOverrideFormatRegion(FormatRegion, true); + end; + + /// + /// Overrides the format region returned by the GetFormatRegionOrDefault function. + /// + /// The region to use for formatting purposes. This must be a valid region code. + /// A boolean value indicating whether the override should be reset after use in the GetFormatRegionOrDefault function. If set to true, the override is reset after it's used once. If set to false, the override remains until it's manually reset or the session is restarted. + procedure SetOverrideFormatRegion(FormatRegion: Text[80]; ResetOverride: Boolean) var LanguageImpl: Codeunit "Language Impl."; begin - LanguageImpl.SetOverrideFormatRegion(FormatRegion); + LanguageImpl.SetOverrideFormatRegion(FormatRegion, ResetOverride); end; /// diff --git a/src/System Application/App/Language/src/LanguageImpl.Codeunit.al b/src/System Application/App/Language/src/LanguageImpl.Codeunit.al index 09b24a7dba..d7099f0fe1 100644 --- a/src/System Application/App/Language/src/LanguageImpl.Codeunit.al +++ b/src/System Application/App/Language/src/LanguageImpl.Codeunit.al @@ -7,6 +7,7 @@ namespace System.Globalization; using System; using System.Environment.Configuration; +using System.Telemetry; using System.Environment; codeunit 54 "Language Impl." @@ -21,9 +22,12 @@ codeunit 54 "Language Impl." tabledata "Windows Language" = r; var + ResetLanguageIdOverrideAfterUse, ResetFormatRegionOverrideAfterUse : Boolean; LanguageIdOverride: Integer; FormatRegionOverride: Text[80]; LanguageNotFoundErr: Label 'The language %1 could not be found.', Comment = '%1 = Language ID'; + LanguageIdOverrideMsg: Label 'LanguageIdOverride has been applied in GetLanguageIdOrDefault. The new Language Id is %1.', Comment = '%1 - Language ID'; + FormatRegionOverrideMsg: Label 'FormatRegionOverride has been applied in GetFormatRegionOrDefault. The new FormatRegion is %1.', Comment = '%1 - Format Region'; procedure GetUserLanguageCode() UserLanguageCode: Code[10] var @@ -38,10 +42,16 @@ codeunit 54 "Language Impl." procedure GetLanguageIdOrDefault(LanguageCode: Code[10]): Integer; var + Telemetry: Codeunit Telemetry; LanguageId: Integer; begin - if LanguageIdOverride <> 0 then - exit(LanguageIdOverride); + if LanguageIdOverride <> 0 then begin + LanguageId := LanguageIdOverride; + Telemetry.LogMessage('', StrSubstNo(LanguageIdOverrideMsg, LanguageId), Verbosity::Normal, DataClassification::SystemMetadata, TelemetryScope::All); + if ResetLanguageIdOverrideAfterUse then + LanguageIdOverride := 0; + exit(LanguageId); + end; LanguageId := GetLanguageId(LanguageCode); if LanguageId = 0 then @@ -53,11 +63,17 @@ codeunit 54 "Language Impl." procedure GetFormatRegionOrDefault(FormatRegion: Text[80]): Text[80] var LanguageSelection: Record "Language Selection"; + Telemetry: Codeunit Telemetry; UserSessionSettings: SessionSettings; LocalId: Integer; begin - if FormatRegionOverride <> '' then - exit(FormatRegionOverride); + if FormatRegionOverride <> '' then begin + FormatRegion := FormatRegionOverride; + Telemetry.LogMessage('', StrSubstNo(FormatRegionOverrideMsg, FormatRegion), Verbosity::Normal, DataClassification::SystemMetadata, TelemetryScope::All); + if ResetFormatRegionOverrideAfterUse then + FormatRegionOverride := ''; + exit(FormatRegion); + end; if FormatRegion <> '' then exit(FormatRegion); @@ -72,14 +88,16 @@ codeunit 54 "Language Impl." exit('en-US'); end; - procedure SetOverrideLanguageId(LanguageId: Integer) + procedure SetOverrideLanguageId(LanguageId: Integer; ResetOverride: Boolean) begin LanguageIdOverride := LanguageId; + ResetLanguageIdOverrideAfterUse := ResetOverride; end; - procedure SetOverrideFormatRegion(FormatRegion: Text[80]) + procedure SetOverrideFormatRegion(FormatRegion: Text[80]; ResetOverride: Boolean) begin FormatRegionOverride := FormatRegion; + ResetFormatRegionOverrideAfterUse := ResetOverride; end; procedure GetLanguageId(LanguageCode: Code[10]): Integer From 5f1a9fcc7fc940ecdeb7c774cddb275bcf9a4a68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20Hartvig=20Gr=C3=B8nbech?= Date: Fri, 16 Feb 2024 17:02:28 +0100 Subject: [PATCH 4/8] add tags --- .../App/Language/src/LanguageImpl.Codeunit.al | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/System Application/App/Language/src/LanguageImpl.Codeunit.al b/src/System Application/App/Language/src/LanguageImpl.Codeunit.al index d7099f0fe1..4102192815 100644 --- a/src/System Application/App/Language/src/LanguageImpl.Codeunit.al +++ b/src/System Application/App/Language/src/LanguageImpl.Codeunit.al @@ -47,7 +47,7 @@ codeunit 54 "Language Impl." begin if LanguageIdOverride <> 0 then begin LanguageId := LanguageIdOverride; - Telemetry.LogMessage('', StrSubstNo(LanguageIdOverrideMsg, LanguageId), Verbosity::Normal, DataClassification::SystemMetadata, TelemetryScope::All); + Telemetry.LogMessage('0000MH9', StrSubstNo(LanguageIdOverrideMsg, LanguageId), Verbosity::Normal, DataClassification::SystemMetadata, TelemetryScope::All); if ResetLanguageIdOverrideAfterUse then LanguageIdOverride := 0; exit(LanguageId); @@ -69,7 +69,7 @@ codeunit 54 "Language Impl." begin if FormatRegionOverride <> '' then begin FormatRegion := FormatRegionOverride; - Telemetry.LogMessage('', StrSubstNo(FormatRegionOverrideMsg, FormatRegion), Verbosity::Normal, DataClassification::SystemMetadata, TelemetryScope::All); + Telemetry.LogMessage('0000MHA', StrSubstNo(FormatRegionOverrideMsg, FormatRegion), Verbosity::Normal, DataClassification::SystemMetadata, TelemetryScope::All); if ResetFormatRegionOverrideAfterUse then FormatRegionOverride := ''; exit(FormatRegion); From 6aec9560d7640c66966d6bf629c2fe424003ec1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20Hartvig=20Gr=C3=B8nbech?= Date: Mon, 19 Feb 2024 09:15:41 +0100 Subject: [PATCH 5/8] add missing dependency --- src/System Application/App/Language/app.json | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/System Application/App/Language/app.json b/src/System Application/App/Language/app.json index 2cc6169e75..7d360659d2 100644 --- a/src/System Application/App/Language/app.json +++ b/src/System Application/App/Language/app.json @@ -18,12 +18,18 @@ } ], "dependencies": [ - { + { "id": "7e3b999e-1182-45d2-8b82-d5127ddba9b2", "name": "DotNet Aliases", "publisher": "Microsoft", "version": "24.0.0.0" - } + }, + { + "id": "de35f591-7216-4e60-8be1-1911d71a7fc2", + "name": "Telemetry", + "publisher": "Microsoft", + "version": "24.0.0.0" + } ], "screenshots": [ From 87ee5c21c8cf6c8fcf87c9284662166a534206b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20Hartvig=20Gr=C3=B8nbech?= Date: Tue, 20 Feb 2024 09:55:55 +0100 Subject: [PATCH 6/8] remove circular dependency --- src/System Application/App/Language/app.json | 6 ------ .../App/Language/src/LanguageImpl.Codeunit.al | 5 ----- 2 files changed, 11 deletions(-) diff --git a/src/System Application/App/Language/app.json b/src/System Application/App/Language/app.json index 7d360659d2..8bf2400d70 100644 --- a/src/System Application/App/Language/app.json +++ b/src/System Application/App/Language/app.json @@ -23,12 +23,6 @@ "name": "DotNet Aliases", "publisher": "Microsoft", "version": "24.0.0.0" - }, - { - "id": "de35f591-7216-4e60-8be1-1911d71a7fc2", - "name": "Telemetry", - "publisher": "Microsoft", - "version": "24.0.0.0" } ], "screenshots": [ diff --git a/src/System Application/App/Language/src/LanguageImpl.Codeunit.al b/src/System Application/App/Language/src/LanguageImpl.Codeunit.al index 4102192815..dcf2ddb64f 100644 --- a/src/System Application/App/Language/src/LanguageImpl.Codeunit.al +++ b/src/System Application/App/Language/src/LanguageImpl.Codeunit.al @@ -7,7 +7,6 @@ namespace System.Globalization; using System; using System.Environment.Configuration; -using System.Telemetry; using System.Environment; codeunit 54 "Language Impl." @@ -42,12 +41,10 @@ codeunit 54 "Language Impl." procedure GetLanguageIdOrDefault(LanguageCode: Code[10]): Integer; var - Telemetry: Codeunit Telemetry; LanguageId: Integer; begin if LanguageIdOverride <> 0 then begin LanguageId := LanguageIdOverride; - Telemetry.LogMessage('0000MH9', StrSubstNo(LanguageIdOverrideMsg, LanguageId), Verbosity::Normal, DataClassification::SystemMetadata, TelemetryScope::All); if ResetLanguageIdOverrideAfterUse then LanguageIdOverride := 0; exit(LanguageId); @@ -63,13 +60,11 @@ codeunit 54 "Language Impl." procedure GetFormatRegionOrDefault(FormatRegion: Text[80]): Text[80] var LanguageSelection: Record "Language Selection"; - Telemetry: Codeunit Telemetry; UserSessionSettings: SessionSettings; LocalId: Integer; begin if FormatRegionOverride <> '' then begin FormatRegion := FormatRegionOverride; - Telemetry.LogMessage('0000MHA', StrSubstNo(FormatRegionOverrideMsg, FormatRegion), Verbosity::Normal, DataClassification::SystemMetadata, TelemetryScope::All); if ResetFormatRegionOverrideAfterUse then FormatRegionOverride := ''; exit(FormatRegion); From 96a225d8a772451206befef25956842bcfad9733 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20Hartvig=20Gr=C3=B8nbech?= Date: Tue, 20 Feb 2024 13:30:52 +0100 Subject: [PATCH 7/8] fix unused message --- src/System Application/App/Language/app.json | 4 ++-- .../App/Language/src/LanguageImpl.Codeunit.al | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/System Application/App/Language/app.json b/src/System Application/App/Language/app.json index 8bf2400d70..00901786f0 100644 --- a/src/System Application/App/Language/app.json +++ b/src/System Application/App/Language/app.json @@ -17,14 +17,14 @@ "publisher": "Microsoft" } ], - "dependencies": [ + "dependencies": [ { "id": "7e3b999e-1182-45d2-8b82-d5127ddba9b2", "name": "DotNet Aliases", "publisher": "Microsoft", "version": "24.0.0.0" } - ], + ], "screenshots": [ ], diff --git a/src/System Application/App/Language/src/LanguageImpl.Codeunit.al b/src/System Application/App/Language/src/LanguageImpl.Codeunit.al index dcf2ddb64f..d58d7d646c 100644 --- a/src/System Application/App/Language/src/LanguageImpl.Codeunit.al +++ b/src/System Application/App/Language/src/LanguageImpl.Codeunit.al @@ -25,8 +25,6 @@ codeunit 54 "Language Impl." LanguageIdOverride: Integer; FormatRegionOverride: Text[80]; LanguageNotFoundErr: Label 'The language %1 could not be found.', Comment = '%1 = Language ID'; - LanguageIdOverrideMsg: Label 'LanguageIdOverride has been applied in GetLanguageIdOrDefault. The new Language Id is %1.', Comment = '%1 - Language ID'; - FormatRegionOverrideMsg: Label 'FormatRegionOverride has been applied in GetFormatRegionOrDefault. The new FormatRegion is %1.', Comment = '%1 - Format Region'; procedure GetUserLanguageCode() UserLanguageCode: Code[10] var From a494cf6777477ee8d40baf60edae0f1cd03ccebe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20Hartvig=20Gr=C3=B8nbech?= Date: Tue, 27 Feb 2024 08:38:41 +0100 Subject: [PATCH 8/8] change to session log message --- .../App/Language/src/LanguageImpl.Codeunit.al | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/System Application/App/Language/src/LanguageImpl.Codeunit.al b/src/System Application/App/Language/src/LanguageImpl.Codeunit.al index d58d7d646c..4a32596967 100644 --- a/src/System Application/App/Language/src/LanguageImpl.Codeunit.al +++ b/src/System Application/App/Language/src/LanguageImpl.Codeunit.al @@ -25,6 +25,9 @@ codeunit 54 "Language Impl." LanguageIdOverride: Integer; FormatRegionOverride: Text[80]; LanguageNotFoundErr: Label 'The language %1 could not be found.', Comment = '%1 = Language ID'; + LanguageIdOverrideMsg: Label 'LanguageIdOverride has been applied in GetLanguageIdOrDefault. The new Language Id is %1.', Comment = '%1 - Language ID'; + FormatRegionOverrideMsg: Label 'FormatRegionOverride has been applied in GetFormatRegionOrDefault. The new FormatRegion is %1.', Comment = '%1 - Format Region'; + LanguageCategoryTxt: Label 'Language'; procedure GetUserLanguageCode() UserLanguageCode: Code[10] var @@ -43,6 +46,7 @@ codeunit 54 "Language Impl." begin if LanguageIdOverride <> 0 then begin LanguageId := LanguageIdOverride; + Session.LogMessage('0000MJQ', StrSubstNo(LanguageIdOverrideMsg, LanguageId), Verbosity::Normal, DataClassification::SystemMetadata, TelemetryScope::All, 'Category', LanguageCategoryTxt); if ResetLanguageIdOverrideAfterUse then LanguageIdOverride := 0; exit(LanguageId); @@ -63,6 +67,7 @@ codeunit 54 "Language Impl." begin if FormatRegionOverride <> '' then begin FormatRegion := FormatRegionOverride; + Session.LogMessage('0000MJR', StrSubstNo(FormatRegionOverrideMsg, FormatRegion), Verbosity::Normal, DataClassification::SystemMetadata, TelemetryScope::All, 'Category', LanguageCategoryTxt); if ResetFormatRegionOverrideAfterUse then FormatRegionOverride := ''; exit(FormatRegion);