cultureinfo

How can I parse an Arabic Umm Al-Qura date string into a .NET DateTime object?

倾然丶 夕夏残阳落幕 提交于 2019-12-01 17:51:32
问题 I have the following Arabic date in the Umm Al-Qura calendar that I want to parse into a .NET DateTime object: الأربعاء‏، 17‏ ذو الحجة‏، 1436 This date is equivalent to September 30th 2015 in the Gregorian calendar. I've been trying the following "standard" C# code to parse this date, but without success: var cultureInfo = new CultureInfo("ar-SA"); cultureInfo.DateTimeFormat.Calendar = new UmAlQuraCalendar(); // the default one anyway var dateFormat = "dddd، dd MMMM، yyyy"; //note the ،

Missing Countries & locations from CultureInfo when trying to

蹲街弑〆低调 提交于 2019-12-01 06:03:52
I need to localize an application and have noticed that several countries don't appear in the list of county codes associated to cultureInfo. One example is Cyprus, I assume there might be others. If i need to localize settings for Cyprus (or other missing ones) how would I rename my resource files that they would render the correct text and such? Thanks When localizing to Cyprus , you would need to either localize to Greek (for the Greek part of the island), or to Turkish (for the Turkish part). As the island is composed of these two cultures, it does not have a CultureInfo of its own. 来源:

Windows Service Unable to get correct System Culture

北慕城南 提交于 2019-12-01 00:56:27
From Control Panel, I set my Region and Language setting to French (France) When I am running my application as console application, Thread.CurrentThread.CurrentCulture returns French But when I'm running it as windows service, it returns invariant culture or English (US) Is there a way to fix that? The service is probably running as a user that has it's own culture. Why not set the culture when you start your service Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-FR"); Thread.CurrentThread.CurrentUICulture = new CultureInfo("fr-FR"); Also from Default Culture in a Windows Service

Windows Service Unable to get correct System Culture

放肆的年华 提交于 2019-11-30 20:01:45
问题 From Control Panel, I set my Region and Language setting to French (France) When I am running my application as console application, Thread.CurrentThread.CurrentCulture returns French But when I'm running it as windows service, it returns invariant culture or English (US) Is there a way to fix that? 回答1: The service is probably running as a user that has it's own culture. Why not set the culture when you start your service Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-FR"); Thread

OwinMiddleware doesn't preserve culture change in .net 4.6.*

左心房为你撑大大i 提交于 2019-11-30 17:48:12
问题 I have an owin culture middle ware running very nice. It just changes the culture according to the url. This works in 4.5.* perfectly. Now when the runtiome is changed to 4.6.1, the culture isn't preserved anymore and as a result it just doesn't work. I can reproduce it in a very simple solution which only has this middleware simulating the culture change public class CultureMiddleware : OwinMiddleware { public CultureMiddleware(OwinMiddleware next) : base(next) { } public override async Task

How to deal with accented characters in iOS SQLite?

≡放荡痞女 提交于 2019-11-30 14:48:56
问题 I need to perform a SELECT queries that are insensitive to case and accents. For demo purposes, I create a table like that: create table table ( column text collate nocase ); insert into table values ('A'); insert into table values ('a'); insert into table values ('Á'); insert into table values ('á'); create index table_cloumn_Index on table (column collate nocase); Then, I get those results when executing the following queries: SELECT * FROM table WHERE column LIKE 'a'; > A > a SELECT * FROM

Best Practice - Format Multiple Currencies

我与影子孤独终老i 提交于 2019-11-30 11:33:32
问题 What is best practice for the scenario listed below? We have an application which we would like to support multiple currencies. The software will respect the users locale and regional settings to dictate the correct number format, i.e. $10,000.00 or 10.000,00₴ etc. We would however like to be able to format different numbers based upon a currency ID (perhaps the three letter ISO4217 code). Our idea is to store a table in the database with each currency and then request from the user to select

DateTime.TryParseExact() rejecting valid formats

戏子无情 提交于 2019-11-30 10:41:12
I'm parsing a DateTime value in an ASP.NET WebForms page and the date string keeps getting rejected by the DateTime.TryParseExact() method even though it clearly matches one of the supplied format strings. It seems to fail on my development machine at home but work on the production server, so I am thinking of local date settings being involved, but this error occurs even when I supply an IFormatProvider (CultureInfo) object as a parameter Here's the code: DateTime startDate; string[] formats = { "dd/MM/yyyy", "dd/M/yyyy", "d/M/yyyy", "d/MM/yyyy", "dd/MM/yy", "dd/M/yy", "d/M/yy", "d/MM/yy"};

Execute task with the CurrentCulture set to the Task creator CurrentCulture

眉间皱痕 提交于 2019-11-30 09:13:15
问题 I've an application where we use Tasks. We also modified the cultureInfo(we use the EN-US language, but keep the date/number format), and we use .Net 4.0. The application has a lot of thread and task, and we have a factory for the creation of Task/Threads. For the thread, we have the following code, to ensure that every thread is launched with the correct CurrentCulture: //This is basically only the constructor, but it describe well how we create the Thread: public MonitoredThread(ThreadStart

Why doesn't DateTime.ToShortTimeString() respect the Short Time format in “Regional and Language Settings”?

ぐ巨炮叔叔 提交于 2019-11-30 08:58:43
I have run into an issue that is probably due to my mis-understanding of how the DateTime.ToShortTimeString() method works. When formatting time strings with this function, I was assuming that it would respect the "Short Time" setting in Windows 7's Format settings Control Panel -> Clock, Language and Region -> Region and Language -> Formats Tab. However .NET seems to select a short time format not based upon this setting but based upon the current culture: Region and Language -> Location -> Current Location I did some testing on Windows 7 RC: Culture: en-GB, 6AM: 06:00, 6PM: 18:00 // HH:mm