Products

Solutions

Resources

Partners

Community

Blog

About

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsNews FeedsNews FeedsProblems with locale and date formatProblems with locale and date format
Previous
 
Next
New Post
5/18/2009 12:34 PM
 

Hello,

I am not able to let the newsfeed module use the locale I want (italian) for dates formatting: can anybody tell what am I missing?

  • I configured my DNN host (04.08.04) with only one language, italian, enabled
  • I disabled browser language detection at host and site level (under Language)
  • I configured italian as preferred language at site level
  • I configured italian as user preferred language for all of my users
  • I modified web.config putting culture="it-IT" uiCulture="it" for globalizzation

My RSS feed is an internally generated feed for a module of mine (using GetSearchItems), and looks pretty good: when I open the feed by clicking on the orange icon, thus opening the feed with the browser facility, both Firefox and IE correctly format all of the dates in italian, even if when I look at the XML source all pubDate tags are in English. Everything ok, isn't it?

However, when I use a newsfeed module (04.00.01) to parse that feed, dates are shown in English. I tried modifying the xsl to show the value of the Locale parameter, but it looks like it's empty.
Am I missing something? Or should I manually format my dates, manipulating pubDates as strings?

Thanks for any help,

al.

 

 
New Post
5/18/2009 12:43 PM
 

RSS always display dates in standard format, you need to apply formatting in your XSL stylesheet.


Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
New Post
5/19/2009 3:57 AM
 

Sebastian,

thank you for explaining me: that "locale" parameter on the stylesheet made me think it was possible to automatically format dates. Maybe such a feature (formatting dates) would be later implemented?

Regards,

al.

 

 
New Post
5/19/2009 11:09 AM
 

AFAIK there is no such feature specified in RSS protocol - and I am not an XSL expert, to improve the default style sheets whether and how to take locale properly into account, sorry.


Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
New Post
7/1/2010 10:59 AM
 
I stole code from here:

http://geekswithblogs.net/workdog/archive/2007/02/08/105858.aspx

modified it to work within the default.xsl


<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <xsl:output method="html" indent="yes"/>
 <xsl:param name="ItemsToShow"/>
 <xsl:param name="ShowItemDetails"/>
 <xsl:param name="ShowItemDate"/>
 <xsl:param name="Locale"/>
 
 <xsl:template match="rss">
  <xsl:for-each select="channel/item[position()&lt;=$ItemsToShow or $ItemsToShow&lt;1]">
   <p class="DNN_News_ItemLink">
    <a href="{link}" target="_main">
     <xsl:value-of select="title"/>
    </a>
   </p>
   <xsl:if test="$ShowItemDate='true'">
    <p class="DNN_News_ItemDate">
     <xsl:element name="newdate">
      <xsl:call-template name="FormatDate">
        <xsl:with-param name="DateTime" select="pubDate"/>
      </xsl:call-template>
     </xsl:element>
    </p>
   </xsl:if>
   <xsl:if test="$ShowItemDetails='true'">
    <p class="DNN_News_ItemDetails">
     <xsl:value-of select="description" disable-output-escaping="yes"/>
    </p>
   </xsl:if>
  </xsl:for-each>
 </xsl:template>
 
 
 <xsl:template name="FormatDate">

    <xsl:param name="DateTime" />

    <!-- new date format 2006-01-14T08:55:22 -->
    <!--                 Thu, 01 Jul 2010 06:30:00 +0200 -->

    <xsl:variable name="weekday">

      <xsl:value-of select="substring($DateTime,1,3)" />

    </xsl:variable>

    <xsl:variable name="day-temp">

      <xsl:value-of select="substring-after($DateTime,', ')" />

    </xsl:variable>

    <xsl:variable name="day">

      <xsl:value-of select="substring-before($day-temp,' ')" />

    </xsl:variable>

    <xsl:variable name="month-temp">

      <xsl:value-of select="substring-after($day-temp,' ')" />

    </xsl:variable>
    
    <xsl:variable name="mo">

      <xsl:value-of select="substring($month-temp,1,3)" />

    </xsl:variable>
    
    <xsl:variable name="year-temp">

      <xsl:value-of select="substring($month-temp,5)" />

    </xsl:variable>
    
    

    <xsl:variable name="year">

      <xsl:value-of select="substring($year-temp,1,4)" />

    </xsl:variable>

    <xsl:variable name="time">

      <xsl:value-of select="substring-after($year-temp,' ')" />

    </xsl:variable>

    <xsl:variable name="hh">

      <xsl:value-of select="substring($time,1,2)" />

    </xsl:variable>

    <xsl:variable name="mm">

      <xsl:value-of select="substring($time,4,2)" />

    </xsl:variable>

    <xsl:variable name="ss">

      <xsl:value-of select="substring($time,7,2)" />

    </xsl:variable>
    
    <xsl:choose>

      <xsl:when test="$weekday = 'Mon'">Maa</xsl:when>

      <xsl:when test="$weekday = 'Tue'">Din</xsl:when>

      <xsl:when test="$weekday = 'Wed'">Woe</xsl:when>

      <xsl:when test="$weekday = 'Thu'">Don</xsl:when>

      <xsl:when test="$weekday = 'Fri'">Vrij</xsl:when>

      <xsl:when test="$weekday = 'Sat'">Zat</xsl:when>

      <xsl:when test="$weekday = 'Sun'">Zon</xsl:when>

    </xsl:choose>
    
        <xsl:value-of select="', '"/>

    
    <xsl:if test="(string-length($day) &lt; 2)">

      <xsl:value-of select="0"/>

    </xsl:if>

    <xsl:value-of select="$day"/>

        <xsl:value-of select="' '"/>

    
    <xsl:choose>

      <xsl:when test="$mo = 'Jan'">Jan</xsl:when>

      <xsl:when test="$mo = 'Feb'">Feb</xsl:when>

      <xsl:when test="$mo = 'Mar'">Maa</xsl:when>

      <xsl:when test="$mo = 'Apr'">Apr</xsl:when>

      <xsl:when test="$mo = 'May'">Mei</xsl:when>

      <xsl:when test="$mo = 'Jun'">Jun</xsl:when>

      <xsl:when test="$mo = 'Jul'">Jul</xsl:when>

      <xsl:when test="$mo = 'Aug'">Aug</xsl:when>

      <xsl:when test="$mo = 'Sep'">Sep</xsl:when>

      <xsl:when test="$mo = 'Oct'">Okt</xsl:when>

      <xsl:when test="$mo = 'Nov'">Nov</xsl:when>

      <xsl:when test="$mo = 'Dec'">Dec</xsl:when>

    </xsl:choose>

    <xsl:value-of select="' '"/>
    
    <xsl:value-of select="$year"/>

    <xsl:value-of select="' '"/>
    
    <xsl:value-of select="$hh"/>

    <xsl:value-of select="':'"/>

    <xsl:value-of select="$mm"/>

    <xsl:value-of select="':'"/>

    <xsl:value-of select="$ss"/>

  </xsl:template>
 
</xsl:stylesheet>

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsNews FeedsNews FeedsProblems with locale and date formatProblems with locale and date format


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out