Statistics
| Revision:

svn-gvsig-desktop / tags / v1_1_Build_1013 / extensions / extGeoProcessing / src / com / iver / cit / gvsig / geoprocess / core / GeoprocessPluginAbstract.java @ 13521

History | View | Annotate | Download (1.37 KB)

1
package com.iver.cit.gvsig.geoprocess.core;
2

    
3
import java.io.File;
4
import java.net.MalformedURLException;
5
import java.net.URL;
6
import java.util.Locale;
7

    
8
import com.iver.andami.PluginServices;
9

    
10
public abstract class GeoprocessPluginAbstract implements IGeoprocessPlugin {
11

    
12
        public URL getHtmlDescription() {
13
                Locale locale = Locale.getDefault();
14
                String localeStr = locale.getLanguage();
15
//                String urlStr = "resources/description_" +
16
//                                                                                localeStr +
17
//                                                                                        ".html";
18
//
19

    
20
                String urlBase =
21
                        PluginServices.getPluginServices(this).getPluginDirectory() +
22
                        "/docs/"+ this.getClass().getName() +
23
                        "/description_%lang%.html";
24

    
25

    
26

    
27

    
28
                File htmlFile = new File(urlBase.replaceAll("%lang%", localeStr));
29
                if (!htmlFile.exists()){
30
                        // for languages used in Spain, fallback to Spanish if their translation is not available
31
                        if (localeStr.equals("ca")||localeStr.equals("gl")||localeStr.equals("eu")||localeStr.equals("va")) {
32
                                localeStr = "es";
33
                                htmlFile = new File(urlBase.replaceAll("%lang%", localeStr));
34

    
35
                                if (htmlFile.exists())
36
                                        try {
37
                                                return htmlFile.toURL();
38
                                        } catch (MalformedURLException e) {
39
                                                return null;
40
                                        }
41
                        }
42

    
43
                        localeStr = "en";
44
                        htmlFile = new File(urlBase.replaceAll("%lang%", localeStr));
45
                }
46
                try {
47
                        return htmlFile.toURL();
48
                } catch (MalformedURLException e) {
49
                        // TODO Auto-generated catch block
50
                        return null;
51
                }
52
        }
53

    
54
}