假設我有以下enum
:安卓:用枚舉值可以被翻譯成其他語言環境
public enum Feelings {
happy("label1"),sad("label2")
private final String name;
private Feelings(String s) {
name = s;
}
public boolean equalsName(String otherName) {
return (otherName == null) ? false : name.equals(otherName);
}
public String toString() {
return name;
}
}
當我打電話了.toString()
它返回不同的枚舉中定義的標籤。我在UI上使用這些標籤,並將其顯示給用戶。
當我考慮用不同的語言環境發佈我的應用程序時,我認爲可以定義這些標籤以便將它們翻譯成其他語言?