本地化问题.以前工作的默认语言环境“英语"不适用于“西班牙语" [英] localization question. previously working default locale 'english' doesn't work with 'spanish'

查看:74
本文介绍了本地化问题.以前工作的默认语言环境“英语"不适用于“西班牙语"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我意识到这更多是Windows窗体问题,但我认为其他不使用winforms的人也可能知道如何解决我的问题.
我不加思索地更改了本地化的默认英语"代码对其他语言的影响. (西班牙语/中文)
根据状态,我有一个按钮是开始"或停止".
我无法弄清楚为什么非英语默认语言无法正常工作. ??
这是我的代码,希望可以说明问题.谢谢您的任何想法.

I realize this is more of a windows form question but I think others who don't do winforms may also know how to solve my problem.
I changed my localized default 'English' code without thinking of implications for other languages. (spanish/chinese)
I have one button that depending on state, is either "Start" or "Stop".
I couldn't figure out why the non english-default languages weren't working.  ??
Here is my code for this that hopefully illustrates the problem.  Thank you for any ideas.

private void button_Click(object sender, EventArgs e)
{
   switch (button.Text)
   {
      case "Connect":  //in the Spanish language resource file, button.text = "Iniciar" so this doesn't work.
        break;

      case "Stop":
        break;
   }
}

推荐答案


如果仅在一种表单上使用此按钮,则该表单可能具有一个类级别变量,该变量将标记存储为到按钮状态.
如果需要在多种表单上使用它,则可以创建一个自定义按钮,以扩展标准按钮类并向其添加state属性以跟踪按钮状态.

If this button is only used on one form, then the form could have a class level variable which stores a flag as to the buttons state.
If you need it on multiple forms you could create a custom button extend the standard button class and add a state property to it to keep track of the buttons state.


这篇关于本地化问题.以前工作的默认语言环境“英语"不适用于“西班牙语"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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