Internationalization and Localization
I don’t mean to pick on WordPress, I really don’t, but I’m using it, so that’s why it gets to be an example.
Today I decided to change the text for the comment links from “Comments (0)”, “Comments (1)”, Comments(x) to “Add a comment!”, “One comment”, and “x comments”, respectively. In order to do so, I had to look through the PHP code, figure out what method was being called, where that method was defined, and go change the text. Now, that was pretty easy for me, but what if I were some poor non-techie? I’d be scared to even attempt such a thing, for fear that everything would get messed up. Or I wouldn’t be able to figure it out, even if I wasn’t scared. Even as a techie, it can be a pain to go through all the code anytime some text needs to be changed.
Now, as a developer of Java web applications, I’ve been using Java’s lovely mechanism for internationalization (I18n for short) and localization for two or three years now. Basically, what it comes down to is, you put all of your messages (any text that the user will see, including error messages!) into one or more property files (basic text files with key value pairs). This is what one of those properties files might look like:
categories=Categories
search=Search
leaveComment=Leave a comment
trackbackURI=The URI to TrackBack this entry is: {0}
See the {0} in the last line? This is how you parameterize your messages. There’s lots more interesting stuff you can do in your messages (like specifying which comment message to use based on how many comments there are), but I won’t get into that.
The important thing is, this is yet another wonderful way of being able to separate your presentation from your code. All your messages are in one file. No need to hunt through the code just to change a couple of messages. Now, this was designed for internationalizing applications, and it’s great for that (just translate that property file, and you’re good to go!), but I think the benefits make it worth doing even if you’re never going to translate your site or application into another language.
So, back to my example. I wouldn’t be surprised if somebody has already done this for WordPress (I haven’t taken the time to look), but it seems like something that should be done from the start, for any application (again, not trying to pick on WordPress too much). Of course, PHP probably doesn’t have a built-in facility for this, but even so it shouldn’t be hard to emulate.
Even better than just putting all your messages in one file would be to allow the user to edit these messages in the WordPress configuration UI. Customization would be so easy!
March 16th, 2004 at 7:50 pm
How am I gonna’ enable comments on my page if an MIT type like you is getting frustrated? I’m an end-user, not a programmer! Can you recommend some decent resources? Thanks. PS I posted your link, thanks for checking out my page!
March 16th, 2004 at 7:57 pm
Well, I didn’t find it really that frustrating myself–it was more that I saw that it could be frustrating to others and should probably be designed better.
On your site you mentioned Movable Type–are you already using it on your site? I haven’t used it myself, but I heard that the UI is pretty nice. Maybe it won’t be too difficult to figure out - it seems like comments would be something that they would have built-in–they were for WordPress. If you have any questions that aren’t necessarily MT-specific, I’d be happy to help.
March 16th, 2004 at 11:13 pm
Actually, I was hoping I could use a script to generate the comment responses right on the page, I don’t need Trackback or server-log stats. But now I’m getting into territory where I might be talking out my backside (color me clueless!) I see the form on your page source, but that runs back to a specific thingamajig for you, doesn’t it?
March 16th, 2004 at 11:15 pm
Also, no I don’t generate my site with MT, I hand code with Notepad, keeps it lean and mean.
May 9th, 2004 at 7:33 pm
and doing it in a more or less deliberately usa visa goofy, off-the-cuff, laid-back kind of cruise way, I was able to come at it without my accept credit card defenses up, without being as critical las vegas hotel or judgemental. It didnt have to be sublime merchant account - it was fun. It didn’t have to be profound caribbean cruise - it was social.I bring this up because green card lottery