0

Is there a way to use or render the culture code (e.g. "en-US" or "fr-FR") in an HTML module using the Community edition of DotNetNuke 7?

My objective is to pass this into the iFrame URL that's inside the HTML module, along these lines:

<iframe src="http://www.awesome.com?language=[Language:Culture]" />

I've tried several things to find out how (or even if) this is possible:

  • Googling for queries such as "DotNetNuke 7 language token in html module". This leads to many older pages, the best one being a page that mentions many tokens but not one of them being the one I need.

  • Browsing the source code of DotNetNuke (specifically TokenReplace.cs). This hints that there's no [Language:...] tokens available at all.

  • Just plain trying things, like [Language:culture], but this gives an error:

    Error accessing [Language:culture], Language is an unknown datasource.

  • Going through all the settings, trying to find any way to make the module respond to the selected language somehow. The only thing I found is a (promising) "Module Culture" setting, which I expected to be useful (show module only in a certain culture would be enough for my use case). However, this setting...

    setting in DNN

    ...is not something you can set. Perhaps this is because the HTML module doesn't support interaction with cultures at all?

Can anyone tell me if there's a way to do something along these lines with the community edition? Or do I have to either making my own module or resort to hacks involving javascript and whatnot?

Jeroen
  • 60,696
  • 40
  • 206
  • 339

1 Answers1

2

initial notes:

  • by default pages are neutral, but after enabling multilingual portals, your pages culture will change to the default language, you could check that in page setting (looks like your screenshot for the module)
  • all the modules inside a page has the same culture as its page.
  • so if your module's culture is neutral, it means your page is neutral and it means you didn't enabled multilingual.

you have to:

  1. enable DNN multilingual option in:
    • host > host settings > other settings > Allow Content Localization
  2. set a default language (not change-able later) and make a list of languages that you want for your portal.
    • admin > languages
  3. make your site ready for multiple languages. (not undo-able)
    • this undo-able operation will make a copy of all pages and their modules from your pages with your default language (not neutral ones) for each language you had in your languages list. it means after this, you'll have acopy of each page/module in each language. they could have a totally different content/setting but they are only related together (considered as same thing, but in different languages) so user could change language and see the correct page in other language. note that these pages in different languages are not the same page as their default so they have a separate tabid. so no need for a language token each page in each language has a separate copy of the module.
    • admin > languages > Enable Localized Content
  4. each copy needs to be published first, otherwise its only visible by translators group/role (and its not public), so you have to mark copied modules and pages as translated on-by-one. of course after translating and upgrading its content and settings.
    • for easier translation and marking and managing module relations across linked pages in different language, I suggest you to use http://dnncltools.codeplex.com/, using this tool its easier to use the same module across different languages instead of using its copies.
  5. so if you make module available across multiple pages, now you really need a module capable of using multiple languages like you asked. for HTML module use http://nuntiocontent.codeplex.com/
  6. after marking all as translated, you have to publish them, so they'll get a normal view permission.
    • admin > languages > publish icon in front of each language row
Unicornist
  • 841
  • 13
  • 21
  • +1, thanks for taking the time with such an extensive answer! Can't quite accept (yet), as I don't feel like duplicating my *entire portal* to another language for just one `iframe` (I'll stick with just translated labels for now). – Jeroen Oct 09 '13 at 07:20
  • this is the way that DNN multilingual works, if you want to have a single language portal pretending to have more than one languages that's a different thing. you could read the language queryParam in a module you wrote yourself, or even on a javascript in your skin, but certainly HTML module alone will not work for you. – Unicornist Oct 09 '13 at 18:37
  • also in a multilingual portal, you have the choice of marking all pages as translating without translating them and attaching all secondary language modules to their primary ones (instead of copying), but only copy the one you need with `iframe`. – Unicornist Oct 09 '13 at 18:41