definitions.txt

When we made the split between the two new halves of SocialCalc, we knew that the cut was quite clumsy, in that some code would probably end up in the wrong half for a while, but we hoped we’d at least managed to make sure everything was working properly.

We weren’t quite correct.

The 1.0 release of SocialCalc had a ‘Strings’ file that defined all the user visible text in the application, to make it easier to localise the product. For every other file in the distribution it was just a matter of working out which half it belonged in. This file needed to be split in two, partitioning based on the strings that were used in each part. As far as we know, we managed to split that up correctly.

What we missed, however, was that the ‘definitions.txt’ file, which lets you localise or customise other parts of the application - such as number formats - also allows for overriding content from the Strings file. However, because it gets loaded and parsed in a couple of different places, it would sometimes be operating on the wrong half of the newly split Strings file. For most users this wouldn’t be a problem, as the version shipped with the release doesn’t do that. But some people have already produced (or are working on) translations of SocialCalc into other languages, and this broke things for them.

The workaround to fix this was quite simple, but we decided that whilst we dealing with this area of the code anyway, we may as well tidy it up a little. In particular we didn’t like that there were two different places responsible for reading and parsing the file, each of which did slightly different things. So we’ve factored that all out into a common SocialCalc::Strings::Definitions module that is simply responsible for working with the definitions file.

This is part of our on-going plan for moving forward. Each time we need to fix something, we want to do a little more than just a ‘quick fix’. We’ll be extracting common functionality, and adding tests and documentation, and gradually making the code base easier to maintain, extend, or modify.

If there are any areas you’d like us to tidy up to make something easier that you’d like to do with SocialCalc, please holler on the mailing list.

Update: We’ve fixed this bug. It’s now fixed in Subversion and the latest snapshot.

Leave a Reply