1
|
/**
|
2
|
* Copyright (C) 2020 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
package eu.etaxonomy.cdm.remote.l10n;
|
10
|
|
11
|
import java.util.List;
|
12
|
|
13
|
import eu.etaxonomy.cdm.model.common.Language;
|
14
|
import eu.etaxonomy.cdm.model.term.IKeyTerm;
|
15
|
|
16
|
/**
|
17
|
* @author a.kohlbecker
|
18
|
* @since May 28, 2020
|
19
|
*/
|
20
|
public class KeyTerm_L10n<T extends IKeyTerm> {
|
21
|
|
22
|
private T keyTerm;
|
23
|
|
24
|
public KeyTerm_L10n(T enumTerm) {
|
25
|
this.keyTerm = enumTerm;
|
26
|
}
|
27
|
|
28
|
public String localizedMessage() {
|
29
|
|
30
|
List<Language> languages = LocaleContext.getLanguages();
|
31
|
String message_L10n = null;
|
32
|
if(languages != null){
|
33
|
for(Language language : languages) {
|
34
|
message_L10n = keyTerm.getMessage(language);
|
35
|
if(message_L10n != null){
|
36
|
return message_L10n;
|
37
|
}
|
38
|
}
|
39
|
}
|
40
|
message_L10n = keyTerm.getMessage();
|
41
|
|
42
|
return message_L10n;
|
43
|
}
|
44
|
|
45
|
}
|