Hi Ian,

what's about something like that? Giving the following
resource files

  Global.resx
  Another.resx
  ... .resx

we could have a separate resource manager for each resource file,
solving also the problem with VS.NET:

using System.Reflection;
using System.Resources;
using System.Globalization;

namespace NAnt.Core.Util
{
    /// <summary>
    /// Provides resource support to NAnt assemblies. This class cannot
be inherited.
    /// </summary>
    internal sealed class ResourceUtils {
        #region public fields
        public static readonly ResourceManager Global;
        pubilc static readonly ResourceManager Another;
        ...
        #endregion public fields

        #region private fields
        private const string GlobalResx = ".Global";
        private const string AnotherResx = ".Another";
        ...
        #endregion private fields

        #region private constructors
        static ResourceUtils() {
            Assembly assembly = Assembly.GetCallingAssembly();
            Global = new ResourceManager(assembly.GetName().Name +
GlobalResx, assembly);
            Another = new ResourceManager(assembly.GetName().Name +
AnotherResx, assembly);
            ...
        }

        private ResourceUtils() {}
        #endregion private constructors
    }
}

To get localized strings, one should write something like this:

string str1 = ResourceUtils.Global("NA1001_AnErrorMessage");
string str2 = ResourceUtils.Another("AnotherString");
string str3 = ...

What do you think about?
j3d.

Giuseppe Greco
Software Architect

Banca del Gottardo
via Trevano 2A
6901 Lugano
Swizterland

Phone: +41 91 808 16 79
Fax: +41 91 808 24 00
Web: www.gottardo.com


---------------------------------- DISCLAIMER ----------------------------------
This message (including any attachments) is confidential and may be
privileged. If you have received it by mistake please notify the sender
by return e-mail and delete this message from your system.Any unauthorised
use or dissemination of this message in whole or in part is strictly
prohibited. Please note that e-mails are susceptible to change.
Banca del Gottardo (including its group companies) shall not be liable for
the improper or incomplete transmission of the information contained in this
communication nor for any delay in its receipt or damage to your system.
Under no circumstances this message can be considered as a written acceptance
or confirmation of an instruction/order given to Banca del Gottardo. 
Instructions and orders cannot be accepted or confirmed via e-mail.
Banca del Gottardo (or its group companies) does not guarantee that the 
integrity
of this communication has been maintained nor that this communication is free of
viruses, interceptions or interference.
---------------------------------------------------------------------------------


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
nant-developers mailing list
nant-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-developers

Reply via email to