Scott Hanselman

DasBlog Usability Alert: Template Changes to enable Turkish Users

June 01, 2005 Comment on this post [5] Posted in ASP.NET | DasBlog
Sponsored By

DasBlog uses a poor man's macro language in our templates to make it easy to change the skin of a whole blog. The macros allow folks to call methods from our templates, with or without parameters.

We use some reflection code like this:

MemberInfo[] members = subexObject.GetType().FindMembers(
    new MemberFilter(this.IsMemberEligibleForMacroCall), subex.Trim());

Where "subex" contains a string like "items" that was extracted from one of our template files that included a macro string like <%items%> indicating to dasBlog to insert a list of blog items here.

However, when someone using a Turkish browser comes to a site running dasBlog they see NOTHING. Zip. Why?

In Turkish, there are four letter "I's. In English our i becomes I when capitalized. However, in Turkish, i becomes İ and ı becomes I. Notice the dots. 

Also, notice that we use BindingFlags.IgnoreCase in our call to FindMembers(). I suspect that the "items" is becoming "Items" internally (perhaps an in appropriate call to ToUpper()?) but I can't find an implementation with Reflector that even looks at BindingFlags.IgnoreCase. Regardless, we fail to call the method and get a System.MissingMemberException or System.MissingMethodException.

ACTION REQUIRED: The solution is, for now, for all you folks running dasBlog, to go into your *.template files and make these quick and easy changes (there isn't yet an easy code change, and it's not just a ToUpper() situation):

  • Change <%items%> to <%Items%>
  • Change <%itemTitle%> to <%ItemTitle%>
  • Change <%itemText%> to <%ItemText%>

I'll make changes to all the default dasBlog templates while I look for a more correct solution in code and/or determine if this is a limitation in FindMembers(). 

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service
June 01, 2005 6:28
I ran into a similar issue with automatic CurrentCulture switches and Turkish visitors to our site. In my case I was having issues with string indexes to a DataRow not working in Turkish where dr["InvNo"] is failing and dr["invno"] is working turkish. This can apply for any indexed property that isn't case sensitive as the string indexer lookups will fail. I suspect internally Reflection might be running through the field names and looking for matches which may not be found in this scenario, so when you do a lookup for 'Items' it's failing. I think the short term solution is to use all lower case i's. My fix was to not localize the thread for Turkish users. More info:
June 01, 2005 6:30
BTW Scott, something is not working right with your comments area. I had to post the previous comment 4 times before it finally took. It just seems to go back to the same page - luckily keeping the text intact, but there's no error or other notification that the save didn't work. Just the POST form with my data again. This has happened a few times before on your site. Let's see how this one goes...
June 01, 2005 13:57
I see that the names used in the macros are camel-cased and the names of the properties are Pascal-cased, so couldn't you do the ToUpperCase(CultureInfo.InvariantCulture) for the first letter yourself?
June 02, 2005 12:23
Here we we're getting somewhere...
June 02, 2005 20:42
Well, I am not sure whether it is you or them who is doing the comparison here though, right?

It is a "Turkish I" issue, for sure.

If it is them, you can probably change the CurrentCulture, call the method, and change it back (AS A WORKAROUND, of course!).

Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.