public void OnSelectedLangChanged() { try { System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(SelectedLang.Lv); LanguagePack = "/Images/" + SelectedLang.Lv + "/"; string AsmName = Assembly.GetExecutingAssembly().GetName().Name; Assembly Asm = Assembly.Load(AsmName); ResourceManager rm = new ResourceManager(AsmName + ".Localization.Resource", Asm); //국가별 폰트 변경 var rDictionary = new ResourceDictionary(); if (SelectedLang.Lv.Equals("ru-RU")) { rDictionary.Source = new Uri(string.Format("/coinBlock;component/FontStyle/FontStyle.{0}.xaml", SelectedLang.Lv), UriKind.Relative); } else { rDictionary.Source = new Uri(string.Format("/coinBlock;component/FontStyle/FontStyle.xaml", string.Empty), UriKind.Relative); } Application.Current.Resources.MergedDictionaries[0] = rDictionary; Email = LocalizationLib.GetLocalizaionString("Login_27"); PassWord = LocalizationLib.GetLocalizaionString("Login_28"); LoginTitle = LocalizationLib.GetLocalizaionString("Login_1"); SaveID = LocalizationLib.GetLocalizaionString("Login_2"); } catch (Exception ex) { SysLog.Error("Message[{0}], StackTrace[{1}]", ex.Message, ex.StackTrace); } }
public void TranslateBasic() { var localizationConfiguration = new LocalizationConfiguration { BasePath = "Localization", DefaultCulture = new CultureInfo("cs"), SupportedCultures = new List <CultureInfo> { new CultureInfo("en"), new CultureInfo("es"), new CultureInfo("cs"), }, TranslateFallbackMode = LocTranslateFallbackMode.Key, AutoLoadResources = true }; var instance = new LocalizationLib(localizationConfiguration); //Localization.Init("localization.json.config"); var ls = instance.Translate(LocTranslationSource.File, null, null, "text-2-odst"); Assert.AreEqual("text-2-odst", ls.Name); Assert.IsFalse(ls.ResourceNotFound); Assert.AreEqual("Druhý odstavec v globálním slovníku", ls.Value); var lsQQ = instance.Translate(LocTranslationSource.File, null, null, "text-QQ-odst"); Assert.AreEqual("text-QQ-odst", lsQQ); var lsEn = instance.Translate(LocTranslationSource.File, new CultureInfo("en"), null, "text-2-odst"); Assert.AreEqual("text-2-odst", lsEn.Name); Assert.AreEqual("The second paragraph in global dictionary", lsEn.Value); }
public void AutoOffInitTest() { var localizationConfiguration = new LocalizationConfiguration { BasePath = "Localization", DefaultCulture = new CultureInfo("cs"), SupportedCultures = new List <CultureInfo> { new CultureInfo("en"), new CultureInfo("es"), new CultureInfo("hu"), new CultureInfo("zh"), new CultureInfo("cs"), }, TranslateFallbackMode = LocTranslateFallbackMode.Key, FirstAutoTranslateResource = LocLocalizationResource.File, AutoLoadResources = false }; var instance = new LocalizationLib(localizationConfiguration); var resA = instance.Translate(LocTranslationSource.Auto, null, null, "ahoj"); Assert.IsTrue(resA.ResourceNotFound); }
public KeyboardShortcuts() { InitializeComponent(); // Load localization strings LocalizationLib.SetLanguageResourceDictionary(this); }
public About() { InitializeComponent(); // Load localization strings LocalizationLib.SetLanguageResourceDictionary(this); }
public async void GetCmmcCode(string Code) { try { using (RequestCertSelectCodeModel req = new RequestCertSelectCodeModel()) { req.cmmUpperCd = Code; using (ResponseCertSelectCodeModel res = await WebApiLib.AsyncCall <ResponseCertSelectCodeModel, RequestCertSelectCodeModel>(req)) { if (res.resultStrCode == "000") { if (string.IsNullOrWhiteSpace(Code)) { ParentCode = new ObservableCollection <ComboBoxStrData>(); foreach (ResponseCertSelectCodeListModel item in res.data.list) { ParentCode.Add(new ComboBoxStrData { Name = LocalizationLib.GetLocalizaionString("CertificationDataSubmit_" + item.cmmCd), Value = item.cmmCd }); } if (ParentCode.Count > 0) { SelParent = ParentCode[0]; } } else { ChildCode = new ObservableCollection <ComboBoxStrData>(); ChildCode.Add(new ComboBoxStrData { Name = Localization.Resource.Common_Alert_16, Value = "00" }); foreach (ResponseCertSelectCodeListModel item in res.data.list) { ChildCode.Add(new ComboBoxStrData { Name = LocalizationLib.GetLocalizaionString("CertificationDataSubmit_" + item.cmmCd), Value = item.cmmCd }); } if (ChildCode.Count > 0) { SelChild = ChildCode[0]; } } } } } } catch (Exception ex) { SysLog.Error("Message[{0}], StackTrace[{1}]", ex.Message, ex.StackTrace); } }
public void CmdPageMove() { try { Messenger.Default.Send(new MenuModel() { Name = LocalizationLib.GetLocalizaionString("Main_Menu_5_7"), Id = "CertificationDataSubmitHelpDesk", IconPath = "/Images/ico_nav_cert_doc.png" }); } catch (Exception ex) { SysLog.Error("Message[{0}], StackTrace[{1}]", ex.Message, ex.StackTrace); } }
public void CmdGoCertifyPage() { try { Messenger.Default.Send(new MenuModel() { Name = LocalizationLib.GetLocalizaionString("Main_Menu_6_2"), Id = "CertifyMyPage", IconPath = "/Images/ico_nav_cert_center.png" }); } catch (Exception ex) { SysLog.Error("Message[{0}], StackTrace[{1}]", ex.Message, ex.StackTrace); } }
//메뉴이동 public void CmdMoveMenu() { try { Messenger.Default.Send(new MenuModel() { Name = LocalizationLib.GetLocalizaionString("Main_Menu_2_5"), Id = "CoinExchangeReservationTrading", IconPath = "/Images/ico_nav_coin_chage_auto.png", Certify = 1 }); WindowService.Close(); } catch (Exception ex) { SysLog.Error("Message[{0}], StackTrace[{1}]", ex.Message, ex.StackTrace); } }
/// <summary> /// Main window constructor /// </summary> public MainWindow() { // Window initialization InitializeComponent(); // Load localization strings LocalizationLib.SetLanguageResourceDictionary(this); // Adds the data context viewModel = new ViewModel(SnackbarAdd); this.DataContext = viewModel; // Notify icon try { System.Windows.Forms.ContextMenu NotifyMenu = new System.Windows.Forms.ContextMenu(); System.Windows.Forms.MenuItem NotifyMenu_Show = new System.Windows.Forms.MenuItem(); System.Windows.Forms.MenuItem NotifyMenu_Quit = new System.Windows.Forms.MenuItem(); NotifyMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { NotifyMenu_Show }); NotifyMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { NotifyMenu_Quit }); NotifyMenu_Show.Index = 0; NotifyMenu_Show.Text = (string)FindResource("Show"); NotifyMenu_Show.Click += new EventHandler(this.ShowApp); NotifyMenu_Quit.Index = 1; NotifyMenu_Quit.Text = (string)FindResource("Quit"); NotifyMenu_Quit.Click += new EventHandler(this.QuitApp); Notify.Icon = Properties.Resources.notificon; Notify.ContextMenu = NotifyMenu; Notify.DoubleClick += new EventHandler(this.ShowApp); Notify.Text = (string)FindResource("WindowTitle"); Notify.Visible = true; } catch { } // Application autostart string[] args = Environment.GetCommandLineArgs(); foreach (string arg in args) { if (arg.ToLower() == "-autostart") { this.Hide(); } } }
private void uiFlipView_MouseDown(object sender, MouseButtonEventArgs e) { try { Messenger.Default.Send(new MenuModel() { Name = LocalizationLib.GetLocalizaionString("Main_Menu_5_1"), Id = "NoticeHelpDesk", IconPath = "/Images/ico_nav_notice.png" }); this.DialogResult = true; this.Close(); } catch (Exception ex) { SysLog.Error("Message[{0}], StackTrace[{1}]", ex.Message, ex.StackTrace); } }
public void CmdMyPageMove(string val) { try { //if (val.Equals(StringEnum.GetStringValue(EnumLib.PushCode.Price)) || val.Equals(StringEnum.GetStringValue(EnumLib.PushCode.Time))) //금액별, 시간대별 //{ // Messenger.Default.Send(new MenuModel() {Name = LocalizationLib.GetLocalizaionString(item.CoinCode), Id = "CoinTrading", IconPath = "/Images/ico_nav_" + item.CoinName + ".png", Param = item,Certify = 1 }); // Messenger.Default.Send(new MenuModel() { Name = LocalizationLib.GetLocalizaionString("Main_Menu_2_1"), Id = "CoinTrading", IconPath = "/Images/ico_nav_btc.png", Param = EnumLib.ExchangeCurrencyCode.BTC, Certify = 1 }); //} //else if (val.Equals(StringEnum.GetStringValue(EnumLib.PushCode.Question))) // 1:1문의 { Messenger.Default.Send(new MenuModel() { Name = LocalizationLib.GetLocalizaionString("Main_Menu_5_3"), Id = "QnaHelpDesk", IconPath = "/Images/ico_nav_qna.png" }); } else if (val.Equals(StringEnum.GetStringValue(EnumLib.PushCode.Addition)) || val.Equals(StringEnum.GetStringValue(EnumLib.PushCode.DepositDrawWith)) || val.Equals(StringEnum.GetStringValue(EnumLib.PushCode.BuySell))) //부가서비스, 입출금, 구매/판매 { Messenger.Default.Send(new MenuModel() { Name = LocalizationLib.GetLocalizaionString("Main_Menu_6_5"), Id = "TradingHistoryMyPage", IconPath = "/Images/ico_nav_exchage_list.png" }); } else if (val.Equals(StringEnum.GetStringValue(EnumLib.PushCode.Notice))) //공지사항 { Messenger.Default.Send(new MenuModel() { Name = LocalizationLib.GetLocalizaionString("Main_Menu_5_1"), Id = "NoticeHelpDesk", IconPath = "/Images/ico_nav_notice.png" }); } else if (val.Equals(StringEnum.GetStringValue(EnumLib.PushCode.Login))) // 로그인 { Messenger.Default.Send(new MenuModel() { Name = LocalizationLib.GetLocalizaionString("Main_Menu_6_3"), Id = "LoginHistoryMyPage", IconPath = "/Images/ico_nav_connect_info.png" }); } } catch (Exception ex) { SysLog.Error("Message[{0}], StackTrace[{1}]", ex.Message, ex.StackTrace); } }
public void InitLibTest() { var localizationConfiguration = new LocalizationConfiguration { BasePath = "Localization", DefaultCulture = new CultureInfo("cs"), SupportedCultures = new List <CultureInfo> { new CultureInfo("en"), new CultureInfo("es"), new CultureInfo("cs"), } }; var instance = new LocalizationLib(localizationConfiguration); Assert.IsNotNull(instance); }
/// <summary> /// Main window constructor /// </summary> public MainWindow() { InitializeComponent(); // Load localization strings LocalizationLib.SetLanguageResourceDictionary(this); // Adds the data context viewModel = new ViewModel(); this.DataContext = viewModel; // Loads user settings Options.LoadOnStartup(viewModel); // Keys events KListener.KeyDown += new RawKeyEventHandler(KListener_KeyDown); KListener.KeyUp += new RawKeyEventHandler(KListener_KeyUp); }
/// <summary> /// 실시간 코인 시세에서 구매/판매 클릭시 해당 페이지 호출(View 에서 사용 TradePageCallCommand) /// </summary> /// <param name="menuId"></param>1 public void TradePageCall(string menuId) { try { foreach (ResponseCoinListModel item in MainViewModel.CoinData.list) { if (item.CoinName.Equals(menuId)) { Messenger.Default.Send(new MenuModel() { Name = LocalizationLib.GetLocalizaionString(item.CoinCode), Id = "CoinTrading", IconPath = "/Images/ico_nav_" + item.CoinName + ".png", Param = item, Certify = 1 }); } } } catch (Exception ex) { SysLog.Error("Message[{0}], StackTrace[{1}]", ex.Message, ex.StackTrace); } }
public void PerformanceTest() { var localizationConfiguration = new LocalizationConfiguration { BasePath = "Localization", DefaultCulture = new CultureInfo("cs"), SupportedCultures = new List <CultureInfo> { new CultureInfo("en"), new CultureInfo("es"), new CultureInfo("hu"), new CultureInfo("zh"), new CultureInfo("cs"), }, TranslateFallbackMode = LocTranslateFallbackMode.Key, AutoLoadResources = true }; var instance = new LocalizationLib(localizationConfiguration); var sw = new Stopwatch(); sw.Start(); for (var i = 0; i < 1000; i++) { for (var j = 0; j < 50; j++) { var ls = instance.Translate(LocTranslationSource.File, null, null, "text-2-odst"); var lsQQ = instance.Translate(LocTranslationSource.File, null, null, "text-qq-odst"); var lsEn = instance.Translate(LocTranslationSource.File, new CultureInfo("en"), null, "text-2-odst"); var ls2 = instance.Translate(LocTranslationSource.File, null, null, "text-1-odst"); var ls2QQ = instance.Translate(LocTranslationSource.File, null, null, "q"); var ls2En = instance.Translate(LocTranslationSource.File, new CultureInfo("en"), null, "text-5-odst"); } } sw.Stop(); Debug.WriteLine("300 000 translations in " + sw.ElapsedMilliseconds + " miliseconds"); }