Products

Solutions

Resources

Partners

Community

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...Provider and Extension ForumsProvider and Extension ForumsLanguage PacksLanguage PacksLocalization in core SchedulerLocalization in core Scheduler
Previous
 
Next
New Post
2/5/2006 12:50 PM
 
Hello

I am trying to localize the birthday email sent in my schedule item in the scheduler.
However - the DotNetNuke.Services.Localization.GetString() method uses the following line:

Dim objPortalSettings As PortalSettings = CType(HttpContext.Current.Items("PortalSettings"), PortalSettings)

Of course, you can't access the current context in the scheduler as it is not associated to a request - hence this falls over and you effectively cannot localize schedule content. Is this a correct assumption?
Is there any other way to handle localization in the scheduler with this in mind?

Here are some threads on similar topics:
http://forums.asp.net/1052637/ShowPost.aspx
http://forums.asp.net/846031/ShowPost.aspx

Entrepreneur

PokerDIY Tournament Manager - PokerDIY Tournament Manager<
PokerDIY Game Finder - Mobile Apps powered by DNN
PokerDIY - Connecting Poker Players

 
New Post
2/6/2006 3:50 AM
 
Rodney,
you can try another overload for that method:
        Public Shared Function GetString(ByVal name As String, ByVal ResourceFileRoot As String, ByVal objPortalSettings As PortalSettings, ByVal strLanguage As String) As String

You should pass a valid PortalSettings object to avoid for obtaining it on the httpcontext. There a couple of overloads for that method take a look at them, but I think the above one could do the job for your situation.

Vicenç Masanas
Banyoles, Girona - Spain

Disgrafic.com    PSD to DNN
 
New Post
2/6/2006 4:45 AM
 
Thanks Vicenç - I started down this route, but this implies that I am looking at a particular portal - but I am not - it just needs to send a customizable message - I guess this is the problem - it needs to look at the default culture for that Portal - and yet the schedule is not necessarily related to a portal - perhaps I could chaneg the design of my schedule item to function by Portal instead...

I presume I can create PortalSettings without a current context? Just pass in the portal ID....

I'll look into it...

Entrepreneur

PokerDIY Tournament Manager - PokerDIY Tournament Manager<
PokerDIY Game Finder - Mobile Apps powered by DNN
PokerDIY - Connecting Poker Players

 
New Post
12/5/2008 3:17 PM
 

 Hi, I'm trying to do the same thing, to use localization from a scheduled task.

I tried the way you suggest, with no luck, here is the code:

OPTION 1:

 

       Private Function GetLocalizedString(ByVal key As String, ByVal portalId As Integer) As String

            Dim objPortalController As PortalController = New PortalController

            Dim objPortalInfo As PortalInfo = objPortalController.GetPortal(portalId)

            Dim objPortalSettings As PortalSettings = GetPortalSettings(objPortalInfo)

            Return Localization.GetString(key, SharedResourceFile, objPortalSettings, objPortalInfo.DefaultLanguage)

        End Function

 

        Private Function GetPortalSettings(ByVal objPortalInfo As PortalInfo) As PortalSettings

            Dim p_Alias As PortalAliasCollection = New PortalAliasCollection

            Dim strAlias As String = String.Empty

            Dim ctlPortalAlias As PortalAliasController = New PortalAliasController

            p_Alias = ctlPortalAlias.GetPortalAliasByPortalID(objPortalInfo.PortalID)

 

            For Each key As String In p_Alias.Keys

                If Not String.IsNullOrEmpty(key) Then

                    strAlias = key

                    Exit For

                End If

            Next

            'Throws an exeption in the following line

            Dim p_Settings As PortalSettings = New PortalSettings(objPortalInfo.HomeTabId, p_Alias.Item(strAlias))

            Return p_Settings

        End Function

 

OPTION 2:

       Private Function GetLocalizedString(ByVal key As String, ByVal portalId As Integer) As String

            Dim objPortalController As PortalController = New PortalController

            Dim objPortalInfo As PortalInfo = objPortalController.GetPortal(portalId)

          

            'Throws an error in the next line

            Return Localization.GetString(key, SharedResourceFile, objPortalInfo.DefaultLanguage)

        End Function

 

Any help will be appreciated

 




Javier Rodríguez
CTO
www.AccordLMS.com
1775 W. State Street Suite 371, Boise ID 83702 USA
 
 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Provider and Extension ForumsProvider and Extension ForumsLanguage PacksLanguage PacksLocalization in core SchedulerLocalization in core Scheduler


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