Exemplo n.º 1
0
        public string Get(string key, Languages language)
        {
            const string cacheKey = "lang_local";


            LanguagePackage localLang = CacheFactory.Sington.GetResult <LanguagePackage>(
                cacheKey,
                () =>
            {
                LanguagePackage lang = new LanguagePackage();

                try
                {
                    string myLang = ResourceMap.XmlMyLangPackage;
                    if (myLang != null)
                    {
                        lang.LoadFromXml(myLang);
                    }
                }
                catch
                {
                    throw new FileLoadException(String.Format(
                                                    "本地语言包无法识别!请参考:http://{0}/framework/local/lang_package.xml修改.",
                                                    Settings.SERVER_STATIC));
                }

                CacheFactory.Sington.Insert(cacheKey, lang, String.Concat(Cms.PyhicPath + "framework/local/lang_package.xml"));

                return(lang);
            }

                );

            return(localLang.GetOtherLangItemValue(key, language));
        }
Exemplo n.º 2
0
        internal CmsLanguagePackage()
        {
            _lang = new LanguagePackage();
            _lang.LoadFromXml(ResourceMap.XmlLangPackage);
            // 加载系统内置的
            //LoadLocaleXml(Cms.PyhicPath + CmsVariables.FRAMEWORK_PATH + "locale");
            // 加载自定义的配置
            // LoadLocaleXml(Cms.PyhicPath + CmsVariables.SITE_CONF_PATH + "locale");

            //加载JSON格式语言
            LoadFromFile(Cms.PyhicPath + CmsVariables.FRAMEWORK_ASSETS_PATH + "locale/locale.db");
            LoadFromFile(Cms.PyhicPath + CmsVariables.SITE_LOCALE_PATH);


            /*
             * IDictionary<Languages,String> dict = new Dictionary<Languages,String>();
             *
             * //标签
             * dict.Add(Languages.Zh_CN,"无标签");
             * dict.Add(Languages.Zh_TW,"无标签");
             * dict.Add(Languages.En_US,"no tags");
             *
             * lang.Add(LanguagePackageKey.PAGE_NO_TAGS, dict);
             *
             * dict.Clear();
             * const string zh_cn_pack = "上一页|下一页|{0}|选择页码:{0}页";
             * const string zh_tw_pack = "上一頁|下一頁|{0}|選擇頁碼:{0}頁";
             * const string en_us_pack = "Previous|Next|{0}|Select Page:{0}";
             *
             *
             * dict.Add(Languages.Zh_CN, "上一页");
             */
        }
Exemplo n.º 3
0
        static CmsLanguagePackage()
        {
            lang = new LanguagePackage();

            lang.LoadFromXml(ResourceMap.XmlLangPackage);



            /*
             * IDictionary<Languages,String> dict = new Dictionary<Languages,String>();
             *
             * //标签
             * dict.Add(Languages.Zh_CN,"无标签");
             * dict.Add(Languages.Zh_TW,"无标签");
             * dict.Add(Languages.En_US,"no tags");
             *
             * lang.Add(LanguagePackageKey.PAGE_NO_TAGS, dict);
             *
             * dict.Clear();
             * const string zh_cn_pack = "上一页|下一页|{0}|选择页码:{0}页";
             * const string zh_tw_pack = "上一頁|下一頁|{0}|選擇頁碼:{0}頁";
             * const string en_us_pack = "Previous|Next|{0}|Select Page:{0}";
             *
             *
             * dict.Add(Languages.Zh_CN, "上一页");
             */
        }
Exemplo n.º 4
0
 public frmLogin(Configuration appConfig)
 {
     // TODO: Complete member initialization
     applicationConfiguration = (AppConfig)appConfig;
     this.languagePackage     = appConfig.getLanguagePackage();
     InitializeComponent();
 }
Exemplo n.º 5
0
        private void forceCustomReInitialize()
        {
            LanguagePackage langPack = applicationConfiguration.getLanguagePackage();

            //this.btnAdd.Text = langPack.getAddMembersButtonLabel();
            //this.btnAttendance.Text = langPack.getMakingRollCallButtonLabel();
            //this.fileToolStripMenuItem.Text = langPack.getMainFormMenuFileLabel();
            //this.listToolStripMenuItem1.Text = langPack.getMainFormMenuFileMemberListLabel();
            //this.quitToolStripMenuItem.Text = langPack.getQuitButtonTitle();
            //this.operationToolStripMenuItem.Text = langPack.getMainFormMenuOperationLabel();
            //this.checkInToolStripMenuItem.Text = langPack.getMakingRollCallButtonLabel();
            //this.listToolStripMenuItem.Text = langPack.getAddMembersButtonLabel();
            //this.helpToolStripMenuItem.Text = langPack.getMainFormMenuHelpLabel();
            //this.aboutToolStripMenuItem.Text = langPack.getMainFormMenuAboutLabel();
            //this.toolStripStatusLabel2.Text = "";
            //this.deleteMemberToolStripMenuItem.Text = langPack.getDeleteMembersButtonLabel();
            this.Text = langPack.getMainFormTitle();
        }
Exemplo n.º 6
0
        private void forceCustomReInitialize()
        {
            LanguagePackage langPack = applicationConfiguration.getLanguagePackage();


            this.label1.Text = langPack.getLastNameAlias();
            this.label2.Text = langPack.getFirstNameAlias();
            this.label3.Text = langPack.getMemberCodeAlias();
            this.label4.Text = langPack.getClassAlias();
            this.label5.Text = langPack.getSexAlias();
            this.label6.Text = langPack.getBirthAlias();

            //this.btnAddNewEmployee.Text = langPack.getAddMembersButtonLabel();
            //this.btnExit.Text = langPack.getQuitButtonTitle();
            //this.btnReset.Text = langPack.getResetButtonTitle();

            this.Text = langPack.getAddMemberFormTitle();
            this.cbGioitinh.Items.Clear();
            this.cbGioitinh.Items.AddRange(new object[] {
                langPack.getMaleAlias(),
                langPack.getFemaleAlias()
            });
        }
Exemplo n.º 7
0
        private void forceCustomReInitialize()
        {
            LanguagePackage langPack = applicationConfiguration.getLanguagePackage();

            //
            this.btnAddNewEmployee.Text = langPack.getAddMembersButtonLabel();
            this.btnexit.Text           = langPack.getQuitButtonTitle();
            this.btnCallTheRoll.Text    = langPack.getMakingRollCallButtonLabel();
            this.btnCamera.Text         = langPack.getCameraActionButtonLabel();

            /* this.groupBox1.Text = langPack.getMemeberInfoBlockTitle();
             * this.label6.Text = langPack.getBirthAlias();
             * this.label5.Text = langPack.getSexAlias();
             * this.label4.Text = langPack.getClassAlias();
             * this.label3.Text = langPack.getFirstNameAlias();
             * this.label8.Text = langPack.getMemberCodeAlias();
             * this.label9.Text = langPack.getLastNameAlias();*/
            this.label2.Text = langPack.getMembersAlreadyMakingRollCallTitle();
            this.label7.Text = langPack.getMembersNotMakingRollCallYetTitle();

            /*this.label1.Text = langPack.getClassAlias();
             * this.label10.Text = langPack.getOutputDeviceSelectionTitle();*/
            this.Text = langPack.getMakingRollCallFormTitle();
        }
Exemplo n.º 8
0
        public MainWindow()
        {
            InitializeComponent();
            try
            {
                LeanCloudInteraction.LeanCloudInteraction.Initialize();
            }catch
            {
                System.Windows.Forms.MessageBox.Show("Can not reach the server.");
            }

            Loger.Log("Wowse Started.");

            try
            {
                langPackage = new LanguagePackage(AppDomain.CurrentDomain.BaseDirectory + @"locale", @"zh-CN");
            }
            catch (Exception ex)
            {
                Loger.Log("Can't load language package. Detail: " + ex.ToString());
                System.Windows.Forms.MessageBox.Show("Can't load language package.");
                Environment.Exit(0);
            }

            //mNavigationBox.AddItem(new NavigationItem() { Text = langPackage[LanguageSign.Home], BackColor = Colors.Black, TextColor = Colors.White, BackColorOpacity = 0 });
            mNavigationBox.AddItem(new NavigationItem()
            {
                Text = langPackage[LanguageSign.InstallPlugin], BackColor = Colors.Black, TextColor = Colors.White, BackColorOpacity = 0
            });
            mNavigationBox.AddItem(new NavigationItem()
            {
                Text = langPackage[LanguageSign.InstalledPlugin], BackColor = Colors.Black, TextColor = Colors.White, BackColorOpacity = 0
            });
            mNavigationBox.AddItem(new NavigationItem()
            {
                Text = langPackage[LanguageSign.GameSettings], BackColor = Colors.Black, TextColor = Colors.White, BackColorOpacity = 0
            });
            mNavigationBox.AddItem(new NavigationItem()
            {
                Text = langPackage[LanguageSign.Settings], BackColor = Colors.Black, TextColor = Colors.White, BackColorOpacity = 0
            });
            mNavigationBox.AddItem(new NavigationItem()
            {
                Text = langPackage[LanguageSign.Account], BackColor = Colors.Black, TextColor = Colors.White, BackColorOpacity = 0
            });

            gameLanchBtn.Content = langPackage[LanguageSign.LanchGame];
            userName.Text        = langPackage[LanguageSign.SignIn];

            try
            {
                IMG_PATHES = Event.SaveEventImages_China().ToArray();

                Loger.Log("Event image count: " + IMG_PATHES.Length);

                //RecordQuerier rq = new RecordQuerier("QwQ_11", true);
                //rq.LoadRecord();
                //new RecordQuery().Show();

                if (IMG_PATHES.Length != 0 && File.Exists(IMG_PATHES[ImgIndex]))
                {
                    blur.Background = new ImageBrush(new BitmapImage(new Uri(IMG_PATHES[ImgIndex])));
                    ImgIndex        = ImgIndex == IMG_PATHES.Length - 1 ? 0 : ImgIndex++;
                }

                var timer = new Timer();
                timer.Interval = 10000;
                timer.Elapsed += (sender, e) =>
                {
                    this.Dispatcher.Invoke(() =>
                    {
                        if (IMG_PATHES.Length != 0)
                        {
                            while (true)
                            {
                                if (File.Exists(IMG_PATHES[ImgIndex]))
                                {
                                    blur.Background = new ImageBrush(new BitmapImage(new Uri(IMG_PATHES[ImgIndex])));
                                    ImgIndex        = ImgIndex == IMG_PATHES.Length - 1 ? 0 : ImgIndex + 1;
                                    break;
                                }
                                if (ImgIndex == IMG_PATHES.Length - 1)
                                {
                                    ImgIndex = 0;
                                    break;
                                }
                                else
                                {
                                    ImgIndex++;
                                }
                            }
                        }
                    });
                };
                timer.Start();
            } catch { }
        }
Exemplo n.º 9
0
 public static void RegisterPackage(LanguagePackage package)
 {
     _packages.Add(package);
 }
Exemplo n.º 10
0
 /// <summary>
 /// 释放语言包
 /// </summary>
 public static bool Disposable(LanguagePackage package)
 {
     if (Langs.ContainsKey(package.CultureInfo))
     {
         return Langs[package.CultureInfo].Remove(package);
     }
     else
     {
         return false;
     }
 }