+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Sitefinity -- multi_language support

Sitefinity -- multi_language support

16 posts, 0 answered
  1. Allan Lazaro
    Allan Lazaro avatar
    10 posts
    Registered:
    15 Jul 2009
    27 Jul 2009
    Link to this post
    Hi,

    I've seen how Sitefinity provides localization and multi_language support. With the Language Selector control, when a Language is chosen, I need to do the following:

    1. For user controls (ascx), how would I access the Language Selector control and read it's currently selected value. This way, I can render the user control contents appropriately based from the Language Selector language value.

    2. Our site has secured pages where Users need to login. Once User is logged-in, a stored Language Preference value is retrieved and based from its value, all pages (Sitefinity contents and user controls) need to be rendered to the stored Language Preference. The Language Preference value is chosen by Users upon registration. When they login back, the Language Preference is retrieved and stored in Session so it can be accessed by other user controls.

    I need to disable the Language Selector and set it to the retrieved Language Preference. This is because Users are not allowed to toggle to another Language when their Language Preference has been set.

    3. Also for flexibility, is it possible to programatically create a cookie when the Language Selector value is changed?

    Thanks and your reply is appreciated.
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    28 Jul 2009
    Link to this post
    Hello Allan Lazaro,

    Thank you for using our services. Let me try to address your questions one by one.

    1) You can take a look at the following KB article - Enabling localization and globalization in Sitefinity. You can follow the same approach for the user controls you have developed, as to the approach for Sitefinity's user controls.

    2) First of you can take a look at this webinar - Membership & Role Providers Webinar. There you can find how to add custom fields to users profile. Now you should follow this approach and add your custom field that will store your user's preferred language setting. Next you will have to make your custom Login Control. You can actually wrap a asp:Login control in a user (.ascx) control. Then you should override the LoggedIn method. The overridden method should check the preferred language field in the user's profile and construct destination url based on the persistence method you have chosen for localization. For example if you have chosen PathPrefix for localization persistenceMode, and your user has chosen English as their default language you can construct the URL like this: http://www.mysite.com/en/home.aspx.

    3) This is also possible, however I am not sure if anyone has tried it yet. You can create your custom control that will inherit from Telerik.Localization.WebControls.LanguageBar, from the Telerik.Localization namespace. Then you should override the OnLanguageChanged method to add your desired functionality. You can also configure the control to look for that cookie information on Page_Load() and set the selected language based on the cookie. Then you can add your custom control to the templates (masterpages) that your website is using.

    If you need this for the admin view, you can see that when you select My Preferences, you can se your proffered language.

    I hope that you will find the provided information useful. If you have more questions, please feel free to contact us.

    Kind regards,
    Rado
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Allan Lazaro
    Allan Lazaro avatar
    10 posts
    Registered:
    15 Jul 2009
    28 Jul 2009
    Link to this post
    Was wondering if you can show some code particularly the third item.

    Thanks.
  4. Allan Lazaro
    Allan Lazaro avatar
    10 posts
    Registered:
    15 Jul 2009
    28 Jul 2009
    Link to this post
    Just wanted to add some more details on what I'm trying to accomplish:

    Our .master page is a Sitefinity template I believed. When we have enabled localization in Sitefinity, I think this is where the LanguageSelector control is added. We have number of content pages (aspx), in which user controls are linked (ascx) in it. The aspx are in Sitefinity and all the aspx are easily converted to support localization using Sitefinity framework.

    On the master page with the LanguageSelector, I want to put a code to create a client cookie so that the user controls (ascx) would be able to check its value on Page_Load.

    Thanks.
  5. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    30 Jul 2009
    Link to this post
    Hi Allan Lazaro,

    Thank you for getting back to me.

    I probably did not clarify the questions well enough. Since Sitefinity is an ASP.NET CMS it uses ASP.NET's methods for localizing pages and user controls. With that being said you can take a look at ASP.NET Globalization and Localization topic in MSDN Knowledge Base. You can use the Telerik.Localization API to set the current culture. That means that you do not need to go to the extent to persist cookies in order to know which language to use.

    I could not understand what type of problems you have when localizing custom user controls. The method is the same as described in the KB article I pointed you in my previous reply. I have attached a sample of custom user control (.ascx) that is localized both for English and French. If you take a look at the archive, you just need to create App_LocalResources directory in the folder of your control and then create local resource files with the name of this control for each culture. Please take a look at the attached archive.

    Now as you see, shenever you want some labels, or text localized, yuo just have to use this:
    <asp:Literal ID="LocalizableLiteral" runat="server" Text="<%$Resources:LocalizableLiteral%>" /> 
    and then define the text in your resources for the controls. Furthermore, if you want to create your custom module, and controls that will use content form that module, you should take a look at the sample Products Module. It is a custom generic content based module, that is localizable.

    Now lets move to your user part. You can create a custom HTTP module, that will check if the current culture name is equal to the preferred language set in the profile of the logged in user.

    So here is a suggestion what you can do. You can have your public pages (accessible to non autheticated users) use templates that have the language bar control in them. Then the members only pages can use templates that do not have the language bar on them.

    Here is a sample how to achieve this. First off as described in the webinar I pointed you to, you should add custom fields to users' profiles like this:
    <profile defaultProvider="Sitefinity"
        <providers> 
        <clear/> 
        <add name="Sitefinity" connectionStringName="DefaultConnection" applicationName="/" type="Telerik.DataAccess.AspnetProviders.TelerikProfileProvider, Telerik.DataAccess"/> 
        </providers> 
        <properties> 
        ... 
            <add name="PreferredLanguage"/> 
            ... 
        </properties> 
    </profile> 


    Then you can add fields in your controls for registering users, and managing their profiles. You can do it like this:
    <asp:Label ID="lblLanguage" Text="Preferred Language" runat="server" />   
    <asp:DropDownList ID="PreferredLanguage" runat="server"
        <asp:ListItem Text="English" Value="en" Selected="True" /> 
        <asp:ListItem Text="French" Value="fr" /> 
    </asp:DropDownList>    

    Now lets move to the custom HTTP module. I have prepared a sample one for you. You can find it attached. Here its what it does - it inherits from Sitefinity's CmsHttpModule, and overrides the method that checks if a user is authenticated. If true, then define the culture for the UI to the preferred one set in user's profile. To try this module out extract it to ~/App_Code/ directory in your project solution. Then open the web.config and find the following line:
    <httpModules> 
          ... 
          <add name="Cms" type="Telerik.Cms.Web.CmsHttpModule, Telerik.Cms"/> 
          ... 
    </httpModules> 

    And substitute it with the following:
    <add name="Cms" type="Telerik.Samples.CustomCmsHttpModule.CustomCmsHttpModule, App_Code"/> 

    This should do what you desire. If you have more questions, please feel free to contact us.

    Greetings,
    Rado
    the Telerik team

    Instantly find answers to your questions on the newTelerik Support Portal.
    Check out the tipsfor optimizing your support resource searches.
  6. Allan Lazaro
    Allan Lazaro avatar
    10 posts
    Registered:
    15 Jul 2009
    31 Jul 2009
    Link to this post
    Hi,

    Thanks for your reply to my support request.

    I have tried the CustomCmsHttpModule as you have suggested in the previous post. The VS Intellisense complains regarding the line

       bool isAuthenticated = base.IsAuthenticated(context, ensureRoleProvider);

    The CmsHttpModule class does not have this method. Even after I replace it with my code below, the rebuild fails because of the override in the declaration --

       protected override bool IsAuthenticated(HttpContext context, bool ensureRoleProvider)

    Again because CmsHttpModule does not have the IsAuthenticated method to be overridden.

    I copied my code below.

    Thanks.

    allan

    ---------------------------

    using System;
    using System.Collections.Generic;
    using System.Web;
    using Telerik.Cms.Web;
    using System.Web.Profile;
    using System.Globalization;
    using Purolator.PWS.Microsite.Common;

    /// <summary>
    /// Summary description for CustomCmsHttpModule
    /// </summary>
    namespace Telerik.Samples.CustomCmsHttpModule
    {
        /// <summary>
        /// Summary description for TestHttpModule
        /// </summary>
        public class CustomCmsHttpModule : CmsHttpModule
        {
            //override default method to set the preffered language user interface
            protected override bool IsAuthenticated(HttpContext context, bool ensureRoleProvider)
            {
                //bool isAuthenticated = base.IsAuthenticated(context, ensureRoleProvider);
                string preferredLanguage = String.Empty;
                preferredLanguage = context.Session[Constants.PWS_MICROSITE_CURRENTUSERPREFERREDLANGUAGE] == null ? null : context.Session[Constants.PWS_MICROSITE_CURRENTUSERPREFERREDLANGUAGE].ToString().ToLower();

                bool isAuthenticated = (String.IsNullOrEmpty(preferredLanguage) ? false : true);

                if (isAuthenticated && CmsUrlContext.Current != null && context.Items[UrlHelper.EditModeKey] == null)
                {
                  
                    base.SetCurrentCulture(new CultureInfo(preferredLanguage)); //preferredLangauge evaluates to "en" or "fr"
                }
                return isAuthenticated;
            }
        }
    }
  7. Allan Lazaro
    Allan Lazaro avatar
    10 posts
    Registered:
    15 Jul 2009
    31 Jul 2009
    Link to this post
    Just wanted to add some more info and what I have done already following your suggestions with regards to this thread.

    1. Here's my web.config <localization /> setting  --

        <localization defaultProvider="Sitefinity" persistenceMode="PathPrefix" defaultCulture="en" cultures="en, fr">
          <providers>
            <clear />
            <add name="Sitefinity" type="Telerik.Localization.Data.DefaultProvider, Telerik.Localization.Data" connectionStringName="DefaultConnection" />
          </providers>
        </localization>

    2. With regards to my user controls, it works okay with the LanguageBar together with the contents (aspx), toggling to either Language on the anonymous pages change both contents (aspx) and the user controls (ascx) to the corresponding language selected.

    3. My remaining problem is when the User has logged-in -- I tried implementing your CustomCmsHttpModule and I could not successfully build it. Problem I'm getting is in my previous post (prior to this one).

    4. I tried to implement same thing as what you did in the CustomCmsHttpModule in my .master files (I have one for en and fr). So when User logs in, I created a Session variable to contain the preferred language as retrieved from SQL Server d/b to persists it. In the .master Page_Load, I have this code snippet to hide the LanguageBar and set CultureInfo --

            if (!String.IsNullOrEmpty(Session[preferredLanguage])
            {
                this.cphLanguageSelector.Visible = false;                          //hide LanguageSelector bar ContentPlaceHolder

                System.Threading.Thread.CurrentThread.CurrentUICulture =
                    new System.Globalization.CultureInfo(Session[preferredLanguage].ToString().ToLower());
            }

    5. Result of # 4 --
        -- the LanguageSelector is hidden which satisfies what I wanted. User won't be able to change Language.
        -- my User Controls (ascx) are properly rendered on the preferred language User have set in their profile
       [THIS IS THE PROBLEM]
        -- the contents (aspx which are hosted in Sitefinity) are not in the correct language, it remains on the same language before User had logged in.

    I noticed that the url remains on the same language prior to logging in, e.g., /site/en/Default.aspx.  When I manually change the url for example to site/fr/Default.aspx, since I know that the preferred language is "fr",  then that's the time the contents (aspx) are rendered properly.

    PS: I did not implement your suggested way of using templates to manage the PreferredLanguage in the secured pages because I have already implemented it and it works okay. I already have User Controls for managing User profile. I don't think this is necessary to make this thing working, right? Or the CustomCmsHttpModule relies on this?

    Thanks for your patience replying to this thread.

    allan
  8. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    03 Aug 2009
    Link to this post
    Hello Allan Lazaro,

    Thank you for getting back to us.

    Let me first start off with your previous to last reply. The CmsHttpModule that I have sent you has the isAuthenticated function. It is as follows: Telerik.Cms.Web.CmsHttpModule.isAuthenticated(HttpContext context, bool ensureRoleProvider). You can try the override declaration with the full namespace, class and method call to see if will build.

    Now to your last post. I suggested using the CmsHttpModule since it will perform the operations prior to the page load event. Anyhow in both cases (my suggestion and your implemantation in master pages) you have to do one more thing. You will have to reconstruct the URL and make a redirect to it. Instead of loading the default URL, you have to reconstruct it with the current culture in it.

    Just one more note. When doing this first perform necessary checks to see if the current culture is the same as the one in the profile. If you do not do this and perform a redirect on every request your performance will suffer, plus you might get into an endless loop.

    Please give the suggested sollutions a try and get back to us.

    Greetings,
    Rado
    the Telerik team

    Instantly find answers to your questions on the newTelerik Support Portal.
    Check out the tipsfor optimizing your support resource searches.
  9. Allan Lazaro
    Allan Lazaro avatar
    10 posts
    Registered:
    15 Jul 2009
    04 Aug 2009
    Link to this post
    I tried implementing the CmsHttpModule as you have suggested to use the full namespace but it still failed building in VS 2008.

    Since it won't build, I tried copying the class file to the App_Code folder in my dev server -- hoping that perhaps it would work on my dev server since I have Sitefinity installed completely there.

    What I got is a compile time error, same error I got when building it in VS2008 --

    Compilation Error

    Server Error in '/Site' Application.

    Compilation Error

    Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

    Compiler Error Message: CS0106: The modifier 'override' is not valid for this item

    Source Error:

    Line 14:     public class CustomCmsHttpModule : CmsHttpModule
    Line 15:     {
    Line 16:         protected override bool Telerik.Cms.Web.CmsHttpModule.isAuthenticated(HttpContext context, bool ensureRoleProvider)
    Line 17:         {
    Line 18:             //bool isAuthenticated = base.IsAuthenticated(context, ensureRoleProvider);

    Source File: d:\PWSWeb\App\PWSWeb\Microsite\App_Code\CustomCmsHttpModule.cs    Line: 16



    c:\windows\system32\inetsrv> "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\csc.exe" /t:library /utf8output /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\41970882\fa4137e8_7701ca01\Telerik.Libraries.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\30ce347c\72c599e7_7701ca01\NNMySQLProvider.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\82ef68ae\b2bc18e8_7701ca01\Telerik.Forums.Data.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\da0b7da4\eae15be8_7701ca01\Telerik.Notifications.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\905f2575\3098f36b_f011ca01\Purolator.PWS.Microsite.DataContracts.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\733537fd\31c2a3e8_7701ca01\Telerik.Versioning.Data.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\b5fcaea3\076ff2e7_7701ca01\Telerik.Blogs.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\950d81ef\faa721e9_7701ca01\Xceed.FileSystem.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\98dcdc00\9e62d654_7701ca01\Microsoft.Practices.EnterpriseLibrary.Logging.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\0a113765\a4d95fe8_7701ca01\Telerik.Personalization.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\15b628f9\be44fde7_7701ca01\Telerik.DataAccess.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\363f6761\25f622e8_7701ca01\Telerik.Forums.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\92648cd8\ac9a74e8_7701ca01\Telerik.Rss.DLL" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\c6e31994\d5c016e8_7701ca01\Telerik.FileManager.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\abe45137\7014176e_f011ca01\Purolator.PWS.Microsite.Translator.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\49b8d34f\206d8277_f011ca01\Purolator.PWS.Microsite.Clients.Common.DLL" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\b974e6f4\abf59de8_7701ca01\Telerik.Testimonials.Data.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\318f927d\70f38467_f011ca01\Purolator.PWS.Microsite.Business.Entities.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\0788d029\c4cc8be8_7701ca01\Telerik.Security.Data.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\a5bf3e50\74557f55_7701ca01\Microsoft.Practices.Unity.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\99313130\86522fe8_7701ca01\Telerik.Libraries.Data.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\abb40d7c\14befbe7_7701ca01\Telerik.Cms.Engine.Data.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\edc9efea\90bacc7e_f011ca01\Purolator.PWS.Microsite.UI.WebControls.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\64d3202d\ffaddde7_7701ca01\Telerik.Cms.Data.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\6ad654a3\742a0c54_7701ca01\Microsoft.Practices.EnterpriseLibrary.Common.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\10b1a00a\d41b40e8_7701ca01\Telerik.MySQLProvider.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\63aa62c7\647a8aeb_7701ca01\Telerik.Web.UI.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\f11bce79\7aca4ae8_7701ca01\Telerik.Lists.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\7949f53b\88cf51e8_7701ca01\Telerik.News.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\fa31b256\5bc091e8_7701ca01\Telerik.Security.DLL" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.ServiceModel\3.0.0.0__b77a5c561934e089\System.ServiceModel.dll" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\e50a3c2e\fee6b8e7_7701ca01\Telerik.Blogs.Data.DLL" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Mobile\2.0.0.0__b03f5f7f11d50a3a\System.Web.Mobile.dll" /R:"C:\WINDOWS\assembly\GAC_32\System.Web\2.0.0.0__b03f5f7f11d50a3a\System.Web.dll" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\89e81a02\bdc174e8_7701ca01\Telerik.Search.Data.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\7b1e5e66\48d8d2e7_7701ca01\Telerik.Cms.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\394714bc\0d08a8e8_7701ca01\Telerik.Versioning.DLL" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.ServiceModel.Web\3.5.0.0__31bf3856ad364e35\System.ServiceModel.Web.dll" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\b5118c36\603d5fe8_7701ca01\Telerik.Personalization.Data.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\a686c374\b2abf1e7_7701ca01\Telerik.Charting.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\403cd09e\6a7b96e8_7701ca01\Telerik.Showcases.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\24d17992\cc8da0e8_7701ca01\Telerik.Testimonials.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\cfe3ff3e\7080287d_f011ca01\Purolator.PWS.Microsite.Business.Entities20.DLL" /R:"C:\WINDOWS\assembly\GAC_32\System.EnterpriseServices\2.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\64a3bfeb\42a507e8_7701ca01\Telerik.DynamicWebServices.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\d11533e1\39616ae8_7701ca01\Telerik.Polls.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\a750b340\800e3de8_7701ca01\Telerik.Localization.Data.DLL" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Services\2.0.0.0__b03f5f7f11d50a3a\System.Web.Services.dll" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\4d47f510\bdb04de8_7701ca01\Telerik.News.Data.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\21497572\9435e8e7_7701ca01\Telerik.Cms.Engine.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\6369f88b\1fa109e8_7701ca01\Telerik.Events.Data.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\b832ddf6\92eb3ae8_7701ca01\Telerik.Lists.Data.DLL" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Extensions\1.0.61025.0__31bf3856ad364e35\System.Web.Extensions.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Extensions.Design\1.0.61025.0__31bf3856ad364e35\System.Web.Extensions.Design.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.IdentityModel\3.0.0.0__b77a5c561934e089\System.IdentityModel.dll" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\0c5fa3c1\69a34ae8_7701ca01\Telerik.Localization.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\8a908ad2\e4ae90e8_7701ca01\Telerik.Showcases.Data.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\c578b85c\60b8b07c_f011ca01\Purolator.PWS.Microsite.UserRegistration.DLL" /R:"C:\WINDOWS\assembly\GAC_32\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\9472ce76\7a86aee7_7701ca01\MySql.Data.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\8c6fb3f3\f97a12e8_7701ca01\Telerik.Events.DLL" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.WorkflowServices\3.5.0.0__31bf3856ad364e35\System.WorkflowServices.dll" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\7e922d8d\dd3d8fe7_7701ca01\AjaxControlToolkit.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\c5ad2251\2a73f0e7_7701ca01\Telerik.Cms.Web.UI.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\5f760093\4ec64be9_7701ca01\Xceed.Zip.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\9c535052\00286f55_7701ca01\Microsoft.Practices.ObjectBuilder2.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\affb3caf\e75978e7_7701ca01\CookComputing.XmlRpcV2.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\48e40171\3037a769_f011ca01\Purolator.PWS.Microsite.Common.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\1b9e531b\1e0d5ae8_7701ca01\Telerik.Notifications.Data.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\3b010a75\d75f87e8_7701ca01\Telerik.Search.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\aabb9a4f\8037177c_f011ca01\Purolator.PWS.Microsite.MicrositeMembership.DLL" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Runtime.Serialization\3.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\2b782779\ba7d2de8_7701ca01\Telerik.Framework.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\7ac24171\48600be9_7701ca01\Telerik.Workflow.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\6b246eef\3ab17de7_7701ca01\log4net.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\63e1630d\c4bb64e8_7701ca01\Telerik.Polls.Data.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\01e3bc05\dd7004e8_7701ca01\Telerik.DataAccess.OracleProvider.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\b8704c2c\588d71e8_7701ca01\Telerik.Rss.Data.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\f0895c9e\c721fae8_7701ca01\Telerik.Zip.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\60347028\60ba747f_f011ca01\Purolator.PWS.Microsite.CreateKey.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\7089272c\9e40aae7_7701ca01\Nolics.Engine.v4.2.DLL" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\assembly\dl3\a2a7c74c\ed5818e9_7701ca01\Xceed.Compression.DLL" /out:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\App_Code.15o-v7k8.dll" /D:DEBUG /debug+ /optimize- /w:4 /nowarn:1659;1699;1701  "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\App_Code.15o-v7k8.0.cs" "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\App_Code.15o-v7k8.1.cs" "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\App_Code.15o-v7k8.2.cs" "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\App_Code.15o-v7k8.3.cs" "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\e6294a1b\7f4e2126\App_Code.15o-v7k8.4.cs"
    
    
    Microsoft (R) Visual C# 2005 Compiler version 8.00.50727.3053
    for Microsoft (R) Windows (R) 2005 Framework version 2.0.50727
    Copyright (C) Microsoft Corporation 2001-2005. All rights reserved.
    
    d:\PWSWeb\App\PWSWeb\Microsite\App_Code\CustomCmsHttpModule.cs(16,33): error CS0106: The modifier 'override' is not valid for this item
    d:\PWSWeb\App\PWSWeb\Microsite\App_Code\CustomCmsHttpModule.cs(16,33): error CS0106: The modifier 'protected' is not valid for this item
    




    I noticed from your last post that there's a difference with the spelling of "isAuthenticated" and from the attached zip file.

    From your last post, it's Telerik.Cms.Web.CmsHttpModule.isAuthenticated(HttpContext context, bool ensureRoleProvider).

    From the zip file CustomCmsHttpModule.cs, it's
    protected override bool IsAuthenticated(HttpContext context, bool ensureRoleProvider)

    The difference is the small "i" and caps "I". Regardless, any of this doesn't work for me.

    So, I'm not sure why. How would I know the actual Sitefinity version installed in my dev server and the SP? Perhaps the difference is there vs what you have.

    I would like to make the App_Code/CustomCmsHttpModule.cs to work as what you have indicated from your last post that code here gets executed first before Page_Load.

    Below is my code for my App_Code/CustomCmsHttpModule.cs

    -------------------------------------------------------------------------------------------------------------------
    using System;
    using System.Collections.Generic;
    using System.Web;
    using Telerik.Cms.Web;
    using System.Web.Profile;
    using System.Globalization;
    using Purolator.PWS.Microsite.Common;

    /// <summary>
    /// Summary description for CustomCmsHttpModule
    /// </summary>
    namespace Telerik.Samples.CustomCmsHttpModule
    {
        public class CustomCmsHttpModule : CmsHttpModule
        {
            protected override bool Telerik.Cms.Web.CmsHttpModule.isAuthenticated(HttpContext context, bool ensureRoleProvider)
            {
                string preferredLanguage = String.Empty;
                preferredLanguage = context.Session[Constants.PWS_MICROSITE_CURRENTUSERPREFERREDLANGUAGE] == null ? null : context.Session[Constants.PWS_MICROSITE_CURRENTUSERPREFERREDLANGUAGE].ToString().ToLower();
                bool isAuthenticated = (String.IsNullOrEmpty(preferredLanguage) ? false : true);

                if (isAuthenticated && CmsUrlContext.Current != null && context.Items[UrlHelper.EditModeKey] == null)
                {
                    base.SetCurrentCulture(new CultureInfo(preferredLanguage));
                }
                return isAuthenticated;
            }
        }
    }

    -------------------------------------------------------------------------------------------------------------------


    While waiting for you reply, I will continue with my implementation using the .master pages and will try to implement your suggestion of reconstructing the URL and redirection with the current culture. I'll let you know what the result.

    I would appreciate it if you can troubleshoot what's wrong with my implementation of CustomCmsHttpModule.


  10. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    05 Aug 2009
    Link to this post
    Hello Allan Lazaro,

    Thank you for getting back to me.

    The version of Sitefinity I am using is 3.6.1936.2 (Sitefinity SP2). That is the current latest official version. Can you please check your version of Sitefinity? I will check the method for your version, or you can use .NET Reflector to disassemble the Telerik.Cms.dll in the bin folder of your project and check the correct method yourself.

    As for my previous post - the lower case i was a typo. The correct method is Telerik.Cms.Web.CmsHttpModule.IsAuthenticated(HttpContext context, bool ensureRoleProvider). This is for the 3.6.1936.2 version.

    Greetings,
    Rado
    the Telerik team

    Instantly find answers to your questions on the newTelerik Support Portal.
    Check out the tipsfor optimizing your support resource searches.
  11. Allan Lazaro
    Allan Lazaro avatar
    10 posts
    Registered:
    15 Jul 2009
    05 Aug 2009
    Link to this post
    Hello Rado,

    Thanks again for your replies.

    The Sitefinity version I have is 3.5.1747.2.

    Based from the link you have provided, this is what I have:

    Release Sitefinity 3.5 SP1
        3.5.1747.2 - standard

    I have already started implementing the redirects based on the current ui culture; I did the evaluation on the code behind of all my ascx; it's kind of tedious but it does the trick for me once the User is logged-in.

    I have one other problem that I would need to consult.

    1.
    The LanguageBar when visible, on the anonymous pages, it moves left and right when a language is selected, i.e.,
    when in the default English, it's in the top left side; when I toggle it to français, it jumps to the top right of the page; and goes back to top left when I select English. Is this a known defect in the Sitefinity version we are using?

    2.
    I need to replace the language selection control from the LanguageBar to a custom implementation, i.e.,
    a link that would show the other language available, For example, if page is currently in English, I would need to show a link saying "En français" and vice versa (in French page, a link showing "English"). As well, I need to put the language link in specific position and apply style on it.

    When a language link is clicked, same behaviour should work toggling to the proper cultureui page and changing the language link.

    Can you please provide suggestions and sample codes to implement this. If this would work; the problem I indicated in #1 would not be an issue anymore.

    Thanks.

    allan


  12. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    06 Aug 2009
    Link to this post
    Hello Allan Lazaro,

    Thank you for getting back to me with the above information. Let me try to address your questions/issues.

    1.The LanguageBar when visible, on the anonymous pages, it moves left and right when a language is selected, i.e., when in the default English, it's in the top left side; when I toggle it to français, it jumps to the top right of the page; and goes back to top left when I select English. Is this a known defect in the Sitefinity version we are using?

    This is not the default behavior of the LanguageBar. I have tested this using your version of Sitefinity and did not get this change of positions. One possible reason you are getting this is if you have created two different templates - one for French and one for English users. Now if your different language versions of certain pages use the different templates/themes you will get the specified behavior above. Basically using Sitefinity localization you will need only one theme for your language versions. What I did to test behavior was to put a language bar on my template (top left) and create several French versions of the pages I already had. I made those pages to copy the content from english versions (see attached image). Can you check if your pages in different language versions use different templates/themes? Basically you can define the style and look and feel in your theme CSS files.

    2. I need to replace the language selection control from the LanguageBar to a custom implementation, i.e., a link that would show the other language available, For example, if page is currently in English, I would need to show a link saying "En français" and vice versa (in French page, a link showing "English"). As well, I need to put the language link in specific position and apply style on it.

    Well you can easily achieve this by creating a simple user control. This user control will just have a couple labels and link buttons. You will define the text of those controls in resource files (as in the sample localizable control I sent you) so that they have different text in English and French. The behavior of the language control can be similar to the CmsHttpModule I sampled. It will just change the current culture depending on which language you want to see, and perform a simple redirect to the same page, but with the desired language info in its URL. You can either define styles for your control in its template (.ascx) or in your theme CSS files.

    I hope I have answered your questions clearly enough. If you have more questions please feel free to get back to us.

    All the best,
    Rado
    the Telerik team

    Instantly find answers to your questions on the newTelerik Support Portal.
    Check out the tipsfor optimizing your support resource searches.
  13. Allan Lazaro
    Allan Lazaro avatar
    10 posts
    Registered:
    15 Jul 2009
    18 Aug 2009
    Link to this post
    Hello,

    Thanks for all you reply in this post/thread. I am almost complete with my project's localization.

    I got one other (hopefully the last one) question with regards to the Language bar.

    As I mentioned in my previous post, I only support 2 languages, i.e., English and French. The default values from the dropdown are English and francais. I would like to make francais to Francais (from small f to caps F). How would I changed these values from the LanguageBar dropdown. Are there any tables I need to update?

    PS: I did not need to customize the LanguageBar so I'm using the default Sitefinity one. I just need to change the dropdown list values.

    Thanks.

    allan
  14. Nikolai
    Nikolai avatar
    216 posts
    Registered:
    21 Nov 2016
    18 Aug 2009
    Link to this post
    Hello Allan Lazaro,

    The LanguageBar is binded directly. I suggest you use simple java script on the client side to change the letter.

    How to:
    1. Open ~\Sitefinity\Admin\Admin.master
    2. Place the following code in the last <script> block like this:
     function pageLoad(sender, e) 
        { 
            Personalization.set_serviceUrl('<%= System.Web.VirtualPathUtility.ToAbsolute("~/Sitefinity/Admin/Services/PersonalizationService.asmx") %>'); 
        } 
     
        var langDropDown = document.getElementById('ctl00_LangBar_ctl00_languageList'); 
        //Change this to 1 if the French is first in the Language bar 
        var frOption = langDropDown.childNodes[3]; 
        var fr = String(frOption.innerHTML); 
        var sFr = fr.substring(1, fr.length); 
        frOption.innerHTML = 'F' + sFr; 
            </script> 
    3. Save

    Greetings,
    Nikolai
    the Telerik team

    Instantly find answers to your questions on the newTelerik Support Portal.
    Check out the tipsfor optimizing your support resource searches.
  15. Allan Lazaro
    Allan Lazaro avatar
    10 posts
    Registered:
    15 Jul 2009
    19 Aug 2009
    Link to this post
    Thank you for your quick reply.

    I tried what you have suggested but it did not work. francais remains in small letter f.

    Would there be other way of changing this, perhaps a table in the  database that I can just update?

    Thanks.

    allan
  16. Nikolai
    Nikolai avatar
    216 posts
    Registered:
    21 Nov 2016
    20 Aug 2009
    Link to this post
    Hi Allan Lazaro,

    There is no table with the localization culture names. They are taken directly from the .net framework.
    The reason for the java script code not to working properly is probably because the element recursive search is failing due to difference in our settings or because langDropDown is null.

    //You will need to change the Id string to match yours 
    var langDropDown = document.getElementById('ctl00_LangBar_ctl00_languageList'); 


    If the above is not the problem the next thing you could tweak is:
    //This should be changed until the French item is found 
    var frOption = langDropDown.childNodes[3];  

    I attached a screen shot of my project to show you that this is possible.

    All the best,
    Nikolai
    the Telerik team

    Instantly find answers to your questions on the newTelerik Support Portal.
    Check out the tipsfor optimizing your support resource searches.
Register for webinar
16 posts, 0 answered