Steve
Steve

Reputation: 11963

Centralized vs local string resource files

I am trying to figure out whether a global string resource file for the entire application or a local resource file for each small sub area would be a better choice.

It seems like a translator would appreciate the one file approach vs hundreds of them. It is also easier to write helper functions since there is only going to be one static resource class.

The downside is that the resource name might be really long to properly identify the place where it is suppose to be in and it might be hard to locate related strings when the file grows big.

Where as a local resource file would produce lots of duplicated strings or make it confusing if we need to use multiple instances of static resource classes because the strings are spread between multiple of them.

So what would be a better way to go?

Upvotes: 0

Views: 264

Answers (1)

Jure
Jure

Reputation: 1176

Maybe you could break your resources into 3 files (depending on your application design):

  • ResourcesCore

    For translated enum values and common expressions

  • ResourcesEntity

    For strings related to translation of some entity properties (e.g. Person.Name)

  • ResourcesWeb (or ResourceUI)

    For other UI related stuff (like strings on UI, labels, descriptions, etc.)

You could then use ResXManager extension for VS to manage you resource strings (way easier than native .NET ResX manager, at least for me).

Upvotes: 0

Related Questions