/// <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)] public static 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; }
public static bool Load(string language) { bool isPrefixEnabled; using (var reader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { isPrefixEnabled = reader.GetValueAsBool("general", "myprefix", true); if (language == null) language = reader.GetValueAsString("skin", "language", "English"); } string directory = Config.GetSubFolder(Config.Dir.Language, "TVWishListMP"); string cultureName = null; if (language != null) cultureName = GetCultureName(language); Log.Info("[TVWishListMP Localice Strings]: Loading localised Strings - Path: {0} Culture: {1} Language: {2} Prefix: {3}", directory, cultureName, language, isPrefixEnabled); _stringProvider = new LocalisationProvider(directory, cultureName, isPrefixEnabled); //GUIGraphicsContext.CharsInCharacterSet = _stringProvider.Characters; return true; }
public static bool Load(string language) { bool isPrefixEnabled; using (var reader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { isPrefixEnabled = reader.GetValueAsBool("general", "myprefix", true); if (language == null) language = reader.GetValueAsString("skin", "language", "English"); } string directory = Config.GetSubFolder(Config.Dir.Language, "TVWishListMP"); string cultureName = null; if (language != null) cultureName = GetCultureName(language); Log.Info("[aTVWishListMP Localice Strings]: Loading localised Strings - Path: {0} Culture: {1} Language: {2} Prefix: {3}", directory, cultureName, language, isPrefixEnabled); _stringProvider = new LocalisationProvider(directory, cultureName, isPrefixEnabled); CultureInfo MPculture = CultureInfo.CreateSpecificCulture(cultureName); Log.Debug("MPculture.EnglishName=" + MPculture.EnglishName); Log.Debug("MPculture.Parent.EnglishName=" + MPculture.Parent.EnglishName); CultureInfo[] availableCultures = _stringProvider.AvailableLanguages(); foreach (CultureInfo myculture in availableCultures) { if (myculture.EnglishName == language) { Log.Info("[bTVWishListMP Localice Strings]: Loading localised Strings - Path: {0} Culture: {1} Language: {2} Prefix: {3}", directory, cultureName, language, isPrefixEnabled); _stringProvider = new LocalisationProvider(directory, cultureName, isPrefixEnabled); return true; } } foreach (CultureInfo myculture in availableCultures) { if (myculture.EnglishName == MPculture.Parent.EnglishName) { Log.Info("[cTVWishListMP Localice Strings]: Loading localised Strings - Path: {0} Culture: {1} Language: {2} Prefix: {3}", directory, MPculture.Parent.TwoLetterISOLanguageName, MPculture.Parent.EnglishName, isPrefixEnabled); _stringProvider = new LocalisationProvider(directory, MPculture.Parent.TwoLetterISOLanguageName, isPrefixEnabled); return true; } } CultureInfo bestculture = _stringProvider.GetBestLanguage(); Log.Info("[dTVWishListMP Localice Strings]: Loading localised Strings - Path: {0} Culture: {1} Language: {2} Prefix: {3}", directory, bestculture.TwoLetterISOLanguageName, bestculture.EnglishName, isPrefixEnabled); _stringProvider = new LocalisationProvider(directory, bestculture.TwoLetterISOLanguageName, isPrefixEnabled); return true; }
/// <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; }
/// <summary> /// Public method to load the text from a strings/xml file into memory /// </summary> /// <param name="language">language for which the file should be loaded</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 (var reader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { // isPrefixEnabled = reader.GetValueAsBool("general", "myprefix", true); // setting moved in MP isPrefixEnabled = reader.GetValueAsBool("gui", "myprefix", true); if (language == null) language = reader.GetValueAsString("gui", "language", null); // try to get MP language from config } string directory = Config.GetSubFolder(Config.Dir.Language, "MyFilms"); string cultureName = null; if (language != null) cultureName = GetCultureName(language); LogMyFilms.Info("Loading localised Strings - Culture: '{0}', Language: '{1}', Prefix: '{2}', Path: '{3}'", cultureName, language, isPrefixEnabled, directory); _stringProvider = new LocalisationProvider(directory, cultureName, isPrefixEnabled); GUIGraphicsContext.CharsInCharacterSet = _stringProvider.Characters; return true; }