From 24737569ebb498f1db52c4b8865f9a1a0885ce06 Mon Sep 17 00:00:00 2001 From: Oren Novotny Date: Thu, 28 Mar 2019 14:58:14 -0400 Subject: [PATCH] add locale and timezone --- .../WindowsServer/DeviceTelemetryInitializer.cs | 6 +++--- .../WindowsServer/Implementation/DeviceContextReader.cs | 9 +++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/AppInsights.WindowsDesktop/WindowsServer/DeviceTelemetryInitializer.cs b/AppInsights.WindowsDesktop/WindowsServer/DeviceTelemetryInitializer.cs index 7026c58..14e0413 100644 --- a/AppInsights.WindowsDesktop/WindowsServer/DeviceTelemetryInitializer.cs +++ b/AppInsights.WindowsDesktop/WindowsServer/DeviceTelemetryInitializer.cs @@ -29,10 +29,10 @@ public void Initialize(ITelemetry telemetry) telemetry.Context.Device.Model = reader.GetDeviceModel(); #pragma warning disable CS0618 // Type or member is obsolete telemetry.Context.Device.NetworkType = reader.GetNetworkType(); -#pragma warning restore CS0618 // Type or member is obsolete telemetry.Context.Properties["ai.device.locale"] = reader.GetHostSystemLocale(); - telemetry.Context.Properties["ai.device.timezone"] = TimeZoneInfo.Local.DisplayName; - + telemetry.Context.Properties["ai.device.language"] = reader.GetDisplayLanguage(); + telemetry.Context.Properties["ai.location.timeZone"] = TimeZoneInfo.Local.DisplayName; +#pragma warning restore CS0618 // Type or member is obsolete } } } diff --git a/AppInsights.WindowsDesktop/WindowsServer/Implementation/DeviceContextReader.cs b/AppInsights.WindowsDesktop/WindowsServer/Implementation/DeviceContextReader.cs index f88e83d..6b4b026 100644 --- a/AppInsights.WindowsDesktop/WindowsServer/Implementation/DeviceContextReader.cs +++ b/AppInsights.WindowsDesktop/WindowsServer/Implementation/DeviceContextReader.cs @@ -51,6 +51,15 @@ public virtual string GetHostSystemLocale() return CultureInfo.CurrentCulture.Name; } + /// + /// Gets the display language. + /// + /// The discovered locale. + public virtual string GetDisplayLanguage() + { + return CultureInfo.CurrentUICulture.Name; + } + /// /// Gets the type of the device. ///