-
Notifications
You must be signed in to change notification settings - Fork 215
/
Language.java
52 lines (39 loc) · 1.19 KB
/
Language.java
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
package org.mozilla.vrbrowser.ui.adapters;
import org.mozilla.vrbrowser.utils.StringUtils;
import java.util.Locale;
public class Language {
public Language(Locale locale) {
this.locale = locale;
this.isPreferred = false;
String languageId = locale.toLanguageTag();
String displayName = StringUtils.capitalize(locale.getDisplayName());
this.displayName = displayName + " [" + languageId + "]";
}
public Language(Locale locale, String displayName) {
this.locale = locale;
this.isPreferred = false;
this.displayName = StringUtils.capitalize(displayName);
}
private Locale locale;
private boolean isPreferred;
private String displayName;
public Locale getLocale() {
return this.locale;
}
public String getDisplayName() {
return this.displayName;
}
public String getLanguageTag() {
return this.locale.toLanguageTag();
}
public void setPreferred(boolean isPreferred) {
this.isPreferred = isPreferred;
}
public boolean isPreferred() {
return isPreferred;
}
@Override
public int hashCode() {
return locale.hashCode();
}
}