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

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesLocalResouceFile HelpLocalResouceFile Help
Previous
 
Next
New Post
3/19/2011 9:43 AM
 
Absolute rank amateur question but ...

I have created a new file called mailer.cs and placed it in the App_Code folder.

I am trying to create a resource file for the mailer.cs but i can't reference it inside my custom mailer.cs file. Should i create a mailer.cs.resx file in my App_LocalResources folder inside my module directory.

How do i link my mailer.cs file to my mailer.resx file?
 
New Post
3/19/2011 6:49 PM
 
Hi SJV



Usual way to do this is to have in your app_LocalResouce directory as a sub directory of your module directory under Desktop modules. Your module in this case will be a pre-compiled assembly and the output will reside in the bin directory. The resource file will usually be associated with the ascx file as in filename.ascx.resx. Not sure exactly how it might hang together if you are generating cs files directly in the app_code directory (of the main website I presume?) DNN Modules reference the ascx files and the dll outputs provide the code behind.

Colm Ryan Director
3rd i IT and Business Services Limited

www.actravia.com
Registration and Booking Solutions for Dotnetnuke
www.3rdi.ie
IMCA Registered Management Consulting Practice. Business and IT Strategy, IT Project Management and Product Development
 
New Post
3/21/2011 8:57 AM
 
Hi Colm,

Thanks for the response, it clears it up for me why i can't directly access the resource file.

I was looking through the Localization Document with DotNetNuke and it seems to say it can be done. I found the below wording.


If you need to get a message from a class that is not directly tied to a visual control (user

control or page), for example a component class, you have to include the resources for

this messages in a special resource file (SharedRecources.resx) and specify this file in the

method call.

You can also use this feature to centralize in a single file common messages that are used

in many places in the module, preventing to have to localize the same messages in more

than one file.

Sample bad code:

Class ObjectController

Public Function AMethod() As String

return “a message”

End Function

End Class

Which should be corrected to:

Class ObjectController

Private SharedResourceFile As String = ApplicationPath + “/DesktopModules/<ModuleFolder>/App_LocalResources/SharedResources.resx”

Public Function AMethod() As String

return Localization.GetString(“Message”, SharedResourceFile)

End Function

Now frustratingley im a self taught C# guy which will come handy in the summer but for now i have to convert Vb to C#. Which with the above seems pretty simple, except i can't seem to access the ApplicationPath property within my mailer.cs file. Is there a different class to access in C# (or is that a dumb question)?

If there is, or there is another way, will the above example work?

 
New Post
3/21/2011 9:06 AM
 
I think i found it (embarrisngley)

is it

Request.ApplicationPath + // .resx file path
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesLocalResouceFile HelpLocalResouceFile Help


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