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...ERROR in class DotNetNuke.Services.Localization.LocalizationERROR in class DotNetNuke.Services.Localization.Localization
Previous
 
Next
New Post
11/21/2009 8:23 AM
 

   'Error in class DotNetNuke.Services.Localization.Localization;
  'from DotNetNuke Comunity 05.01.04

  ''' -----------------------------------------------------------------------------
  ''' <summary>
  ''' TryGetFromResourceFile is used to get the string from a specific resource file
  ''' </summary>
  ''' <remarks>This method searches a specific resource file for the key.</remarks>
  ''' <param name="key">The resource key</param>
  ''' <param name="resourceFile">The resource file to search</param>
  ''' <param name="portalID">The id of the portal</param>
  ''' <param name="resourceValue">The resulting resource value - returned by reference</param>
  ''' <param name="resourceType">An enumerated CustomizedLocale - Application - 0,
  ''' Host - 1, Portal - 2 - that identifies the file to search</param>
  ''' <returns>True if successful, false if not found</returns>
  ''' <history>
  '''   [cnurse]  01/30/2008  created
  ''' </history>
  ''' -----------------------------------------------------------------------------
  Private Shared Function TryGetFromResourceFile(ByVal key As String, ByVal resourceFile As String, ByVal portalID As Integer, ByVal resourceType As CustomizedLocale, ByRef resourceValue As String) As Boolean

    Dim virtualPath As String = ""
    virtualPath.Substring(


    Dim dicResources As Dictionary(Of String, String) = Nothing
    Dim bFound As Boolean = Null.NullBoolean

    Dim resourceFileName As String = resourceFile
    Select Case resourceType
      Case CustomizedLocale.Host
        resourceFileName = resourceFile.Replace(".resx", ".Host.resx")
      Case CustomizedLocale.Portal
        resourceFileName = resourceFile.Replace(".resx", ".Portal-" + portalID.ToString + ".resx")
    End Select

    If resourceFileName.ToLowerInvariant().StartsWith("desktopmodules") OrElse resourceFileName.ToLowerInvariant().StartsWith("admin") Then
      resourceFileName = "~/" + resourceFileName
    End If

    'Local resource files are either named ~/... or <ApplicationPath>/...
    'The following logic creates a cachekey of /....
    Dim cacheKey As String = resourceFileName.Replace("~/", "/").ToLowerInvariant()


    If Not String.IsNullOrEmpty(ApplicationPath) Then

      'ERROR!!! If a subdirectory or the beginning of the resource file matches ApplicationPath
      '-----------------------------------------------------------------------------------------
      'If ApplicationPath.ToLowerInvariant <> "/portals" Then
      '  cacheKey = cacheKey.Replace(ApplicationPath.ToLowerInvariant(), "")
      'Else
      '  cacheKey = "~" & cacheKey
      '  cacheKey = cacheKey.Replace("~" & ApplicationPath.ToLowerInvariant(), "")
      'End If
      
'-----------------------------------------------------------------------------------------
      'Necessary:
      Dim virtualAppPath As String = ApplicationPath.ToLowerInvariant()
      If cacheKey.StartsWith(virtualAppPath) Then
        cacheKey = cacheKey.Substring(virtualAppPath.Length)
      End If
      '-----------------------------------------------------------------------------------------
    End If

    'Get resource file lookup to determine if the resource file even exists
    Dim resourceFileExistsLookup As Dictionary(Of String, Boolean) = GetResourceFileLookupDictionary()

    If (Not resourceFileExistsLookup.ContainsKey(cacheKey)) OrElse resourceFileExistsLookup(cacheKey) Then
      'File is not in lookup or its value is true so we know it exists
      dicResources = GetResourceFile(cacheKey)

      If dicResources IsNot Nothing Then
        bFound = dicResources.TryGetValue(key, resourceValue)
      End If
    End If

    Return bFound
  End Function

 
New Post
11/21/2009 12:25 PM
Accepted Answer 

 please log bugs and enhancements into the public issue tracker (2nd from top) at support.dotnetnuke.com. Thank you!


Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Language and In...Language and In...ERROR in class DotNetNuke.Services.Localization.LocalizationERROR in class DotNetNuke.Services.Localization.Localization


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