« My Picks for TechEd 2005 Sessions | Main | A GrokTalk Banner for you to spread arou... »

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(
    MemberTypes.Field|MemberTypes.Method|MemberTypes.Property,
    BindingFlags.IgnoreCase|BindingFlags.Instance|BindingFlags.Public,
    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(). 

Tracked by:
http://www.ayende.com/Blog/BlogNowReadableForTurkishLocale.aspx [Pingback]
"Blog now readable for Turkish locale" (Ayende @ Blog) [Trackback]
http://www.ayende.com/Blog/2005/05/31/BlogNowReadableForTurkishLocale.aspx [Pingback]
"Blog now readable for Turkish locale" (Ayende @ Blog) [Trackback]


Tuesday, May 31, 2005 6:28:25 PM (Pacific Standard Time, UTC-08:00)
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: http://west-wind.com/weblog/posts/2204.aspx...
Tuesday, May 31, 2005 6:30:25 PM (Pacific Standard Time, UTC-08:00)
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...
Wednesday, June 01, 2005 1:57:22 AM (Pacific Standard Time, UTC-08:00)
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?
Dan
Thursday, June 02, 2005 12:23:12 AM (Pacific Standard Time, UTC-08:00)
Here we go...now we're getting somewhere...
http://msdn.microsoft.com/netframework/default.aspx?pull=/library/en-us/dndotnet/html/StringsinNET20.asp#stringsinnet20_topic5
Scott Hanselman
Thursday, June 02, 2005 8:42:57 AM (Pacific Standard Time, UTC-08:00)
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.

Contact

Sponsors

Hosting By

Hot Topics

Tags

Calendar

<November 2009>
SunMonTueWedThuFriSat
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345

Archives

November, 2009 (5)
October, 2009 (19)
September, 2009 (11)
August, 2009 (12)
July, 2009 (21)
June, 2009 (26)
May, 2009 (16)
April, 2009 (13)
March, 2009 (17)
February, 2009 (17)
January, 2009 (18)
December, 2008 (32)
November, 2008 (17)
October, 2008 (22)
September, 2008 (16)
August, 2008 (14)
July, 2008 (25)
June, 2008 (19)
May, 2008 (17)
April, 2008 (17)
March, 2008 (26)
February, 2008 (21)
January, 2008 (28)
December, 2007 (19)
November, 2007 (17)
October, 2007 (31)
September, 2007 (39)
August, 2007 (37)
July, 2007 (43)
June, 2007 (37)
May, 2007 (32)
April, 2007 (38)
March, 2007 (29)
February, 2007 (46)
January, 2007 (31)
December, 2006 (27)
November, 2006 (31)
October, 2006 (32)
September, 2006 (39)
August, 2006 (34)
July, 2006 (40)
June, 2006 (18)
May, 2006 (31)
April, 2006 (34)
March, 2006 (30)
February, 2006 (38)
January, 2006 (44)
December, 2005 (19)
November, 2005 (34)
October, 2005 (24)
September, 2005 (37)
August, 2005 (20)
July, 2005 (24)
June, 2005 (33)
May, 2005 (16)
April, 2005 (22)
March, 2005 (34)
February, 2005 (15)
January, 2005 (37)
December, 2004 (28)
November, 2004 (30)
October, 2004 (34)
September, 2004 (22)
August, 2004 (34)
July, 2004 (18)
June, 2004 (64)
May, 2004 (49)
April, 2004 (21)
March, 2004 (29)
February, 2004 (29)
January, 2004 (36)
December, 2003 (25)
November, 2003 (24)
October, 2003 (59)
September, 2003 (42)
August, 2003 (24)
July, 2003 (44)
June, 2003 (29)
May, 2003 (21)
April, 2003 (30)
March, 2003 (27)
February, 2003 (47)
January, 2003 (50)
December, 2002 (31)
November, 2002 (38)
October, 2002 (44)
September, 2002 (15)
May, 2002 (2)
April, 2002 (4)

Google Ads