Skip to content

Commit

Permalink
add locale and timezone
Browse files Browse the repository at this point in the history
  • Loading branch information
Oren Novotny committed Mar 28, 2019
1 parent 22cfb43 commit 2473756
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ public virtual string GetHostSystemLocale()
return CultureInfo.CurrentCulture.Name;
}

/// <summary>
/// Gets the display language.
/// </summary>
/// <returns>The discovered locale.</returns>
public virtual string GetDisplayLanguage()
{
return CultureInfo.CurrentUICulture.Name;
}

/// <summary>
/// Gets the type of the device.
/// </summary>
Expand Down

0 comments on commit 2473756

Please sign in to comment.