Date formatting

rated by 0 users
This post has 4 Replies | 4 Followers

Top 200 Contributor
Posts 109
Points 1,680
nickeales Posted: Wed, May 7 2008 8:40 AM

How do I set the dateformat correctly to another language? Do I do this on the SQL server, through LCID in the config or somewhere? 

 

  • | Post Points: 20
Top 10 Contributor
Posts 3,559
Points 53,735
TelligentSupportTeam

 Have a look at Control Panel > Site Administration > Site Configuration > Setup.  under Basic Site Configuration, there should be a section with DateTime Settings, you should be able to use that to change the format.

Community Server Documentation please rate articles you read

Nintendo Wiikly | My Blog

  • | Post Points: 20
Top 200 Contributor
Posts 109
Points 1,680

 Yeah I had already noticed how to do that, but it doesn't change the actual language of the date formatting. Its still says "Tuesday" instead of the actual translation.

 

  • | Post Points: 35
Top 10 Contributor
Posts 3,424
Points 65,515
CS Developers
Ben Tiedt replied on Fri, May 9 2008 11:48 AM

nickeales:
Its still says "Tuesday" instead of the actual translation.
 

I've logged this feature request as #786.  Updates will be posted to this thread.

Ben Tiedt's Blog

  • | Post Points: 5
Top 500 Contributor
Posts 99
Points 1,240
cpaul replied on Fri, May 9 2008 6:54 PM

If CS can't localize it globally yet, you might be able to do it yourself by creating a DataControl that extends the relevant data control (e.g. ThreadData, PostData) and overriding the GetPropertyValue method.

        protected override object GetPropertyValue(string property)
        {
            if (!string.IsNullOrEmpty(property) && this.DataSource != null)
            {
                Thread thread = this.DataSource as Thread;
                switch (property.ToLower())
                {
                    //Curse.com Date Ago Specific Format
                    case "localdate":
                        return MyCustomeDateFormat.FormatAgoDate(thread.ThreadDate);
                       
                }
            }

            return base.GetPropertyValue(property);
        }

If you need to localize it to more than one format, you could get the language of the thread (e.g. thread.Section.DefaultLanguage) or the user (CSContext.Current.User.Profile.Language) and format it yourself to the appropriate language.

http://www.curse.com

  • | Post Points: 5
Page 1 of 1 (5 items) | RSS
Powered by Community Server (Commercial Edition), by Telligent Systems

Copyright© 2008 Telligent Systems Inc. All rights reserved
CommunityServer.com  •  Telligent.com