Java – eclipse RCP internationalization independent plug-in

No tutorial provides specific examples of how to create international plug - in fragments I need to translate to plugin XML and source code files Try to turn your head to the translation place and I18N facade

1. How does this fragment apply to multi plug-in enterprise applications? More importantly, how do all these plug-ins externalize their strings into the corresponding folders in the fragment?

2. How about external jars? How does the mechanism provide translation support for external resources?

3. Is it possible to provide independent opinions or opinion translation due to long-term risks? Not necessarily at runtime, because I know that bundles cannot switch dynamically

Solution

For some help, this article lists the process It is based on eclipse 2.0 (!), But the basic idea is still correct

>For each plug - in you need to translate, you will create a plug - in fragment This fragment is associated with a host plug-in, so you need multiple fragments Each fragment can contain multiple languages The language is separated by a folder structure, as described in step 5 in the first article > I guess you mean your own non eclipse Java jar, right? If so, it's a completely different process that's best suited for individual problems using java tags Oracle has a guide that may help But remember, you only need to translate what users touch Therefore, it may be a good idea to keep all user visible strings in the refactoring of the Eclipse Plug-in. > Do you mean the name of the view / perspective? If so, yes You can also translate plugin Information provided in XML See vogellas article, Chapter 3

Edit:

In Nr.3, I mean selecting the view to translate (for example, through the View menu), then restarting the application, and then only the view should be translated

Um I thought of a theoretically feasible method, but I'm not sure it's the best choice Therefore, translation is based on language environment And select a certain translation according to the regional settings If there is no appropriate translation, the default value will be selected

Therefore, if your view menu changes the locale of the application to "us-en-v1" and you have only one view with a translation of the locale "us-en-v1", this means that a specific view will be translated, but the rest of the application will use the default values (they may return to the closest translation by default, I don't remember exactly)

Then, for each view, you will create a new translation and use a unique locale for each view

This should work, but it will abuse the way translation works, so it may cause problems

I have done similar things. An application uses the same language, but different customers have different words Therefore, we use I18N to make the application use the correct terminology by defining our own locale

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>