コード例 #1
0
        static UILanguage()
        {
            var xmlDocument = new XmlDocument();
            xmlDocument.Load(Path.Combine(Path.GetDirectoryName(typeof(UILanguage).Assembly.Location), "MUI", "languages.xml"));

            var nodes = xmlDocument.GetElementsByTagName("Language");
            _installedLanguages = new UILanguage[nodes.Count];

            for (int i = 0; i < nodes.Count; i++)
            {
                _installedLanguages[i] = new UILanguage(nodes[i].Attributes["name"].Value, nodes[i].Attributes["id"].Value);
            }
        }
コード例 #2
0
ファイル: UILanguage.cs プロジェクト: tanmoydeb07/LiteDevelop
        static UILanguage()
        {
            var xmlDocument = new XmlDocument();

            xmlDocument.Load(Path.Combine(Path.GetDirectoryName(typeof(UILanguage).Assembly.Location), "MUI", "languages.xml"));

            var nodes = xmlDocument.GetElementsByTagName("Language");

            _installedLanguages = new UILanguage[nodes.Count];

            for (int i = 0; i < nodes.Count; i++)
            {
                _installedLanguages[i] = new UILanguage(nodes[i].Attributes["name"].Value, nodes[i].Attributes["id"].Value);
            }
        }
コード例 #3
0
 /// <summary>
 /// Gets the language pack by its language identifier.
 /// </summary>
 /// <param name="language">The language of the language pack to get.</param>
 /// <returns>A language pack holding the given identifier, or null if none can be found.</returns>
 public virtual UILanguagePack GetLanguagePack(UILanguage language)
 {
     UILanguagePack pack;
     if (!_cachedLanguagePacks.TryGetValue(language, out pack))
     {
         var path = GetLanguagePackFilePath(language);
         if (File.Exists(path.FullPath))
         {
             var fallbackPack = language == UILanguage.Default ? null : DefaultLanguagePack;
             pack = new UILanguagePack(path, fallbackPack);
             _cachedLanguagePacks.Add(language, pack);
         }
     }
     return pack;
 }
コード例 #4
0
        /// <summary>
        /// Gets the language pack by its language identifier.
        /// </summary>
        /// <param name="language">The language of the language pack to get.</param>
        /// <returns>A language pack holding the given identifier, or null if none can be found.</returns>
        public virtual UILanguagePack GetLanguagePack(UILanguage language)
        {
            UILanguagePack pack;

            if (!_cachedLanguagePacks.TryGetValue(language, out pack))
            {
                var path = GetLanguagePackFilePath(language);
                if (File.Exists(path.FullPath))
                {
                    pack = new UILanguagePack(path);
                    _cachedLanguagePacks.Add(language, pack);
                }
            }
            return(pack);
        }
コード例 #5
0
        /// <summary>
        /// Gets the language pack by its language identifier.
        /// </summary>
        /// <param name="language">The language of the language pack to get.</param>
        /// <returns>A language pack holding the given identifier, or null if none can be found.</returns>
        public virtual UILanguagePack GetLanguagePack(UILanguage language)
        {
            UILanguagePack pack;

            if (!_cachedLanguagePacks.TryGetValue(language, out pack))
            {
                var path = GetLanguagePackFilePath(language);
                if (File.Exists(path.FullPath))
                {
                    var fallbackPack = language == UILanguage.Default ? null : DefaultLanguagePack;
                    pack = new UILanguagePack(path, fallbackPack);
                    _cachedLanguagePacks.Add(language, pack);
                }
            }
            return(pack);
        }
コード例 #6
0
 /// <summary>
 /// Gets the language pack file path by its language identifier.
 /// </summary>
 /// <param name="language">The language of the language pack to get.</param>
 /// <returns>A file path to the language pack.</returns>
 public virtual FilePath GetLanguagePackFilePath(UILanguage language)
 {
     return(new FilePath(_muiDirectory).Combine(language.PackIdentifier + ".xml"));
 }
コード例 #7
0
ファイル: MuiProcessor.cs プロジェクト: ThrDev/LiteDevelop
 /// <summary>
 /// Gets the language pack file path by its language identifier.
 /// </summary>
 /// <param name="language">The language of the language pack to get.</param>
 /// <returns>A file path to the language pack.</returns>
 public virtual FilePath GetLanguagePackFilePath(UILanguage language)
 {
     return new FilePath(_muiDirectory).Combine(language.PackIdentifier + ".xml");
 }
コード例 #8
0
ファイル: MuiProcessor.cs プロジェクト: ThrDev/LiteDevelop
 /// <summary>
 /// Gets the language pack by its language identifier.
 /// </summary>
 /// <param name="language">The language of the language pack to get.</param>
 /// <returns>A language pack holding the given identifier, or null if none can be found.</returns>
 public virtual UILanguagePack GetLanguagePack(UILanguage language)
 {
     UILanguagePack pack;
     if (!_cachedLanguagePacks.TryGetValue(language, out pack))
     {
         var path = GetLanguagePackFilePath(language);
         if (File.Exists(path.FullPath))
         {
             pack = new UILanguagePack(path);
             _cachedLanguagePacks.Add(language, pack);
         }
     }
     return pack;
 }