Which is best for storing strings: .resx or app.config?

A

Artie

Hi,

I've inherited an app that currently reads in hard-coded strings (like
error messages) from app.config.

It has been suggested that these would be better-placed in a .resx
file.

Is there any definitive thinking on this? Is there a most suitable
place that such strings should go?

Regards

Artie
 
J

Jeroen

Hi Artie,

If you're looking at translating your application or those strings, I
would highly recommend using resx. If you make a user control or
window 'localizable', a new resx will be available for every language
you want to translate to (the mechanism falls back to the default
language if it can't find resx in other languages).

If the strings are actual 'settings' which the user should be able to
change, then perhaps a config might be more appropriate...

Regards,
Jeroen
 
A

Artie

Hi Artie,

If you're looking at translating your application or those strings, I
would highly recommend using resx. If you make a user control or
window 'localizable', a new resx will be available for every language
you want to translate to (the mechanism falls back to the default
language if it can't find resx in other languages).

If the strings are actual 'settings' which the user should be able to
change, then perhaps a config might be more appropriate...

Regards,
Jeroen

Thanks for your response Jeroen.

The application isn't intended to be translated for other languages.

This is purely to store messages that will be used in User Dialogs and
other strings on Forms.

We just need a good way of avoiding a rebuild if the User decides
they'd like to reword some of these strings at a later date.

Artie
 
J

Jeroen

G

guy

In some cases it may be worth storing your configuraqtion data in a database
table, that way you can edit it without recompiling, It can make maintaining
a customers site a bit easier!

HTH

Guy
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,


Do a google search by .NET localization and read a couple of articles and
decide what is the best way around yuor problem.
If you are only going to translate in 1 or 2 languages keeping the way it's
may be probable faster than generating the infrastrcuture to support any
number of languages.
 
A

Artie

Hi,

Do a google search by .NET localization and read a couple of articles and
decide what is the best way around yuor problem.
If you are only going to translate in 1 or 2 languages keeping the way it's
may be probable faster than generating the infrastrcuture to support any
number of languages.

--
Ignacio Machinhttp://www.laceupsolutions.com








- Show quoted text -

Thanks for your response Ignacio, but I'm not doing this for different
languages.

It's just to keep strings out of the code and in config files.

So far, it looks like the existing design (using app.config) is the
best, since it really only needs to store key-value pairs.

Thanks

Artie
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top