组合框selectedindex更改更改语言 [英] combobox selectedindex change change language

查看:75
本文介绍了组合框selectedindex更改更改语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好
我在主窗体上有组合框,其中有两个项,英语和塞尔维亚语,基本上,如果我选择了塞尔维亚语,则我在主窗体上的标签将一些英语单词更改为塞尔维亚语单词

这是代码

Hello
I have combobox on main form with two items in it, ENGLISH and SERBIAN, basically if I choose SERBIAN my labels on main form change some english words to serbian words

this is the code

private void cmbLanguage_SelectedIndexChanged(object sender, EventArgs e)
        {            
            if (cmbLanguage.SelectedIndex.Equals(1))
            {
                label1.Text = "INFO ALARM";
                label2.Text = "INFO ALARM";
                label3.Text = txtdatahistory.Text + "\n" + "OTVORENO\n" + Activity2BS.Count;
                label4.Text = txtstoragehistory.Text + "\n" + "OTVORENO\n" + Activity3BS.Count;
            }
            else
            {
                
            }
                
        }



如您所见,当我回到英语时,我想回到英语单词

像这样



now as you can see when I get back to english I want to return to english words

like this

label1.Text = "INFO WARNING";
                label2.Text = "INFO WARNING";
                label3.Text = txtdatahistory.Text + "\n" + "OPEN\n" + Activity2BS.Count;
                label4.Text = txtstoragehistory.Text + "\n" + "OPEN\n" + Activity3BS.Count;




但这不是,重点是这只是代码的一小部分,我真的不想键入该代码的aaaallll以返回ti english,如何在else语句中使其返回到先前的语言状态,因为在窗体加载时为english默认情况下,




but it doesnt, point is this is small part of the code and I really dont want to type aaaallll of that code to return ti english, how to make it on else statement to return back to previous state of language because on form load is english by default

推荐答案

这不是管理本地化和全球化的正确方法.尝试按此处所述设置本地化,然后您就不再需要手动进行此操作.

允许用户在ASP.NET Web中选择用户界面语言应用 [ ^ ]

这段文字也是不错的读物:

将软件交付给全球受众 [
Well this is not the right way of managing the localization and globalization. Try setting up the localisation as described here and then you will not need to manually take care about this things anymore.

Allow users to select the user interface language in your ASP.NET Web application[^]

also this text is a good reading:

Delivering Software to a Global Audience[^]

Cheers


这篇关于组合框selectedindex更改更改语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆