MemberList.aspx: non-english letters on top pager

This is a place to discuss how to adapt mojoPortal to the needs of different cultures. Before asking questions here please first review the localization documentation.

This thread is closed to new posts. You must sign in to post in the forums.
11/17/2006 2:13:42 PM
Gravatar
Total Posts 68

MemberList.aspx: non-english letters on top pager

It would be nice to be able to change/add letters shown on the top pager on MemberList.aspx to support names that begin with a non-english letter.

Christian

11/17/2006 2:31:01 PM
Gravatar
Total Posts 18439

Re: MemberList.aspx: non-english letters on top pager

Hi Christian,

Its funny you should mention that because I was thinking about that after handling this request from Alexander.
It made me realize that this feature is not currently localizable.

I'm not really sure of a great way to implement it, even the english implementation is not the prettiest thing though its not complicated either.

Currently it builds those links from calling this method in SiteUtils
public static string GetAlphaPagerLinks(string pageUrl, int pageNumber, string selectedLetter)
{
...
}

I'm thinking we could move the guts of this method into GetAlphaPagerLink_en(...)
and put a switch on CultureInfo.CurrentCulture in the GetAlphaPagerLinks method and then call language specific implementations based on the current culture and just fall  back to english or make it the default when there is no method implemented for the culture.

If I do that can you implement it for your language and maybe I can ask Alexander to do it for Russian?

Of course if you have any ideas of a different way to do it I'm open to hear that too.

Thanks,

Joe
11/17/2006 2:41:51 PM
Gravatar
Total Posts 18439

Re: MemberList.aspx: non-english letters on top pager

Actually, now that I think about it I may have an idea to clean up that code and make it possible to put a string of characters in web.config that make up the pager links. I can split this into a char array and simplify the code quite a bit and make it possible to add characters easily in web.config.

I'll give it a try this weekend.

Cheers,

Joe
11/17/2006 2:51:52 PM
Gravatar
Total Posts 68

Re: MemberList.aspx: non-english letters on top pager

I thought of this as I viewed that post to :) Wouldn't it be better to have a switch on the CurrentCulture an have a method return an alphabet string, for example swedish: "ABCDEFGHIJKLMNOPQRSTUWVXYZÅÄÖ", and than just add all letter links from that, its easier to just add alphabet strings to the code (or why not to a/the GlobalResource file?).

Of cource, there could always be users from different countries registered on a site.. how to deal with that? Maybe have a "Other letters" (or some better name) button there as well that contains all names that don't start with letters in the specific alphabet string or something.

Christian

11/17/2006 2:59:01 PM
Gravatar
Total Posts 18439

Re: MemberList.aspx: non-english letters on top pager

I just implemented it using web.config, was very easy, but you're right even better to store it in the Resource file. I'll do that now and then commit to svn/branches/joesandbox2

Good point about the users in any site may have any of those characters, not really sure of a good way other than maybe a search users feature. I think for now using the Resource string will be a good improvement and we can try to add something more later.

Cheers,

Joe
11/17/2006 3:08:04 PM
Gravatar
Total Posts 18439

Re: MemberList.aspx: non-english letters on top pager

Ok, I got it working from the resource file but I'm wondering if this is really what we want. The Resource will be adapting to the user's browser, so if the user's browser is set to Russian, then it will show Russian chars if we have that key in the resource file but on this site for example that would render the alpha selector useless for those using Russian since virtually no russian characters exist in the users.

Maybe the web.config is a better option to force it to the main culture of the site.

What do you think?

Joe
11/17/2006 3:13:02 PM
Gravatar
Total Posts 18439

Re: MemberList.aspx: non-english letters on top pager

Ok, I made it so we have a choice to use it from the Resource File or Web.config


<add key="GetAlphaPagerCharsFromResourceFile" value="false" />
<add key="AlphaPagerChars" value="ABCDEFGHIJKLMNOPQRSTUVWXYZ" />

if(ConfigurationManager.AppSettings["GetAlphaPagerCharsFromResourceFile"].ToLower() == "true")
{
alphaChars = GetGlobalResourceObject("Resource", "AlphaPagerChars").ToString();
}
else
{
alphaChars = ConfigurationManager.AppSettings["AlphaPagerChars"];
}

topPageLinks.Text = SiteUtils.GetAlphaPagerLinks(pageUrl, pageNumber, alphaChars, userNameBeginsWith);
    this.spnTopPager.Controls.Add(topPageLinks);

Cheers,

Joe
11/17/2006 3:28:20 PM
Gravatar
Total Posts 68

Re: MemberList.aspx: non-english letters on top pager

I was thinking of this issue to, and I thought of the same kind of solution, I think the current solution you made is great because its flexible, and you can set it up the way you like.

Good job!

Christian

12/5/2006 10:35:58 PM
Gravatar
Total Posts 488

Re: MemberList.aspx: non-english letters on top pager

Thanks for the improvement!

I just cannot imagine the situation when it would be nice to store these letters in resources. As you have already said, this makes it client-specific, but this setting is always web site specific.

May be, "Other" button will be a good "quick" solution, while more universal user search and filtering is not implemented. But for me it doesn't seem very important.

Speaking about the permanent solution, it would be nice to do the following:
1. Plain list with paging feature.
2. Sorting of the list by different criteria (name, email, date registered, etc.)
3. Some filtering (also by name, email, etc.) - or you can call it search.
1/9/2012 9:30:08 AM
Gravatar
Total Posts 87

Re: MemberList.aspx: non-english letters on top pager

Want to suggest a little adjustment:

web.config needs to be UTF-8 encoded.

when i tryed to replace characters in web.config the application crashed with standard complain about errors in web.config and making it UTF-8 solved the issue. So why not to make web.config and may be user.config too as UTF-8 or unicode by default.

Anyway if someone will follow this instructions do not forget to check your web.config encoding first.

Regards,

Victor

1/9/2012 11:37:59 AM
Gravatar
Total Posts 18439

Re: MemberList.aspx: non-english letters on top pager

Hi Victor,

Thanks, I will fix that, not sure how or when it got that way it should have been utf8 all along.

Best,

Joe

You must sign in to post in the forums. This thread is closed to new posts.