• <bdo id='pqUJp'></bdo><ul id='pqUJp'></ul>
    <legend id='pqUJp'><style id='pqUJp'><dir id='pqUJp'><q id='pqUJp'></q></dir></style></legend>
  • <tfoot id='pqUJp'></tfoot>

        <i id='pqUJp'><tr id='pqUJp'><dt id='pqUJp'><q id='pqUJp'><span id='pqUJp'><b id='pqUJp'><form id='pqUJp'><ins id='pqUJp'></ins><ul id='pqUJp'></ul><sub id='pqUJp'></sub></form><legend id='pqUJp'></legend><bdo id='pqUJp'><pre id='pqUJp'><center id='pqUJp'></center></pre></bdo></b><th id='pqUJp'></th></span></q></dt></tr></i><div id='pqUJp'><tfoot id='pqUJp'></tfoot><dl id='pqUJp'><fieldset id='pqUJp'></fieldset></dl></div>
      1. <small id='pqUJp'></small><noframes id='pqUJp'>

        WinForms 中是否有本地化常用文本的存储库?

        时间:2023-08-25

        1. <small id='nCdC5'></small><noframes id='nCdC5'>

          <tfoot id='nCdC5'></tfoot>
              <tbody id='nCdC5'></tbody>
              <bdo id='nCdC5'></bdo><ul id='nCdC5'></ul>
              • <i id='nCdC5'><tr id='nCdC5'><dt id='nCdC5'><q id='nCdC5'><span id='nCdC5'><b id='nCdC5'><form id='nCdC5'><ins id='nCdC5'></ins><ul id='nCdC5'></ul><sub id='nCdC5'></sub></form><legend id='nCdC5'></legend><bdo id='nCdC5'><pre id='nCdC5'><center id='nCdC5'></center></pre></bdo></b><th id='nCdC5'></th></span></q></dt></tr></i><div id='nCdC5'><tfoot id='nCdC5'></tfoot><dl id='nCdC5'><fieldset id='nCdC5'></fieldset></dl></div>

                1. <legend id='nCdC5'><style id='nCdC5'><dir id='nCdC5'><q id='nCdC5'></q></dir></style></legend>
                  本文介绍了WinForms 中是否有本地化常用文本的存储库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在全球化一个 Windows 表单应用程序.

                  I'm globalizing a Windows form application.

                  有没有办法以 Windows 的当前语言访问常用文本?

                  Is there a way to access common text in the current language for Windows?

                  例如对于OK、Cancel和Accept按钮的标签;如果我正在构建一个带有 OK 按钮的表单,我想使用 Windows 在其他地方为 OK 按钮使用的相同翻译.

                  For example, for the labels of OK, Cancel and Accept buttons; if I'm building a form that has an OK button I would like to use the same translation that Windows uses everywhere else for OK buttons.

                  我知道我可以自己存储翻译,但 Windows 必须将它们存储在某个地方,它们是否允许开发人员访问它们?

                  I know I can store the translation for them myself, but Windows has to have them stored somewhere, do they give developers access to them?

                  推荐答案

                  是的,理论上你可以从 Windows 的内部系统文件中提取本地化字符串.但不要这样做.可能的缺点远远超过了优点.您的应用程序不应依赖于未记录的实现细节.没有理由尝试从 Windows 获取它.

                  Yes, theoretically you could extract localized strings from Windows's internal system files. But don't do it. The advantages are far outweighed by the possible disadvantages. Your application shouldn't be reliant on undocumented implementation details. There's no reason to try and get this from Windows.

                  还值得指出的是,您可以重命名按钮(以及所有其他控件).这意味着如果您依赖某种字符串匹配算法,那么很容易破坏某些东西.没有办法将按钮标记为某种类型",以便它自动与特定标题关联,即使您可以,这也不会涵盖非-琐碎的用户界面.此外,正如 Joey 的回答所指出的,对于用户而言,没有什么比 部分 本地化的 UI 更糟糕的了.一致性是关键,您无法通过这种方式本地化标签、分组框、菜单、工具提示等.

                  It's also worth pointing out that you can rename buttons (and every other control). That means it's too easy to break something if you're relying on some kind of string matching algorithm. There's no way to mark a button as being a certain "type" so that it will be automatically associated with a particular caption, and even if you could, this wouldn't cover every button present in a non-trivial UI. Also, as Joey's answer points out, there's nothing worse for the user than a partially localized UI. Consistency is the key, and you can't localize labels, group boxes, menus, tooltips, etc. this way.

                  但请注意,Windows会自动本地化消息框上按钮的标题(MessageBox).您不必抬起一根手指.

                  Note, however, that Windows will automatically localize the captions for buttons on a message box (MessageBox). You don't have to lift a finger.

                  将表单的 Localizable 属性设置为 True(您必须在设计时这样做)并为应用程序中的所有控件提供本地化文本有什么问题?Windows 窗体实际上对本地化提供了相当全面的支持;设计器会自动将所有可本地化的元素序列化到表单的 RESX 文件中.请参阅 MSDN:演练:本地化 Windows 窗体.确保留出足够的空间以允许不同语言中不同长度的表达式.

                  What's wrong with setting the form's Localizable property to True (you must do this at design time) and providing localized text for all of the controls in your application? Windows Forms actually has pretty comprehensive support for localization; the designer will automatically serialize all localizable elements to the form's RESX file. See MSDN: Walkthrough: Localizing Windows Forms. Make sure that you leave a sufficient amount of space to allow for the varying lengths of expressions in different languages.

                  这篇关于WinForms 中是否有本地化常用文本的存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:控制 LTR 和 RTL 语言之间的对齐切换 下一篇:为什么我的本地机器可能会错误地格式化国际日

                  相关文章

                  最新文章

                  <tfoot id='VH78z'></tfoot>
                    <bdo id='VH78z'></bdo><ul id='VH78z'></ul>
                    1. <legend id='VH78z'><style id='VH78z'><dir id='VH78z'><q id='VH78z'></q></dir></style></legend>

                      <small id='VH78z'></small><noframes id='VH78z'>

                    2. <i id='VH78z'><tr id='VH78z'><dt id='VH78z'><q id='VH78z'><span id='VH78z'><b id='VH78z'><form id='VH78z'><ins id='VH78z'></ins><ul id='VH78z'></ul><sub id='VH78z'></sub></form><legend id='VH78z'></legend><bdo id='VH78z'><pre id='VH78z'><center id='VH78z'></center></pre></bdo></b><th id='VH78z'></th></span></q></dt></tr></i><div id='VH78z'><tfoot id='VH78z'></tfoot><dl id='VH78z'><fieldset id='VH78z'></fieldset></dl></div>