Im using dotnet search api for FAST ESP 5.3. Everything works fine except for culture tr-tr i.e cultureid=1055.
Getting exception as "Error parsing information" on executing the below line
qr = view.Search(query);
Can anybody please throw some light on this issue?
What & where to check whether my installed FAST ESP has turkish(tr-tr) support?
Your help is highly appreciated.
Thanks,
Arun
Finally resolved the issue as below through MS support:
CultureInfo originalCulture = Thread.CurrentThread.CurrentCulture;
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
qr = view.Search(query);
Thread.CurrentThread.CurrentCulture = originalCulture;
Related
I am trying to change the format of ToLongDateString to be in my local culture (da-DK).
For now I am doing the following, and if it can be done in a better way, then it will be very appreciated:
CultureInfo cCulture = new CultureInfo("da-DK");
string dateTimeStr = freeSeat.FreeDate.ToLongDateString().ToString(cCulture);
This works as expected on my local development environment, but when I deploy it to AWS lambda, I just get the English culture format. I am pretty sure the issue is that in AWS the C# core code is running on Linux.
I hope someone can give me some input how to solve this.
The ToLongDateString method returns a string formatted according to the current thread culture. Calling ToString method later is useless.
Do it like this:
CultureInfo cCulture = new CultureInfo("da-DK");
string format = cCulture.DateTimeFormat.LongDatePattern;
string dateTimeStr = freeSeat.FreeDate.ToString(format, cCulture);
I have window-7 Ultimate OS.I written below code for get current culture info.
void TestMessage()
{
CultureInfo culture = CultureInfo.CurrentCulture;
CultureInfo culture1 = Thread.CurrentThread.CurrentCulture;
}
it is working fine with window-8,server 2012 Japanese OS. But it is not working in window-7 only. Please look below image of my computer region setting
Can any anyone guide me to get correct culture name?
Thanks,
There's CurrentCulture and CurrentUICulture.
CurrentCulture: formatting of data (numbers, dates), it is configured in Windows using the tab visible in your screenshot
CurrentUICulture: the language to speak/write to your user, it is configured in Windows using one of the other tabs showing in your screenshot. ("Keyboard & Languages" I think)
Your screenshot:
... is showing american numeric notation because CurrentCulture is set to en-US
... is talking Japanese because CurrentUICulture is very likely set to Japanese
So, if you need to know what language to use for localization, as is probably your case, you should be using CurrentUICulture.
I've instantiated the CultureInfo class with fo-FO (Faroese Island) culture. However, CultureInfo.CurrentCulture.DateTimeFormat.TimeSeparator is showing as: (colon) not . (dot). How to fix this error?
Below is the code:
CultureInfo ci = new CultureInfo("fo-FO");
Thread.CurrentThread.CurrentCulture = ci;
Thread.CurrentThread.CurrentUICulture = ci;
Console.WriteLine(DateTime.Now.ToString());
output
26-06-2012 15:15:17
Surprisingly, Time stamp alone is not converted , but it did converted Date part.
By setting the CultureInfo.CurrentCulture.DateTimeFormat.TimeSeparator = "." will solve the problem. But we are supporting multiple culture so i dont think it is a good idea to set TimeSeparator.
any pointer at the right direction is greatly appreciated.
I'm trying this in two application; a console application and a web application.
In the console app when I try Double.Parse("0.5") it gives 0.5 or Double.Parse(".5") gives 0.5
But in the web application Double.Parse("0.5") gives 5.0 and Double.Parse(".5") gives exception
Input string was not in a correct format.
Can any one tell how can resolve the issue in web app?
You should provide culture information otherwise it uses the culture info from the currently running thread. Try this instead:
CultureInfo cultureInfo = CultureInfo.InvariantCulture; // or whatever you prefer
double result = double.Parse(".5", cultureInfo);
I'm working on a silverlight application where I'm checking the url to see if the user is trying to access the "Spanish" version. My methods work fine on Windows 7 and Windows Vista but I'm getting a crash throwing an Argument_InvalidCultureName exception when a user of Windows XP tries to load the application. Can someone look at the code below a give me perhaps an idea of what's going wrong and how to resolve it? Thanks in advance.
if (HtmlPage.Document.DocumentUri.Query.Contains("Spanish") || HtmlPage.Document.DocumentUri.Query.Contains("spanish") || HtmlPage.Document.DocumentUri.Query.Contains("Espanol"))
{
try
{
var culture = new CultureInfo("es-ES");
Thread.CurrentThread.CurrentCulture = culture;
Thread.CurrentThread.CurrentUICulture = culture;
}
catch (Exception)
{
// Do Something
}
}
I changed the logic over to "es" instead of "es-ES" and this worked fine on the XP machines.