An object that manages access to localized resources.
Inheritance: IDisposable, ITranslationManager
        /// <summary>
        /// Sets the EventManager, the ResourceManager, the RequestManager and the AggregateManager.
        /// </summary>
        /// <param name="eventManager">The event manager.</param>
        /// <param name="resourceManager">The resource manager.</param>
        /// <param name="requestManager">The request manager.</param>
        public void CreateServerObject(
            EventManager      eventManager,
            ResourceManager   resourceManager, 
            RequestManager    requestManager)
        {
            m_eventManager = eventManager;
            m_resourceManager = resourceManager;
            m_requestManager = requestManager;

            // create the server object.
            CreateServerObject();
        }
        /// <summary>
        /// Creates the resource manager for the server.
        /// </summary>
        /// <param name="server">The server.</param>
        /// <param name="configuration">The configuration.</param>
        /// <returns>Returns an object that manages access to localized resources, the return type is <seealso cref="ResourceManager"/>.</returns>
        protected virtual ResourceManager CreateResourceManager(IServerInternal server, ApplicationConfiguration configuration)
        {
            ResourceManager resourceManager = new ResourceManager(server, configuration);

            // load default text for all status codes.
            resourceManager.LoadDefaultText();

            return resourceManager;
        }
        /// <summary>
        /// Creates the resource manager for the server.
        /// </summary>
        protected override ResourceManager CreateResourceManager(IServerInternal server, ApplicationConfiguration configuration)
        {
            ResourceManager resourceManager = new ResourceManager(server, configuration);
            
            // add some localized strings to the resource manager to demonstrate that localization occurs.
            resourceManager.Add("InvalidPassword", "de-DE", "Das Passwort ist nicht gültig für Konto '{0}'.");
            resourceManager.Add("InvalidPassword", "es-ES", "La contraseña no es válida para la cuenta de '{0}'.");

            resourceManager.Add("UnexpectedUserTokenError", "fr-FR", "Une erreur inattendue s'est produite lors de la validation utilisateur.");
            resourceManager.Add("UnexpectedUserTokenError", "de-DE", "Ein unerwarteter Fehler ist aufgetreten während des Anwenders.");
           
            return resourceManager;
        }
Esempio n. 4
0
        /// <summary>
        /// Creates the resource manager for the server.
        /// </summary>
        protected override ResourceManager CreateResourceManager(IServerInternal server, ApplicationConfiguration configuration)
        {
            ResourceManager resourceManager = new ResourceManager(server, configuration);

            System.Reflection.FieldInfo[] fields = typeof(StatusCodes).GetFields(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static);

            foreach (System.Reflection.FieldInfo field in fields)
            {
                uint? id = field.GetValue(typeof(StatusCodes)) as uint?;

                if (id != null)
                {
                    resourceManager.Add(id.Value, "en-US", field.Name);
                }
            }

            return resourceManager;
        }
Esempio n. 5
0
        /// <summary>
        /// Creates the resource manager for the server.
        /// </summary>
        protected override ResourceManager CreateResourceManager(IServerInternal server, ApplicationConfiguration configuration)
        {
            ResourceManager resourceManager = new ResourceManager(server, configuration);

            // load default text for all status codes.
            resourceManager.LoadDefaultText();

            // add translations for standard error codes.
            resourceManager.Add(StatusCodes.BadUserAccessDenied, "en-US", "User does not have permission to perform the requested operation.");
            resourceManager.Add(StatusCodes.BadUserAccessDenied, "fr-FR", "Utilisateur ne peut pas changer la valeur.");
            resourceManager.Add(StatusCodes.BadUserAccessDenied, "de-DE", "User nicht ändern können, Wert.");

            // add translations for server defined error codes.
            resourceManager.Add(TutorialErrorCodes.InvalidPassword, "en-US", "Specified password is not valid for user '{0}'.");
            resourceManager.Add(TutorialErrorCodes.InvalidPassword, "de-DE", "Das Passwort ist nicht gültig für Konto '{0}'.");
            resourceManager.Add(TutorialErrorCodes.InvalidPassword, "es-ES", "La contraseña no es válida para la cuenta de '{0}'.");

            return resourceManager;
        }