0 Replies Latest reply on Dec 21, 2009 5:46 PM by 843810

    Resource key name guidelines?

      Does anyone know of a good, comprehensive discussion of issues involved in naming resources? I can find lots of guidelines on naming variables, methods, classes, etc., complete with rationales and study results. But resource keys seem to be generally ignored or handled casually with the advice "make the names meaningful".

      Like several others posting to this forum, I am running into scaling issues as the number of internationalized strings in my apps grow. I started off by using names like "aboutMenuItem.text", "aboutMenuItem.tooltip", etc. As the number of strings grew, this is creating problems. I have no fixed method of providing "meaningful names": what seems like a simple, obvious rule one day doesn't enter my mind a week later, so my resources follow inconsistent naming patterns. With hundreds of internationalized strings, this is now a more-than-minor irritant.

      The discussion I'd like to see would cover topics like:
      -- should all strings go into a single bundle (or bundle hierarchy), or should they be partitioned? If the latter, on what basis? UI component (e.g., a bundle for each main screen)? App function (e.g., login-related strings, etc.)? Intended resource use (e.g., button text, menu item, error message, etc.)
      -- should there be a single naming convention or separate naming conventions for different string categories (menus; labels; message patterns; special-purpose like "connection timed out" vs. general-purpose like "Cancel"; etc.)
      -- how to deal with refactoring issues; for instance, pros and cons of using a preprocessing tool to map resource key strings to refactorable Java identifiers.
      -- the most useful information to include in annotations
      -- pitfalls and how to avoid them, particularly when it comes to contracting out translation tasks

      I doubt that there is one set of rules that is right for every situation, but a practical guide on how to think about the issues and evaluate alternatives would be very helpful.