Can I Change The Language For Each Anonymous Individual?

This post has 10 Replies | 5 Followers

vpborza
Not Ranked
Posts 6
Points 90
By: vpborza
Posted: Sat, Oct 7 2006 10:43 AM

Hy,

I would like anonymous users to be able to select their preffered language using just the language combo which would be available on the home page.
I have tried to update the anonymous profile when the new language was selected, but nothing happened.
I think that this is due to the fact that anonymous users either do not have profiles, or they have read only access to it.

Any thoughts?

Thanks,
Vali

 
  • Post Points: 35 |
haathi
Top 100 Contributor
Posts 205
Points 2,890
By: haathi
Posted: Sat, Oct 7 2006 2:11 PM In reply to

I think this is due to the fact that anonymous users do not have profiles, and hence cannot set their language preference.

Also, here is a tool for localization. The downloads are also in the CS download section...

haathi featuring a blog..

 
  • Filed under: |
  • Post Points: 20 |
vpborza
Not Ranked
Posts 6
Points 90
By: vpborza
Posted: Sun, Oct 8 2006 4:10 AM In reply to

I have already been using that tool to localize CommunityServer.

The problem I am facing is the following: I want users to be able to select a language when viewing the web site without the need of loging in.

Example:

User A = CommunityServer.Users.GetAnonymousUser();

 

A.Profile.Language = AnonymousLanguage.SelectedItem.Value;

 

ok = CommunityServer.Users.UpdateUser(A);

Thanks,
Vali

 
  • Post Points: 20 |
haathi
Top 100 Contributor
Posts 205
Points 2,890
By: haathi
Posted: Sun, Oct 8 2006 9:06 PM In reply to

That doesn't make logical sense.

I mean, there is only 1 "physical" anonymous user, so if 10 visitors come to your site and each 1 keeps flipping the language, how is it going work ?

haathi featuring a blog..

 
  • Post Points: 20 |
vpborza
Not Ranked
Posts 6
Points 90
By: vpborza
Posted: Mon, Oct 9 2006 3:02 PM In reply to

I think the first line could be replaced with:

User A = CSContext.Current.User;

But I am not sure that it will return the anonymous user, or an anonymous visitor. Either the cases, I would even be happy if I could change the language for the anonymous user.

 
  • Post Points: 5 |
skhasnis2
Not Ranked
Posts 1
Points 50
By: skhasnis2
Posted: Fri, Apr 6 2007 2:37 PM In reply to

I am trying to do exactly the same thing, but running into some issues.

Here is what I have done so far:

I have implemented the language chooser on our forum site, where non-logged in (anonymous) or logged in user can select the language from the drop down list.

Most of the functionality is working fine J , but I have few issues and some key questions.

You can see the code in action at http://forums.pinnaclesys.com/

  1. When the user selects the language from the list, most of the labels show the localized text except the text on buttons (Search, Save Changes, etc). Is it due to caching? How to resolve this?

Try selecting French from the list on this page http://forums.pinnaclesys.com/forums/default.aspx and you will notice the Search button text remains in English.

  1. When the registered user again visits the site, CS is showing him the interface in the language he selected during last visit. How to set the language which is default language in user's profile when they logged in?

You can try this scenario on the same site. Just select language different than your preferred language in profile, close the browser and visit again.

  1. All the logic I have implemented is in "skin-TitleBar.ascx". Here is the code:

   void Page_Load(object sender, System.EventArgs e)
   {

      User editableUser = CommunityServer.Users.GetUserWithWriteableProfile(CSContext.Current.User.UserID, null, true);
     
      if (!Page.IsPostBack)
      {
          Bind(editableUser.Profile.Language);
      }
        
      
     this.LanguageSelectorDropDownList.SelectedIndexChanged += new System.EventHandler (this.LanguageSelectorDropDownList_SelectedIndexChanged);


 }

    void Bind(string UserLanguage)
    {
       LanguageSelectorDropDownList.SelectedValue = UserLanguage;
    }
  
   void LanguageSelectorDropDownList_SelectedIndexChanged(object sender, System.EventArgs e)
        {
           
            string language = LanguageSelectorDropDownList.SelectedValue;
            //Response.Write(language);

            CSContext csContext = CSContext.Current;
            bool bUpdated;

            //CSCache.Clear(); //Not sure, if we should clear the cache. If we clear cache, the "Most Active Users" shows nothing for few minutes.
           
            User editableUser = CommunityServer.Users.GetUserWithWriteableProfile(CSContext.Current.User.UserID, null, true);

           
            editableUser.Profile.Language = language;
            LanguageSelectorDropDownList.SelectedValue = language;

            bUpdated = CommunityServer.Users.UpdateUser(editableUser);
           

       }

I think the main problem is, CS is changing the language for ALL anonymous users when "any" user changes the language from dropdown. Also when logged in user selects different language from drop down, then CS saves that language as preferred language for same user.

Please help me here Crying

Thanks,

Sameer

 
wolbrink
Top 200 Contributor
Posts 105
Points 1,575
By: wolbrink
Posted: Thu, May 10 2007 12:13 PM In reply to

Off the top of my head:  I wonder if the provider model would allow a derived "CSUser" class to override some "get_language" method.  For anonymous, it could check the session/cookie.  If not anonymous or the session/cookie doesn't have it, then it calls the base/inherited implementation.

I'd like this for my multi-lingual community also, as I have many non-English speakers who need a few pages (minimal) so they can atleast sign up and then edit their profile to set their language.  Now, it's hard for them to sign-up since they can't read the sign-up screens!

 
  • Post Points: 5 |
haathi
Top 100 Contributor
Posts 205
Points 2,890
By: haathi
Posted: Mon, May 14 2007 12:27 AM In reply to
skhasnis2:

I think the main problem is, CS is changing the language for ALL anonymous users when "any" user changes the language from dropdown. Also when logged in user selects different language from drop down, then CS saves that language as preferred language for same user.

Please help me here Crying

Thanks,

Sameer

This is what I have been trying to tell you guys all this time. It is not a "problem" with CS.

There can be only 1 anonymous user profile at any time, for ALL users who are not logged on. This the reason why you provide the membership feature in your application for users who want to move from an anonymous profile to an identifyable customizable profile. 

In other words, there is such concept of "ALL" Anonymous users.

haathi featuring a blog..

 
  • Post Points: 20 |
wolbrink
Top 200 Contributor
Posts 105
Points 1,575
By: wolbrink
Posted: Mon, May 14 2007 10:19 AM In reply to

haathi:
skhasnis2:

I think the main problem is, CS is changing the language for ALL anonymous users

There can be only 1 anonymous user profile at any time ... This the reason why you provide the membership feature in your application ...

The problem still remains for anonymous users who want to become members, but can't read the web pages required to join and become members.

--Troy

 
  • Post Points: 20 |
ACreeger
Not Ranked
Posts 11
Points 205
By: ACreeger
Posted: Wed, May 16 2007 7:16 AM In reply to

I say this being a novice at CS matters, but have you considered using the ASP.NET 2.0 anonymous profile feature for this?

 
  • Post Points: 5 |
marty1101
Top 500 Contributor
Posts 61
Points 680
By: marty1101
Posted: Thu, Mar 27 2008 4:28 AM In reply to

skhasnis2:

Your site seems to work fine with selected language.  How did you overcome changing languages for Anonymous?  This problem really got me.  I appreciate if you can share  your experiences.  Thanks!

 
  • Post Points: 5 |
Page 1 of 1 (11 items) | RSS
Powered by Community Server (Commercial Edition), by Telligent Systems

Copyright© 2008 Telligent Systems Inc. All rights reserved
CommunityServer.com  •  Telligent.com