1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.plugin.plugin.report;
20
21 import java.util.Locale;
22
23 import org.apache.maven.doxia.sink.Sink;
24 import org.apache.maven.project.MavenProject;
25 import org.apache.maven.reporting.AbstractMavenReportRenderer;
26 import org.codehaus.plexus.i18n.I18N;
27
28
29 public abstract class AbstractPluginReportRenderer extends AbstractMavenReportRenderer {
30
31 private static final String RESOURCE_BASENAME = "plugin-report";
32
33 private final I18N i18n;
34
35 protected final Locale locale;
36
37 protected final MavenProject project;
38
39 protected AbstractPluginReportRenderer(Sink sink, Locale locale, I18N i18n, MavenProject project) {
40 super(sink);
41 this.i18n = i18n;
42 this.locale = locale;
43 this.project = project;
44 }
45
46 @Override
47 public String getTitle() {
48 return getI18nString("title");
49 }
50
51
52
53
54
55
56 protected String getI18nString(String key) {
57 return getI18nString(getI18nSection(), key);
58 }
59
60
61
62
63
64
65 protected String getI18nString(String section, String key) {
66 return i18n.getString(RESOURCE_BASENAME, locale, "report." + section + '.' + key);
67 }
68
69
70
71
72
73 protected abstract String getI18nSection();
74 }