コード例 #1
0
        /// <summary>
        /// Public method to load the text from a strings/xml file into memory
        /// </summary>
        /// <param name="strFileName">Contains the filename+path for the string.xml file</param>
        /// <returns>
        /// true when text is loaded
        /// false when it was unable to load the text
        /// </returns>
        //[Obsolete("This method has changed", true)]
        public static bool Load(string language)
        {
            bool isPrefixEnabled = true;

            using (Settings reader = new MPSettings())
            {
                isPrefixEnabled = reader.GetValueAsBool("gui", "myprefix", true);
            }

            string directory   = Config.GetFolder(Config.Dir.Language);
            string cultureName = null;

            if (language != null)
            {
                cultureName = GetCultureName(language);
            }

            Log.Info("Loading localized Strings - Path: {0} Culture: {1}  Language: {2} Prefix: {3}", directory, cultureName,
                     language, isPrefixEnabled);

            // http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.aspx
            _stringProvider = new LocalisationProvider(directory, cultureName, isPrefixEnabled);

            if (_stringProvider.Characters > GUIGraphicsContext.CharsInCharacterSet)
            {
                GUIGraphicsContext.CharsInCharacterSet = _stringProvider.Characters;
            }
            return(true);
        }
コード例 #2
0
        /// <summary>
        /// Public method to load the text from a strings/xml file into memory
        /// </summary>
        /// <param name="language">Language</param>
        /// <returns>
        /// true when text is loaded
        /// false when it was unable to load the text
        /// </returns>
        //[Obsolete("This method has changed", true)]
        static public bool Load(string language)
        {
            bool isPrefixEnabled;

            using (MediaPortal.Profile.Settings reader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml")))
                isPrefixEnabled = reader.GetValueAsBool("general", "myprefix", true);

            string directory   = Config.GetSubFolder(Config.Dir.Language, "MPlayer");
            string cultureName = null;

            if (language != null)
            {
                cultureName = GetCultureName(language);
            }

            Log.Info("MPlayer: Loading localised Strings - Path: {0} Culture: {1}  Language: {2} Prefix: {3}", directory, cultureName, language, isPrefixEnabled);

            _stringProvider = new LocalisationProvider(directory, cultureName, isPrefixEnabled);

            return(true);
        }