1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.localization.internal; |
21 |
|
|
22 |
|
import java.util.Collection; |
23 |
|
import java.util.Locale; |
24 |
|
|
25 |
|
import org.xwiki.localization.TranslationBundle; |
26 |
|
import org.xwiki.localization.TranslationBundleContext; |
27 |
|
import org.xwiki.localization.Translation; |
28 |
|
import org.xwiki.localization.message.TranslationMessage; |
29 |
|
import org.xwiki.rendering.block.Block; |
30 |
|
|
31 |
|
|
32 |
|
@link |
33 |
|
|
34 |
|
@version |
35 |
|
@since |
36 |
|
|
|
|
| 88% |
Uncovered Elements: 3 (25) |
Complexity: 11 |
Complexity Density: 0.92 |
|
37 |
|
public abstract class AbstractTranslation implements Translation |
38 |
|
{ |
39 |
|
|
40 |
|
|
41 |
|
|
42 |
|
private TranslationBundleContext context; |
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
private LocalizedTranslationBundle localeBundle; |
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
|
52 |
|
private String key; |
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
|
57 |
|
private TranslationMessage message; |
58 |
|
|
59 |
|
|
60 |
|
@param |
61 |
|
@param |
62 |
|
@param |
63 |
|
@param |
64 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
65 |
297863 |
public AbstractTranslation(TranslationBundleContext context, LocalizedTranslationBundle localeBundle, String key,... |
66 |
|
TranslationMessage message) |
67 |
|
{ |
68 |
297863 |
this.context = context; |
69 |
297863 |
this.localeBundle = localeBundle; |
70 |
297863 |
this.key = key; |
71 |
297863 |
this.message = message; |
72 |
|
} |
73 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
74 |
0 |
@Override... |
75 |
|
public TranslationBundle getBundle() |
76 |
|
{ |
77 |
0 |
return this.localeBundle.getBundle(); |
78 |
|
} |
79 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
80 |
159912 |
@Override... |
81 |
|
public Locale getLocale() |
82 |
|
{ |
83 |
159913 |
return this.localeBundle.getLocale(); |
84 |
|
} |
85 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
86 |
301322 |
@Override... |
87 |
|
public String getKey() |
88 |
|
{ |
89 |
301322 |
return this.key; |
90 |
|
} |
91 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
92 |
18 |
@Override... |
93 |
|
public Object getRawSource() |
94 |
|
{ |
95 |
18 |
return this.message.getRawSource(); |
96 |
|
} |
97 |
|
|
98 |
|
|
99 |
|
|
100 |
|
|
101 |
|
@return |
102 |
|
|
|
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
103 |
76308 |
private Collection<TranslationBundle> getCurrentBundles()... |
104 |
|
{ |
105 |
76303 |
return this.context != null ? this.context.getBundles() : null; |
106 |
|
} |
107 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
108 |
76306 |
@Override... |
109 |
|
public Block render(Locale locale, Object... parameters) |
110 |
|
{ |
111 |
76303 |
return this.message.render(locale != null ? locale : getLocale(), getCurrentBundles(), parameters); |
112 |
|
} |
113 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
114 |
4363 |
@Override... |
115 |
|
public Block render(Object... parameters) |
116 |
|
{ |
117 |
4363 |
return render(null, parameters); |
118 |
|
} |
119 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
120 |
3459 |
@Override... |
121 |
|
public String toString() |
122 |
|
{ |
123 |
3459 |
return getKey() + ':' + this.message.toString(); |
124 |
|
} |
125 |
|
} |