Click here to Skip to main content
11,641,708 members (63,669 online)
Click here to Skip to main content
Add your own
alternative version

A Flexible Plugin System

, 3 Sep 2008 LGPL3 74.9K 1.4K 157
A generic plugin system used to load and manage plugins
fadd-15373.zip
trunk
dlls
xunit.dll
Examples
Plugins
ExampleApplication.Shared
Properties
ExampleApplication
Properties
ExamplePlugin.Shared
Properties
ExamplePlugin
Properties
Fadd.Globalization.Yaml
fadd.snk
Properties
Tests
fadd
Commands
Net
Tests
fadd.snk
Globalization
Tests
Logging
Plugins
Properties
Tests
Validation
namespace Fadd.Globalization
{

    /// <summary>
    /// This node is returned instead of null.
    /// </summary>
    public class EmptyLanguageNode : LanguageNode
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="EmptyLanguageNode"/> class.
        /// </summary>
        /// <param name="defaultLCID">The default LCID.</param>
        public EmptyLanguageNode(int defaultLCID)
            : base(defaultLCID)
        {
        }

        /// <summary>
        /// Add a localized text string.
        /// </summary>
        /// <param name="lcid">locale</param>
        /// <param name="name">Name identifying the string. Used to fetch the string later on.</param>
        /// <param name="text">Localized string</param>        
        public override void Add(string name, int lcid, string text)
        {
            throw new System.NotImplementedException();
        }

		/// <summary>
		/// Sets a localized text string. If the a string with the specified name exists it will be overwritten.
		/// </summary>
		/// <param name="name">Name identifying the string. Used to fetch the string later on.</param>
		/// <param name="lcid">locale</param>
		/// <param name="text">Localized string</param>
		public override void Set(string name, int lcid, string text)
		{
			throw new System.Exception("The method or operation is not implemented.");
		}

        /// <summary>
        /// Get a localized text string in the current language.
        /// </summary>
        /// <param name="textName">Phrase to find.</param>
        /// <returns>text if found; [textName] if not.</returns>
        /// <example>
        /// <code>
        /// lang["Name"] // => "Name"
        /// lang["Naem"] // => "[Naem]" since it's missing
        /// </code>
        /// </example>
        public override string this[string textName]
        {
            get { return EmptyValue(textName); }
        }

        /// <summary>
        /// Get a localized text string
        /// </summary>
        /// <param name="lcid"></param>
        /// <param name="textName">Phrase to find.</param>
        /// <returns>text if found; [textName] if not.</returns>
        /// <example>
        /// <code>
        /// lang["Name"] // => "Name"
        /// lang["Naem"] // => "[Naem]" since it's missing
        /// </code>
        /// </example>
        public override string this[string textName, int lcid]
        {
            get { return EmptyValue(textName); }
        }

        /// <summary>
        /// Number languages
        /// </summary>
        public override int Count
        {
            get { return 0; }
        }

        /// <summary>
        /// Number of translated texts in the specified language
        /// </summary>
        /// <param name="lcid"></param>
        /// <returns></returns>
        public override int GetTextCount(int lcid)
        {
            return 0;
        }

        /// <summary>
        /// Determine if a category contains a specific language.
        /// </summary>
        /// <param name="lcid"></param>
        /// <returns></returns>
        public override bool Contains(int lcid)
        {
            return false;
        }

        /// <summary>Unimplemented function to fulfill the requirements of <see cref="LanguageNode"/> base class</summary>
        /// <param name="name">The name to add</param>
        public override LanguageNode AddNode(string name)
        {
            throw new System.NotImplementedException();
        }

        /// <summary>Empties all saved values in the node and its sub nodes</summary>
        public override void ClearHierarchy()
        {
            throw new System.NotImplementedException();
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU Lesser General Public License (LGPLv3)

Share

About the Author

jgauffin
Founder Gauffin Interactive AB
Sweden Sweden
Founder of OneTrueError, a .NET service which captures, analyzes and provide possible solutions for exceptions.

blog | twitter

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150731.1 | Last Updated 3 Sep 2008
Article Copyright 2008 by jgauffin
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid