TranslationConfiguration.java
2.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.adobe.granite.translation.api.TranslationManager
* org.apache.commons.lang3.StringUtils
* org.slf4j.Logger
* org.slf4j.LoggerFactory
*/
package com.adobe.cq.wcm.translation.impl;
import com.adobe.cq.wcm.translation.impl.TranslationPropertyType;
import com.adobe.granite.translation.api.TranslationManager;
import java.util.Set;
import java.util.TreeSet;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class TranslationConfiguration {
private static final Logger log = LoggerFactory.getLogger(TranslationConfiguration.class);
private String srcLang = "";
private String dstLang = "";
private Set<String> propertiesToTranslate = new TreeSet<String>();
private Set<String> propertiesWithLanguageCode = new TreeSet<String>();
private Set<String> propertiesWithLanguagePath = new TreeSet<String>();
TranslationManager translationManager;
public void addPropertyToTranslate(String strProperty) {
log.debug("FUNCTION: addPropertyToTranslate");
if (!StringUtils.isEmpty((CharSequence)strProperty)) {
this.propertiesToTranslate.add(strProperty);
}
}
public void setSourceLanguage(String srcLang) {
this.srcLang = srcLang;
}
public void setDestinationLanguage(String dstLang) {
this.dstLang = dstLang;
}
public void setTranslationManager(TranslationManager tm) {
log.debug("FUNCTION: setTranslationManager ", (Object)tm.getClass().getName());
this.translationManager = tm;
}
public TranslationManager getTranslationManager() {
log.debug("FUNCTION: getTranslationManager ", (Object)this.translationManager.getClass().getName());
return this.translationManager;
}
public String getSourceLanguage() {
return this.srcLang;
}
public String getDestinationLanguage() {
return this.dstLang;
}
public void addPropertyWithLanguageCode(String strProperty) {
if (!StringUtils.isEmpty((CharSequence)strProperty)) {
this.propertiesWithLanguageCode.add(strProperty);
}
}
public void addPropertyWithLanguagePath(String strProperty) {
if (!StringUtils.isEmpty((CharSequence)strProperty)) {
this.propertiesWithLanguagePath.add(strProperty);
}
}
public TranslationPropertyType getTranslationPropertyType(String strPropertyName) {
TranslationPropertyType propType = TranslationPropertyType.UNDEFINED;
if (this.propertiesToTranslate.contains(strPropertyName)) {
propType = TranslationPropertyType.TRANSLATETEXT;
} else if (this.propertiesWithLanguageCode.contains(strPropertyName)) {
propType = TranslationPropertyType.CONVERTLANGUAGE;
} else if (this.propertiesWithLanguagePath.contains(strPropertyName)) {
propType = TranslationPropertyType.CHANGEPATH;
}
return propType;
}
}