A better way to declare dozens of text constants?
Hi all, I have a small conundrum that could save me hours of work if I solve it.
At the moment, I am declaring all of my text constants (for labels, descriptions etc) like so...
Code:
cLBL_OBJECT_RESOURCE = iniLang.GetString ("PropGrid", "cLBL_OBJECT_RESOURCE", "*Resource")
where iniLang.getString is a method to retrieve the string from an ini file. I have literally dozens of these, so it's quite time consuming. This is only half of the job, the other half is applying them to the buttons etc (this example has 3 constants)...
Code:
.Item.Add(cLBL_SHOW_TERRAIN, YesNo.Yes, False, cGLOBALPROPERTIES, cLBL_SHOW_TERRAIN_DESC, True)
Is there a better technique to use in .net? It needs to be dynamic, the text must come from a text file of some kind because I need to be able to allow others to edit the text strings. The ini file approach isn't the issue here (I know people have strong feelings on this topic!), it's the coding of dozens of constants.
Re: A better way to declare dozens of text constants?
Use a RESX file and .NET localization. You don't have to create any language-specific resources if you don't want. Just the default resource file is fine.
http://msdn2.microsoft.com/en-us/lib...d3(VS.80).aspx