globalization

How to set collation for a connection in SQL Server?

情到浓时终转凉″ 提交于 2019-11-29 06:14:27
How can i set the collation SQL Server will use for the duration of that connection? Not until i connect to SQL Server do i know what collation i want to use. e.g. a browser with language fr-IT has connected to the web-site. Any queries i run on that connection i want to follow the French language, Italy variant collation. i envision a hypothetical connection level property, simlar to SET ANSI_NULLS OFF , but for collation 1 : SET COLLATION_ORDER 'French_CI_AS' SELECT TOP 100 FROM Orders ORDER BY ProjectName and later SELECT * FROM Orders WHERE CustomerID = 3277 AND ProjectName LIKE '%l''ecole

How can I change the CurrentCulture of the entire process (not just current thread) in .Net?

邮差的信 提交于 2019-11-29 05:46:48
I have a situation where I need to set my process' locale to en-US. I know how to do this for the current thread: System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture("en-US"); But my application uses BackgroundWorkers to do some processing, and the locale for these worker threads seems not to be affected by the above change to their spawning main-thread. So how can I set the locale for all the threads in my application without setting it in each one manually? You'll have to change the operating system locale if you want to do that. For

How to change UIPageViewController direction of paging curl animation

核能气质少年 提交于 2019-11-29 04:54:31
I need to display Arabic (Right To Left) content and couldn't find any method to rotate animation of the page curl found by UIPageViewController because basically Arabic books should be turned from Left to right. Bogdan Onu If you are supporting only portrait mode then you should look at the UIPageViewController delegate method pageViewController:spineLocationForInterfaceOrientation: and return UIPageViewControllerSpineLocationMax . But if you want to support both landscape and portrait then you could keep the default spine location animations but provide the pages in the opposite direction

CultureInfo & DateTimeInfo: How to check if is 24 hour time?

余生长醉 提交于 2019-11-29 03:55:42
I'm modifying a globalized web application which uses stored CultureInfo for each logged in user. The client would like time data entry to be localized. Displaying is not a problem as the formatting is already available. However I need to detect if the current cultureinfo is for 24 hour time or am/pm so I can display the correct input boxes (not just a textfield). My initial idea was to check the DateTimeInfo property of CultureInfo and see if the ShortTimePattern contained a capital H or a lower case h but this didn't feel robust enough for me. Is there a better way? I've read the class

Why doesn't object have an overload that accepts IFormatProvider?

走远了吗. 提交于 2019-11-28 22:42:50
When converting for instance a decimal to a string , you use the CultureInfo.InvariantCulture and pass it as an IFormatProvider . But why is this overload not in object ? A nice implementation would be: public virtual string ToString() { // yadayada, usual ToString } public virtual string ToString(IFormatProvider provider) { return ToString(); } This would cause no harm or benefit to the object class, but objects deriving from it can instead override the overload and it will be a lot easier to call it when you are unsure of the type. The problem that made me run into this was when I was making

Make URL language-specific (via routes)

淺唱寂寞╮ 提交于 2019-11-28 20:48:44
Its hard to find an answer to this specific question, so ill pop it up here: We want to build up our urls completely language specific, meaning www.mysite.com/EN www.mysite.com/DE this is done in the RouteConfig with url: "{language}/{controller}/{action}/{id}" But then the tricky part: www.mysite.com/EN/Categories www.mysite.com/DE/Kategorien I.e. make the controllername appear in a multiple languages, but point to the same controller. Is this even possible? Well, this is partially possible (the language part only). The controller name in a different language is definitely an interesting

Prevent exception messages from being translated into the user's language?

帅比萌擦擦* 提交于 2019-11-28 20:14:05
How do I make my application always use English when displaying win32/.net exceptions messages? I got this message, it looks like someone used babelfish to translate it (it's Swedish): "System.ComponentModel.Win32Exception: Programmet kunde inte starta eftersom programmets sida-vid-sidakonfiguration är felaktig." Extremely unhelpful, and Google had a whopping 4 hits for it, none of them helpful. So I have to guess what the original message was and google that. (It's was: "The application has failed to start because its side-by-side configuration is incorrect.") This time it was fairly simple

Is it possible to create a keyboard layout that is identical to the keyboard used?

巧了我就是萌 提交于 2019-11-28 19:54:14
If I need to generate a keyboard layout for customization to the user that looks like his/her keyboard, how can I do it? For instance something like this: French, Swedish, English, Canadian, etc will have different layouts, right. Is this a lot of work or just a matter of using some sort of built in .NET regional classes? Rich Tebb A key press generates a hardware event that reports a "scan code" to the Windows operating system. This scan code is then converted into a "virtual key code" based on the scan code along with other keyboard state factors ( Caps Lock state, Shift / Alt / Ctrl

What is the best way to handle validation with different culture

馋奶兔 提交于 2019-11-28 19:23:01
I am trying to build a multilingual MVC application. I have a form in my application and I have field to enter a cost. I am able to create a record using the spanish culture. But on trying to update the record I am getting jquery validation false. and I am getting a default error message as: The field must be numeric. In my view model I have set the following attributes. [LocalizedDisplayName("Label_Cost")] [RegularExpression("^[^<>,<|>]+$", ErrorMessage = null, ErrorMessageResourceName = "Error_Message_Html_Tags_Prevented", ErrorMessageResourceType = typeof(Resources))] [Range(0, 9999.99,

CurrentCulture incorrectly defaulting to en-US in ASP.net

别等时光非礼了梦想. 提交于 2019-11-28 19:14:19
I have just migrated around 100 ASP.net sites from IIS 6 on Windows Sever 2003 to IIS 7 on Windows 2008. I've just noticed that various pieces of code that use things like DateTime.Parse have started kicking up errors "String was not recognized as a valid DateTime". I've tracked this down to the fact that the CurrentCulture of the sites is defaulting to 'en-US' and so my UK users are inputting dates in an unexpected format. Question is, where are they getting en-US from? Starting from the top, if I look in 'Control Panel > Region and Language' everything is set to English (United Kingdom). The