0

TL;DR

Are resource files just for language translations, or can they be used for other variables?


I have an application which will be deployed onto multiple servers with different configuration settings for each.

For example my configuration has:

<add key="AppMode" value="CompanyA"/>

At the moment I do something like:

@{
  string companyName;  
  switch(AppMode){
     case: "CompanyA":
        companyName= "Company A";
        break;
     case: "CompanyB":
        companyName= "Company B";
        break;
     case: "CompanyC":
        companyName= "Company C";
        break;
  }
}

<h1>@companyName</h1>

This sort of logic is littered across the application for various things. Site Logo path etc..

In the past I've used Localization .resx files to store different translations.

Can/Should I use .resx files for different application modes?

For example I could have:

  • Resources.companya.resx
  • Resources.companyb.resx
  • Resources.companyc.resx

Is this an acceptable, best practice, use of .resx files, or are they purely for languages?

Curtis
  • 101,612
  • 66
  • 270
  • 352
  • I am not sure if I am answering your question. Why not creating new key in web.config that stores the Company Name? – Hatjhie Sep 24 '14 at 09:11
  • @Hatjhie That was just one example. Imagine I have 100's of differences. – Curtis Sep 24 '14 at 09:13
  • @Hatjhie I'd rather have 1 config setting which controls which set of data to use. Having 100's of individual config settings would be difficult to maintain. – Curtis Sep 24 '14 at 09:17
  • Understood. You might want to take a look on this post: http://stackoverflow.com/questions/5231476/are-resx-files-a-suitable-way-to-customise-for-different-customers – Hatjhie Sep 24 '14 at 09:26

0 Answers0