简体   繁体   English

Eclipse RCP和SWT小部件和NLS

[英]Eclipse RCP & SWT Widgets & NLS

Does anyone know if its possible to do NLS to some SWT Widgets in SWT\\RCP application? 有谁知道它是否可以在SWT \\ RCP应用程序中对某些SWT小部件进行NLS?

remark: With JFace components its possible if you create own equinox fragment to plugin org.eclipse.jface , (contains messages.properties ), so let me say if I want to make Slovak NLS to JFace components I create messages_sk.properties in my fragment. 注意:如果您创建自己的equinox片段以插入org.eclipse.jface (包含messages.properties ),那么使用JFace组件是可能的,所以让我说如果我想将Slovak NLS设为JFace组件,我在片段中创建messages_sk.properties

Does anyone knows if this could be done also to SWT which is part of plugin org.eclipse.ui ? 有谁知道这是否也可以对SWT进行,这是插件org.eclipse.ui的一部分?

I am developing application which uses SWT FileDialog , which has default english buttons etc. I want to make them other language without making my own dialog, but changing NLS.. 我正在开发使用SWT FileDialog应用程序,它有默认的英文按钮等。我想让它们成为其他语言而不用我自己的对话框,但是改变NLS ..

I don't think that you have a chance to internationalize the text of the buttons of org.eclipse.swt.widgets.FileDialog . 我认为你没有机会国际化org.eclipse.swt.widgets.FileDialog按钮的文本。

SWT is using the system file dialog here. SWT正在此处使用系统文件对话框。 For me with a german win32 system the text is in german. 对于我使用德语win32系统,文本是德语。 This indicates that the button texts are also system dependent. 这表示按钮文本也与系统有关。

在此输入图像描述

PS: PS:
SWT is not part of the plugin org.eclipse.ui . SWT不是插件org.eclipse.ui一部分。 FileDialog is part of the plugin org.eclipse.swt.<ws>.<os>.<arch>_<version>.jar FileDialog是插件org.eclipse.swt.<ws>.<os>.<arch>_<version>.jar

where: 哪里:

  • ws - window system: gtk , win32 , etc. ws - 窗口系统: gtkwin32
  • os - operating system: win32 , linux , solaris etc. os - 操作系统: win32linuxsolaris等。
  • arch - architecture: x86 , x86_64 arch - architecture: x86x86_64
  • version - version id (something like 3.100.1.v4234e ) 版本 - 版本ID(类似于3.100.1.v4234e

Most of the parts in org.eclipse.swt can be localized. org.eclipse.swt大多数部分都可以进行本地化。 I don't know about an option to localize FileDialog and similar "widgets", because the library calls directly some Win32 API (or similar API on other OSes) to create it. 我不知道本地化FileDialog和类似的“小部件”的选项,因为库直接调用一些Win32 API(或其他操作系统上的类似API)来创建它。 Therefore this part is highly OS dependent and wouldn't be portable if you change it somehow. 因此,这部分是高度依赖操作系统的,如果你以某种方式改变它将无法移植。

If you want to localize other parts of org.eclipse.swt , it's relatively simple. 如果你想本地化org.eclipse.swt其他部分,那就相对简单了。 Just create a fragment (eg org.eclipse.swt.nls ), where host would be org.eclipse.swt . 只需创建一个片段(例如org.eclipse.swt.nls ),其中host是org.eclipse.swt Create a package org.eclipse.swt.internal . 创建一个包org.eclipse.swt.internal

Than copy a file SWTMessages.properties from org.eclipse.swt.<ws>.<os>.<arch>_<version>.jar/org/eclipse/swt/internal to the new package and rename it to _SWTMessages.properties . 将文件SWTMessages.propertiesorg.eclipse.swt.<ws>.<os>.<arch>_<version>.jar/org/eclipse/swt/internal _SWTMessages.properties到新软件包并将其重命名为_SWTMessages.properties

Then you can create localized SWTMessages_<lang>.properties files (where <lang> is the language abbreviation: eg sk , de , fr ). 然后,您可以创建本地化的SWTMessages_<lang>.properties文件(其中<lang>是语言缩写:例如skdefr )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM