zoukankan      html  css  js  c++  java
  • (原) DevExpress 10.2.5 中文语言包

    背景:     

    解决办法:

         1、写了个小工具自动清理官方语言包资源,只保留中文那种;

         2、又写了个小工具,自动编译出一个民间汉化程序集来解析上面的资源包,进行汉化工作。

         3、使用方法,在程序最开始的地方这样写一下

              GridLocalizer.Active = new GridLocalizerCN();

              把/Files/spymaster/DevExpress.Utils.Localization.v10.2.rar放到程序的根目录下,记得引用那个Assembly。
              。。。。。。。。。

             其它的对应关系如下,相信你懂的。

        public class  BarLocalizerCN : BarLocalizer
        public class ChartLocalizerCN : ChartLocalizer
        public class GridLocalizerCN : GridLocalizer
        public class LayoutLocalizerCN : LayoutLocalizer
        public class LocalizerCN : Localizer
        public class NavBarLocalizerCN : NavBarLocalizer
        public class PivotGridLocalizerCN : PivotGridLocalizer
        public class PreviewLocalizerCN : PreviewLocalizer
        public class ReportLocalizerCN : ReportLocalizer
        public class SchedulerExtensionsLocalizerCN : SchedulerExtensionsLocalizer
        public class SchedulerLocalizerCN : SchedulerLocalizer
        public class SpellCheckerLocalizerCN : SpellCheckerLocalizer
        public class TreeListLocalizerCN : TreeListLocalizer
        public class VGridLocalizerCN : VGridLocalizer
        public class WizardLocalizerCN : WizardLocalier

            4、上工具源码(贴不了代码,贴文本吧)

       

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.IO;
    using System.CodeDom;
    using Microsoft.CSharp;
    using System.CodeDom.Compiler;

    namespace LocaltionMaker
    {
        public partial class FormMain : Form
        {
            public FormMain()
            {
                InitializeComponent();
            }
            string strRootPath ="";
            private void GetFileInfo(string filePath)
            {
                List<string> all = new List<string>();
                DirectoryInfo directoryInfo = new DirectoryInfo(filePath);
                try
                {
                    foreach (DirectoryInfo childDirectoryInfo in directoryInfo.GetDirectories())
                    {
                        if (childDirectoryInfo.Name.StartsWith("DevExpress.Xtra") ||
                            childDirectoryInfo.Name.StartsWith("DevExpress.PivotGrid") ||
                            childDirectoryInfo.Name.StartsWith("DevExpress.RichEdit"))
                            GetFileInfo(filePath + "\\" + childDirectoryInfo.Name.ToString());
                        else
                            childDirectoryInfo.Delete(true);
                    }
                    foreach (FileInfo fileInfo in directoryInfo.GetFiles())
                    {
                        if (fileInfo.FullName.Contains(".zh-CN.resx"))
                            tBoxResult.Text += fileInfo.FullName.Replace(strRootPath,"") + "\r\n";
                        else
                            fileInfo.Delete();
                    }
                    if (directoryInfo.GetFiles().Length == 0 && directoryInfo.GetDirectories().Length == 0)
                        directoryInfo.Delete();
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message);
                }
            }

            private void btnClear_Click(object sender, EventArgs e)
            {
                FolderBrowserDialog fbd = new FolderBrowserDialog();
                fbd.ShowNewFolderButton = false;
                fbd.ShowDialog();
                if (fbd.SelectedPath != "")
                {
                    if (!fbd.SelectedPath.Contains("dxKB_A421"))
                    {
                        MessageBox.Show("语言包目录不正确,为避免风险请重新选择!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                    strRootPath = fbd.SelectedPath;
                    GetFileInfo(fbd.SelectedPath);
                }
                tBoxResult.Text += "清理完成!";
            }
            private void btnBuilder_Click(object sender, EventArgs e)
            {
                string strAssemblyName = string.Format("DevExpress.Utils.Localization.{0}.dll", tBoxVersion.Text);
                var codeNamespace = new CodeNamespace("DevExpress.Utils.Localization");
                Dictionary<string, string> providerOption = new Dictionary<string, string>();
                var csc = new CSharpCodeProvider(providerOption);
                var compilerParameters = new CompilerParameters();
                compilerParameters.GenerateExecutable = false;
                compilerParameters.OutputAssembly = strAssemblyName;
                compilerParameters.ReferencedAssemblies.Add("System.dll");
                compilerParameters.ReferencedAssemblies.Add("System.Core.dll");
                compilerParameters.ReferencedAssemblies.Add("System.Data.dll");
                compilerParameters.ReferencedAssemblies.Add("System.Windows.Forms.dll");
                compilerParameters.ReferencedAssemblies.Add("System.Data.DataSetExtensions.dll");
                compilerParameters.ReferencedAssemblies.Add(string.Format("DevExpress.Charts.{0}.Core.dll", tBoxVersion.Text));
                compilerParameters.ReferencedAssemblies.Add(string.Format("DevExpress.Data.{0}.dll", tBoxVersion.Text));
                compilerParameters.ReferencedAssemblies.Add(string.Format("DevExpress.PivotGrid.{0}.Core.dll", tBoxVersion.Text));
                compilerParameters.ReferencedAssemblies.Add(string.Format("DevExpress.SpellChecker.{0}.Core.dll", tBoxVersion.Text));
                compilerParameters.ReferencedAssemblies.Add(string.Format("DevExpress.Utils.{0}.dll", tBoxVersion.Text));
                compilerParameters.ReferencedAssemblies.Add(string.Format("DevExpress.XtraBars.{0}.dll", tBoxVersion.Text));
                compilerParameters.ReferencedAssemblies.Add(string.Format("DevExpress.XtraCharts.{0}.dll", tBoxVersion.Text));
                compilerParameters.ReferencedAssemblies.Add(string.Format("DevExpress.XtraEditors.{0}.dll", tBoxVersion.Text));
                compilerParameters.ReferencedAssemblies.Add(string.Format("DevExpress.XtraGrid.{0}.dll", tBoxVersion.Text));
                compilerParameters.ReferencedAssemblies.Add(string.Format("DevExpress.XtraLayout.{0}.dll", tBoxVersion.Text));
                compilerParameters.ReferencedAssemblies.Add(string.Format("DevExpress.XtraNavBar.{0}.dll", tBoxVersion.Text));
                compilerParameters.ReferencedAssemblies.Add(string.Format("DevExpress.XtraPivotGrid.{0}.dll", tBoxVersion.Text));
                compilerParameters.ReferencedAssemblies.Add(string.Format("DevExpress.XtraReports.{0}.dll", tBoxVersion.Text));
                compilerParameters.ReferencedAssemblies.Add(string.Format("DevExpress.XtraScheduler.{0}.Core.dll", tBoxVersion.Text));
                compilerParameters.ReferencedAssemblies.Add(string.Format("DevExpress.XtraScheduler.{0}.Extensions.dll", tBoxVersion.Text));
                compilerParameters.ReferencedAssemblies.Add(string.Format("DevExpress.XtraSpellChecker.{0}.dll", tBoxVersion.Text));
                compilerParameters.ReferencedAssemblies.Add(string.Format("DevExpress.XtraTreeList.{0}.dll", tBoxVersion.Text));
                compilerParameters.ReferencedAssemblies.Add(string.Format("DevExpress.XtraVerticalGrid.{0}.dll", tBoxVersion.Text));
                compilerParameters.ReferencedAssemblies.Add(string.Format("DevExpress.XtraWizard.{0}.dll", tBoxVersion.Text));
                CompilerResults cr = csc.CompileAssemblyFromFile(compilerParameters, "LocalizerCN.cs", "AssemblyInfo.cs");
                if (cr.Errors.HasErrors)
                {
                    var sb = new StringBuilder();
                    foreach (CompilerError ce in cr.Errors)
                    {
                        sb.Append(ce.ToString());
                        sb.Append(Environment.NewLine);
                    }
                    tBoxResult.Text = sb.ToString();
                }
                else
                {
                    var sb = new StringBuilder();
                    foreach (string ce in cr.Output)
                    {
                        sb.Append(ce);
                        sb.Append(Environment.NewLine);
                    }
                    tBoxResult.Text = sb.ToString();
                }
                tBoxResult.Text += "编译完成!";
            }

            private void btnExit_Click(object sender, EventArgs e)
            {
                Close();
            }

        }
    }

          /Files/spymaster/DevExpress.Utils.Localization.v10.2.rar

                

  • 相关阅读:
    百度地图API
    h5地理位置API
    css3的clip-path属性
    css3的3d属性集合
    模块化之SeaJS(二)
    模块化之SeaJS(一)
    html5制作一个时钟
    闭包论
    UVALive 7066 Intersection(圆环相交面积)
    UVALive 7068 K.Bro Sorting(树状数组求逆序对)
  • 原文地址:https://www.cnblogs.com/spymaster/p/1952380.html
Copyright © 2011-2022 走看看