A trivial question perhaps, but I'm interested in the answers. I'm currently refactoring some very large monolithic string resource files (one dumpster resource file per project, in about 30 projects). I'm splitting them such that we follow a convention for our files and make the strings easier to find and manage when coding.
Generally I'm splitting the files into this scheme:
I'm not terribly thrilled with the naming, and I'm just wondering what other people use. For example, instead of AppResources
(strings for internal use by the application), I've seen a lot of demo projects use StringResources
, Internal
(terrible!), etc.
Ideas/anecdotes/suggestions on managing resources or standard naming schemes are appreciated.
I generally structure my resources like this:
The first resource file is used by the entire application (e.g. Project.Core
) and does include all sorts of widely used common strings. I actually don't make any difference between errors/exceptions and logging:
CommonResources.resx
Error_Context
Error_ArgumentCannotBeNull
Warn_Context
Warn_ApplicationSettingNotFoundUseDefault
Info_Context
Info_UpdateAvailable
Validation_Context
Validation_EmailNotValid
The second resource file is used by the presentation layer and contains all sorts of UI strings. The naming can vary from project to project but generally it looks like the following schema:
PresentationResources.resx
Common_Context
Common_Yes
Section/Controller_Window/View_Context
Help_FAQ_HeadlineHowToUseResources
or Help_FAQ_TextHowToUseResources
Finally every project/assembly does also have an internal resource file for Error/Warn/Info/Validation resources that are too specific to go in the CommonResources.resx
file. I have to admit, that I mostly name this resource file InternalResources.cs
;)
InternalResources.resx
Classname_Error_Context
BCrypt_Error_InvalidSaltRevision
Classname_Warn_Context
Classname_Info_Context
Classname_Validation_Context
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With