Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using .Resx files for global application messages?

Tags:

asp.net

resx

So I'm using a Global Resource file for all static messages within my site. Mainly error messages etc..

They do not need to be localized, but I felt it was just a good idea to store them all in one location.

Would it have been better to use just a static class called "SiteConstants" or something? Or is using a RESX file okay?

Thanks!

like image 418
Jack Marchetti Avatar asked Feb 27 '23 23:02

Jack Marchetti


1 Answers

Definitely use resource files.

The .resx files do create classes under the hood for you. Most importantly, though, the auto-generated code will already have all the localization stuff taken care of for you. If you decide to localize your application, there will also be automatic support for that stuff if you use the prescribed file/folder structure. Not to mention that localizing your app will merely be a matter of translation, which is the best-case scenario (not mentioning other localization issues like currency, which is a whole separate issue).

like image 165
Jon Seigel Avatar answered Mar 13 '23 06:03

Jon Seigel