0

Does anyone know if its possible to do NLS to some SWT Widgets in SWT\RCP application?

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.

Does anyone knows if this could be done also to SWT which is part of plugin 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..

icrovett
  • 435
  • 7
  • 21
To Kra
  • 3,344
  • 3
  • 38
  • 45
  • 1
    Yes, but be careful here - I think that `FileDialog` will raise your system's file picker dialog and thus would be localized based on your operating system's language? – Edward Thomson Apr 11 '13 at 14:24

2 Answers2

1

I don't think that you have a chance to internationalize the text of the buttons of org.eclipse.swt.widgets.FileDialog.

SWT is using the system file dialog here. For me with a german win32 system the text is in german. This indicates that the button texts are also system dependent.

enter image description here

PS:
SWT is not part of the plugin org.eclipse.ui. FileDialog is part of the plugin org.eclipse.swt.<ws>.<os>.<arch>_<version>.jar

where:

  • ws - window system: gtk, win32, etc.
  • os - operating system: win32, linux, solaris etc.
  • arch - architecture: x86, x86_64
  • version - version id (something like 3.100.1.v4234e)
jens-na
  • 2,254
  • 1
  • 17
  • 22
  • Did you find a solution in the end? The correct keys to use in SWTMessages language file for a FileDialog? – mb3_48900 Nov 27 '19 at 16:30
1

Most of the parts in org.eclipse.swt can be localized. 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. 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. Just create a fragment (e.g. org.eclipse.swt.nls), where host would be org.eclipse.swt. Create a package 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.

Then you can create localized SWTMessages_<lang>.properties files (where <lang> is the language abbreviation: e.g. sk, de, fr).

Stybi
  • 41
  • 6