Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

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

HomeHomeUsing DNN Platf...Using DNN Platf...Language and In...Language and In...Localization of user controls inside a user controlLocalization of user controls inside a user control
Previous
 
Next
New Post
2/20/2008 10:28 PM
 
Chuck, If your resource filename for the control is ImageViewer2.ascx.resx, then you need to rename it to ImageViewer2.ascx.resx to cltImageList.ascx.resx.
 
New Post
2/20/2008 10:50 PM
 

To Chuck -

Thanks for posting your code as I can now see exactly what you're up against.  See my reply to "JiGong" below for a couple of solutions and the reason for this.

When you initialize the child control's ModuleConfiguration to that of the main control you need to do so not in the Page_Load of the child control but rather in the Page_Load of the main control:

ctlImageList.ModuleConfiguration = Me.ModuleConfiguration


Bill, WESNet Designs
Team Lead - DotNetNuke Gallery Module Project (Not Actively Being Developed)
Extensions Forge Projects . . .
Current: UserExport, ContentDeJour, ePrayer, DNN NewsTicker, By Invitation
Coming Soon: FRBO-For Rent By Owner
 
New Post
2/20/2008 11:12 PM
 

"JiGong" -

You're on the correct track! Because the LocalResourceFile property of PortalModuleBase uses the control's ID property as the base name of the resource file from which localization will be read, you are correct that the resource file would have to be named "ucControlA.ascx.resx" (or in Chuck's case "ctlImageList.ascx.resx"). While this will work nicely, I'm not sure that I would want to name my resource file to that of a specific control ID.  Here are three of other solutions (I usually use the first or the third approach).

1. Place all of the localization key-value pairs not in a separate resource file for the child control but rather in the resource file for the main control (Main.ascx.resx) and include the following assignments in the Page_Load handler of the main control:

ucControlA.ModuleConfiguration = Me.ModuleConfiguration             'Not needed for localization but helpful for other purposes
ucControlA.LocalResourceFile = Me.LocalResourceFile                 'Use main control's resource file for localizing child control

2. Create the desired ControlA.ascx.resx resource file and set the LocalResourceFile property of the child control to point to this file (in somewhat of a hack) - again in the Page_Load of the main control:

ucControlA.LocalResourceFile = Me.LocalResouceFile.Replace(Me.ID, "ControlA")

3. In your child control, override the LocalResouceFile property as follows:

Public Property LocalResourceFile () As String
       Get
          If _localResourceFile = String.Empty Then
                _localResourceFile = Me.TemplateSourceDirectory & "/" & Services.Localization.Localization.LocalResourceDirectory & "/ControlA"
          End If
          Return _localResourceFile
      End Get
      Set (ByVal Value As String)
          _localResourceFile = Value
      End Set
End Property

NOTE on post EDIT: On thinking about this overnight and verified this morning - You CANNOT overrride the property LocalResourceFile as it is NOT declared overridable in PortalModuleBase.  I've written the above property code before in a number of child controls but they did NOT inherit from PortalModuleBase but rather from Framework.UserControlBase which does not have a LocalResourceFile property

Generally if the child control is not reusable outside the module control I use the first solution and use the third solution for reusable child or general purpose user controls controls used in several modules. The second approach is one I just thought up tonight but which has not been extensively tested.


Bill, WESNet Designs
Team Lead - DotNetNuke Gallery Module Project (Not Actively Being Developed)
Extensions Forge Projects . . .
Current: UserExport, ContentDeJour, ePrayer, DNN NewsTicker, By Invitation
Coming Soon: FRBO-For Rent By Owner
 
New Post
2/21/2008 12:26 AM
 

Hi Bill,

Thanks a lot. With the codes, you just solved my next question.

Btw, you got a nice Prayer module. It is based on the Event Module by DNN?

 
New Post
2/21/2008 7:05 AM
 

Hi JiGong -

The ePrayer module is custom - not based on the DNN Event module.


Bill, WESNet Designs
Team Lead - DotNetNuke Gallery Module Project (Not Actively Being Developed)
Extensions Forge Projects . . .
Current: UserExport, ContentDeJour, ePrayer, DNN NewsTicker, By Invitation
Coming Soon: FRBO-For Rent By Owner
 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Language and In...Language and In...Localization of user controls inside a user controlLocalization of user controls inside a user control


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