v0.3.4: improvements to languages handling
This commit is contained in:
committed by
Evan Debenham
parent
34f6e8540f
commit
2746c0f220
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Pixel Dungeon
|
||||
* Copyright (C) 2012-2015 Oleg Dolya
|
||||
*
|
||||
* Shattered Pixel Dungeon
|
||||
* Copyright (C) 2014-2015 Evan Debenham
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.messages;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public enum Languages {
|
||||
ENGLISH("english", "", Status.REVIEWED, null, null),
|
||||
RUSSIAN("русский", "ru", Status.REVIEWED, new String[]{"ConsideredHamster", "Inevielle", "Yarikonline"}, new String[]{"HerrGotlieb", "Shamahan"}),
|
||||
KOREAN("한국어", "ko", Status.REVIEWED, new String[]{"Flameblast12"}, new String[]{"Ddojin0115", "Eeeei", "lsiebnie", "WondarRabb1t"}),
|
||||
|
||||
CHINESE("中文", "zh", Status.UNREVIEWED, null, null), //Simplified
|
||||
PORTUGUESE("português", "pt", Status.UNREVIEWED, null, null), //Brazillian
|
||||
|
||||
GERMAN("deutsch", "de", Status.INCOMPLETE, null, null),
|
||||
POLISH("polski", "pl", Status.INCOMPLETE, null, null),
|
||||
SPANISH("español", "es", Status.INCOMPLETE, null, null),
|
||||
FRENCH("français", "fr", Status.INCOMPLETE, null, null);
|
||||
|
||||
public enum Status{
|
||||
//below 60% complete languages are not added.
|
||||
INCOMPLETE, //60-99% complete
|
||||
UNREVIEWED, //100% complete
|
||||
REVIEWED //100% reviewed
|
||||
}
|
||||
|
||||
private String name;
|
||||
private String code;
|
||||
private Status status;
|
||||
private String[] reviewers;
|
||||
private String[] translators;
|
||||
|
||||
Languages(String name, String code, Status status, String[] reviewers, String[] translators){
|
||||
this.name = name;
|
||||
this.code = code;
|
||||
this.status = status;
|
||||
this.reviewers = reviewers;
|
||||
this.translators = translators;
|
||||
}
|
||||
|
||||
public String nativeName(){
|
||||
return name;
|
||||
}
|
||||
|
||||
public String code(){
|
||||
return code;
|
||||
}
|
||||
|
||||
public Status status(){
|
||||
return status;
|
||||
}
|
||||
|
||||
public static Languages matchLocale(Locale locale){
|
||||
return matchCode(locale.getLanguage());
|
||||
}
|
||||
|
||||
public static Languages matchCode(String code){
|
||||
for (Languages lang : Languages.values()){
|
||||
if (lang.code().equals(code))
|
||||
return lang;
|
||||
}
|
||||
return ENGLISH;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user