public void InitializeDefaultLocalizer (IAddinLocalizer localizer)
		{
			if (localizer != null)
				defaultLocalizer = new AddinLocalizer (localizer);
			else
				defaultLocalizer = null;
		}
Exemplo n.º 2
0
 public void InitializeDefaultLocalizer(IAddinLocalizer localizer)
 {
     if (localizer != null)
     {
         defaultLocalizer = new AddinLocalizer(localizer);
     }
     else
     {
         defaultLocalizer = null;
     }
 }
Exemplo n.º 3
0
 internal RuntimeAddin(AddinEngine addinEngine, RuntimeAddin parentAddin, ModuleDescription module)
 {
     this.addinEngine = addinEngine;
     this.parentAddin = parentAddin;
     this.module      = module;
     id                  = parentAddin.id;
     baseDirectory       = parentAddin.baseDirectory;
     privatePath         = parentAddin.privatePath;
     ainfo               = parentAddin.ainfo;
     localizer           = parentAddin.localizer;
     module.RuntimeAddin = this;
 }
Exemplo n.º 4
0
 internal RuntimeAddin(AddinEngine addinEngine, RuntimeAddin parentAddin, ModuleDescription module)
 {
     this.addinEngine = addinEngine;
     this.parentAddin = parentAddin;
     this.module = module;
     id = parentAddin.id;
     baseDirectory = parentAddin.baseDirectory;
     privatePath = parentAddin.privatePath;
     ainfo = parentAddin.ainfo;
     localizer = parentAddin.localizer;
     module.RuntimeAddin = this;
 }
Exemplo n.º 5
0
 /// <summary>
 /// Sets the default localizer to be used for this add-in engine
 /// </summary>
 /// <param name="localizer">
 /// The add-in localizer
 /// </param>
 public void InitializeDefaultLocalizer(IAddinLocalizer localizer)
 {
     CheckInitialized();
     lock (LocalLock) {
         if (localizer != null)
         {
             defaultLocalizer = new AddinLocalizer(localizer);
         }
         else
         {
             defaultLocalizer = null;
         }
     }
 }
Exemplo n.º 6
0
        internal AddinDescription Load(Addin iad)
        {
            ainfo = iad;

            ArrayList plugList = new ArrayList();
            ArrayList asmList  = new ArrayList();

            AddinDescription description = iad.Description;

            id            = description.AddinId;
            baseDirectory = description.BasePath;

            // Load the main modules
            LoadModule(description.MainModule, description.Namespace, plugList, asmList);

            // Load the optional modules, if the dependencies are present
            foreach (ModuleDescription module in description.OptionalModules)
            {
                if (CheckAddinDependencies(module))
                {
                    LoadModule(module, description.Namespace, plugList, asmList);
                }
            }

            depAddins  = (RuntimeAddin[])plugList.ToArray(typeof(RuntimeAddin));
            assemblies = (Assembly[])asmList.ToArray(typeof(Assembly));

            if (description.Localizer != null)
            {
                string cls = description.Localizer.GetAttribute("type");

                // First try getting one of the stock localizers. If none of found try getting the type.
                object fob = CreateInstance("Mono.Addins.Localization." + cls + "Localizer", false);
                if (fob == null)
                {
                    fob = CreateInstance(cls, true);
                }

                IAddinLocalizerFactory factory = fob as IAddinLocalizerFactory;
                if (factory == null)
                {
                    throw new InvalidOperationException("Localizer factory type '" + cls + "' must implement IAddinLocalizerFactory");
                }
                localizer = new AddinLocalizer(factory.CreateLocalizer(this, description.Localizer));
            }

            return(description);
        }
Exemplo n.º 7
0
        internal AddinDescription Load(Addin iad)
        {
            ainfo = iad;

            AddinDescription description = iad.Description;

            id                  = description.AddinId;
            baseDirectory       = description.BasePath;
            module              = description.MainModule;
            module.RuntimeAddin = this;

            if (description.Localizer != null)
            {
                string cls = description.Localizer.GetAttribute("type");

                // First try getting one of the stock localizers. If none of found try getting the type.
                object fob = null;
                Type   t   = Type.GetType("Mono.Addins.Localization." + cls + "Localizer, " + GetType().Assembly.FullName, false);
                if (t != null)
                {
                    fob = Activator.CreateInstance(t);
                }

                if (fob == null)
                {
                    fob = CreateInstance(cls, true);
                }

                IAddinLocalizerFactory factory = fob as IAddinLocalizerFactory;
                if (factory == null)
                {
                    throw new InvalidOperationException("Localizer factory type '" + cls + "' must implement IAddinLocalizerFactory");
                }
                localizer = new AddinLocalizer(factory.CreateLocalizer(this, description.Localizer));
            }

            return(description);
        }
Exemplo n.º 8
0
			public AddinLocalizerWrapper (AddinLocalizer localizer)
			{
				this.localizer = localizer;
			}
Exemplo n.º 9
0
		/// <summary>
		/// Launchs an effect dialog.
		/// </summary>
		/// <param name="localizer">
		/// The localizer for the effect add-in. This is used to fetch translations for the
		/// strings in the dialog.
		/// </param>
		public static bool LaunchSimpleEffectDialog (BaseEffect effect, AddinLocalizer localizer)
		{
			return LaunchSimpleEffectDialog (effect, new AddinLocalizerWrapper (localizer));
		}
Exemplo n.º 10
0
        internal AddinDescription Load(Addin iad)
        {
            ainfo = iad;

            AddinDescription description = iad.Description;
            id = description.AddinId;
            baseDirectory = description.BasePath;
            module = description.MainModule;
            module.RuntimeAddin = this;

            if (description.Localizer != null) {
                string cls = description.Localizer.GetAttribute ("type");

                // First try getting one of the stock localizers. If none of found try getting the type.
                object fob = null;
                Type t = Type.GetType ("Mono.Addins.Localization." + cls + "Localizer, " + GetType().Assembly.FullName, false);
                if (t != null)
                    fob = Activator.CreateInstance (t);

                if (fob == null)
                    fob = CreateInstance (cls, true);

                IAddinLocalizerFactory factory = fob as IAddinLocalizerFactory;
                if (factory == null)
                    throw new InvalidOperationException ("Localizer factory type '" + cls + "' must implement IAddinLocalizerFactory");
                localizer = new AddinLocalizer (factory.CreateLocalizer (this, description.Localizer));
            }

            return description;
        }
Exemplo n.º 11
0
		/// <summary>
		/// Sets the default localizer to be used for this add-in engine
		/// </summary>
		/// <param name="localizer">
		/// The add-in localizer
		/// </param>
		public void InitializeDefaultLocalizer (IAddinLocalizer localizer)
		{
			CheckInitialized ();
			lock (LocalLock) {
				if (localizer != null)
					defaultLocalizer = new AddinLocalizer (localizer);
				else
					defaultLocalizer = null;
			}
		}
Exemplo n.º 12
0
		public static string GetPluralString (string msgid, string defaultPlural, int n, params string[] args)
		{
			if (localizer == null)
				localizer = AddinManager.CurrentLocalizer;
			return localizer.GetPluralString (msgid, defaultPlural, n, args);
		}
Exemplo n.º 13
0
		public static string GetString (string str)
		{
			if (localizer == null)
				localizer = AddinManager.CurrentLocalizer;
			return localizer.GetString (str);
		}
		internal AddinDescription Load (Addin iad)
		{
			ainfo = iad;
			
			ArrayList plugList = new ArrayList ();
			ArrayList asmList = new ArrayList ();
			
			AddinDescription description = iad.Description;
			id = description.AddinId;
			baseDirectory = description.BasePath;
			
			// Load the main modules
			LoadModule (description.MainModule, description.Namespace, plugList, asmList);
			
			// Load the optional modules, if the dependencies are present
			foreach (ModuleDescription module in description.OptionalModules) {
				if (CheckAddinDependencies (module))
					LoadModule (module, description.Namespace, plugList, asmList);
			}
			
			depAddins = (RuntimeAddin[]) plugList.ToArray (typeof(RuntimeAddin));
			assemblies = (Assembly[]) asmList.ToArray (typeof(Assembly));
			
			if (description.Localizer != null) {
				string cls = description.Localizer.GetAttribute ("type");
				
				// First try getting one of the stock localizers. If none of found try getting the type.
				object fob = CreateInstance ("Mono.Addins.Localization." + cls + "Localizer", false);
				if (fob == null)
					fob = CreateInstance (cls, true);
				
				IAddinLocalizerFactory factory = fob as IAddinLocalizerFactory;
				if (factory == null)
					throw new InvalidOperationException ("Localizer factory type '" + cls + "' must implement IAddinLocalizerFactory");
				localizer = new AddinLocalizer (factory.CreateLocalizer (this, description.Localizer));
			}
			
			return description;
		}