Time skill should allow passing the "culture/locale" setting
Looking at the current Time skills in C# and Python, sometimes the code use the local culture, in other case the format is hard-coded and could cause unexpected results (e.g. when using the planner), e.g. month-day order being reversed only for some functions.
It would help adding a config to the skill constructor, so that a user can explicitly set which format/locale/culture setting to use in all functions.
See also comments on PR #927
/cc @tim-gill
This isn't just about that one skill; many skills need to understand how to format and parse based on a culture. The typical approach is either a) just use whatever is current and someone can change what's current, e.g.
CultureInfo.CurrentCulture = new CultureInfo("fr-FR");
CallMethod();
or b) pass one in, e.g.
CallMethod(new CultureInfo("fr-FR""));
with the method accepting an CultureInfo? argument or the like. In the case of SK, (b) would more generally mean that there's a standard way any skill could look up what culture to use, and that the infrastructure would be able to consistently see as well for any situation where it was doing formatting/parsing work on behalf of the skill.
My suggestion is we add an CultureInfo? to the SKContext. If it's not null, skills would use it for parsing and formatting. If it's null, skills should use CultureInfo.CurrentCulture or CultureInfo.InvariantCulture (we come up with guidance about which, e.g. for formatting always use invariant and for parsing first try with current culture and if that fails retry with invariant).
With https://github.com/microsoft/semantic-kernel/pull/1195, this would enable the formatting/parsing done by the marshaling layer see which CultureInfo? to use when formatting/parsing on the user's behalf, and it would allow for a native function to accept an CultureInfo? argument that the invocation could would automatically pass in. Passing it in from the context would just be a few line replacement where currently I pass in null and instead would change it to pass in context.CultureInfo.
cc: @shawncal
What would we do for equivalent behavior on the Python side of the house? Currently it is locked to English using strftime with varying format strings across the time functions.
Closing this now that the culture is in the kernel/context