Wednesday, January 11, 2006

"Neutral" Resources

The system may have a concept of a "neutral language", but in the real world I tend to write my default messages in a concrete language (which for me is en-GB). When it comes to doing localisation, there's no need to then duplicate the effort and create a separate en-GB resources file - simply mark your "neutral" version with what it actually is.

You can do this with an attribute (in AssemblyInfo.cs), like so:

[assembly: NeutralResourcesLanguage("en-GB")]

EDIT: Should have guessed this already really, but I've just realised that in VS2005 with its new GUI to edit the AssemblyInfo.cs file, this attribute is a drop down inside the Assembly Information page anyway. Simplicity itself.

No comments: