Discussion for FogBugz Plugin developers
Some strings in the CLocalizer have format instructions %N in them, such as CLocalizer.Current.FB_PROMPT_DATE_FORMAT (which I'd like to use in my plugin):
"Enter the completion date as %1 or enter (%2)"
Now the problem is that %1 should be replaced with the date format used on the user's side and %2 with the NULL value text, which is "(none)" in English.
Is there a function which does the formatting for me, and where do I find the text to insert?
You're right -- the function is called SwapN, and we don't expose it in the Plugin API. That's a bug. Here is a simple C# implementation that should work for you until we expose it:
public static string SwapN(string s, params string rgs)
string sReplaced = s;
for (int i = 1; i <= rgs.Length; i++)
sReplaced = sReplaced.Replace("%" + i.ToString(), rgs[i-1]);
Okay, so are both
Thread.CurrentCulture correctly set to the current users locale when inside API calls, for all calls including RawPage/AJAX?
If not, can I easily get the CultureInfo which I should use for formatting and parsing?
Because the locale returned by api.Person.GetCurrentPerson().sLocale may be "*" fpr the current browser locale, so that I'd have to go and look up the browser's locale, I'm pretty sure that you have already coded this and it would be great if I could just reuse your implementation.
This topic is archived. No further replies will be accepted.Other recent topics