Reputation: 28121
I know I can use DateTimeFormatInfo.CurrentInfo.GetMonthName
and GetDayName
to get the localized names of actual calendar parts like June, Friday, etc. Now I need the translated strings for the following words "Day", "Week", "Month", and "Year." Is it possible to get these from .net somehow?
Upvotes: 3
Views: 2255
Reputation: 591
This might be more up the right street:
Best practices for ASP.NET web application localization
Upvotes: -1
Reputation: 21630
Assuming you have the culture set, you can make use of date formatters to return the translated string. I'm not sure how you'd translate the year, however!
Here is a good reference for the formatters:
http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx
You can pass in a known date (instead of the current date) to get a specific day / month name.
Given the update to your question, you're better off using resource files.
Upvotes: 3
Reputation: 11489
You can't get that out of the .Net library. But, you can get the information from a translation web service (if you really need it real-time).
http://www.microsofttranslator.com/dev/
Or, if static is fine, just translate it ahead of time and store it in a resource:
http://www.microsofttranslator.com/
http://translate.google.com/
Upvotes: 3