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

HomeHomeDNN Open Source...DNN Open Source...Provider and Extension ForumsProvider and Extension ForumsLanguage PacksLanguage PacksIdea - Dynamic Localization > Thoughts?Idea - Dynamic Localization > Thoughts?
Previous
 
Next
New Post
7/12/2006 1:02 PM
 

I have been toying with an idea that would not affect the DNN Core, would work with any ASP.Net site (not just DNN) to dynamically inject a translation into a controls presentation layer (text, value, items, etc).  The following is some psuedo code/table design for example purposes, but I believe the concept could work.  I do have some of it built and it works fine (the Find Control stuff works great), but need some advice...

Database Table Design:

fld_Value = NTEXT (the field datatype)

fld_Id fld_Language fld_Control_Id fld_Value
1 en-CA lbl_Message Hello
2 fr-CA lbl_Message Bonjour
3 fr-GE lbl_Message Hallo

User navigates to the site.  They change the Language choice or a value stored in a cookie remembers the language preference.  Code in the module determines if a Site Wide Array is available.  This array is filled with values required to populate controls on the Portal for the selected language.   If the Site Wide Array does not exist, then it is created on the fly based on the language of choice.  The values in the array are populated with values in a database table, similar to the design shown above.

Question?  Is it possible to store values from a database table to an Array that is available Site wide? Or is there some other method we could use to hold values that are available on the site but accessible to any asp.net web page/dnn module.  Thought...I think it would be better to store the different languages in there own array and have them available when called upon from code to update a control presentation property.

So if we are able to create a Site Wide Array then in the DNN module we access a function in the Page_Load or Page_Init event. 

The function loops through all controls on the page. In a Select Case we take the Control_Id and filter the array for the value.  For example if the user has selected French Canadian we inspect the fr-CA array.  We then isolate the value(s) for the Control_Id found in the Find Control Function.  In the Select Case we pass the value in the Array to the Control_Id presentation property.

For example if we have a label and the control_id is lbl_Message, and the language of choice is fr-CA then the return value from the Array is Bonjour.  The text property of the control is set to "Bonjour".

If the control on the page is a drop down list then a function clears the list and passes the values from the array to the drop down list (So in the table we would have for example 5 records with the same Control_Id and fld_Language.

All we need is one or more functions to handle the various ASP.Net controls.  I haven't put much thought into handling a GridView or DataGrid at the moment, but the Site Wide Array is the tricky part.

Thoughts on the Idea? Site Wide Array?  Can it be done?

Thanks,

eformx - www.soccermanager.ca

Ps.  The Find Control code...

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Try

If Not Page.IsPostBack Then

'Use the following to call the private procedure from the Page_Load

LoopControls(Page)

End If

Catch exc As Exception 'Module failed to load

ProcessModuleLoadException(Me, exc)

End Try

End Sub

'the private procedure

Private Sub LoopControls(ByVal parent As Control)

Dim c As Control

For Each c In parent.Controls

If c.GetType() Is GetType(TextBox) Then

'Do something with the TextBox

DirectCast(c, TextBox).Text = "Hi eformx"

'pass control id to stored procedure or array to get language for control

Dim strMy As String = c.ID

End If

If c.HasControls Then

LoopControls(c)

End If

Next

End Sub

 
New Post
7/13/2006 2:14 AM
 

i'm not sure what you are suggesting here. This seems like static localization to me (localization of controls), which is already built in into DNN. In order to offer dynamic localization.. how would the core ever now about the datastructure behind a module? If and when we get dynamic localization IMHO it will always be the module that is responsible for getting the correct localized content.. btw.. this is already possible for modules to do (there are already modules available that offer content localization)

cheers,

Erik


Erik van Ballegoij, Former DNN Corp. Employee and DNN Expert

DNN Blog | Twitter: @erikvb | LinkedIn: Erik van Ballegoij on LinkedIn

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Provider and Extension ForumsProvider and Extension ForumsLanguage PacksLanguage PacksIdea - Dynamic Localization > Thoughts?Idea - Dynamic Localization > Thoughts?


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