Lookup tables and gettext
posted Wed Apr 18 21:47:26 +0000 2007 - permalink
A first pass look seems to indicate that PHP's built-in gettext functionality may solve the problem for our embedded strings, and that 'lookup tables' will help with any database text (one lingering question for the database lookup tables for me, however, is maintenance).
In addition to the text problem, our reports require energy
calculations which means data conversion as well. Any decorator that
runs on top of all of the reports will need to pepper them with the
appropriate metric/American values. This looks increasingly difficult
due to inheritance, because rather than having a single method to get
a sensor's performance, these methods will need to be broken down
into smaller atomic pieces so the decorator can discern what needs to
be overridden.
Another option besides the decorator, however, might be to provide
a messaging class that can be cast back and forth. This allows the
superstructure to remain intact (which, organizationally, makes it
easy to find bugs and read as a developer) and essentially cast the
message on display depending on the user's preference (or where they
are located).