First time here? Check out the site's "greatest hits" or read a post from the archives. Feel free to leave a comment or ask a question, and consider subscribing to the latest posts via RSS or e-mail. Thanks for visiting!
« 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

Text Links

On this page...

Tags

Calendar

<August 2008>
SunMonTueWedThuFriSat
272829303112
3456789
10111213141516
17181920212223
24252627282930
31123456

Archives

Google Ads