|
Re: Loading a non-properties files from a fragment into and editor [message #326103 is a reply to message #326093] |
Fri, 07 March 2008 10:23 |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
Lila,
What does the folder structure in your plugin for the translated
versions look like? Did you use the -nl flag to direct Eclipse to use a
different locale?
Lila wrote:
> I have a html file that is translated and its translated copies reside
> in my plugin fragment. I need to open it in an editor. The English
> version of the file is at the root of my plugin. Currently I am using
> this code to locat the file url, where relativePath is the file name:
>
> public URL getURLFromFragment(relativePath){
> Bundle bundle = Platform.getBundle(MY_PLUGIN_ID);
> try{
> IPath path = new Path("$nl$/"+relativePath);
> URL url = FileLocator.find(bundle, path, null);
> return url;
> }
> catch (Exception exc) {
> exc.printStackTrace(); return null;
> }
>
> }
> Then I instantiate my editor input class, a subclass of
> IPathEditorInput, with a Path object built from the url returned my
> method above like:
>
> myEditorInput editor = new myEditorInput(new
> Path(getURLFromFragment("myFileName")));
>
> This currently only opens the English version of the file! Anyone has
> any idea why? Do I need to read in the file as an inputStream and then
> somehow display it. I am thinking something must be wrong with how I
> am instantiating my editor input class.
>
> Any help is truly appreciated...
>
|
|
|
|
Re: Loading a non-properties files from a fragment into and editor [message #326117 is a reply to message #326109] |
Fri, 07 March 2008 13:30 |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
Lila,
You might need to specify your path as "nl/$NL$/myfile.html. I'm not
really exactly sure the specific naming conventions that are followed.
Have you tried stepping with the debugger through the lookup logic to
see where it all searches for the path you've provided?
Lila wrote:
> I actually put the translated files under a nl\local directory
> structure like this in the NL fragment plugin:
>
> nl\de\myfile.html
> nl\es\myfile.html
> nl\zh\hk\myfile.html
> .
> .
> .
>
>
> I know that you can place the files at the root of the fragment like
> myfile_zh_hk.html, myfile_de.html, etc.
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.06715 seconds