forked from bsondermann/BlackboxSticksExporter3D
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Language.pde
35 lines (33 loc) · 1001 Bytes
/
Language.pde
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
class Language{
String name;
XML[] content;
String[]contentstring;
PImage langImage;
Language(String name){
this.name=name;
langImage = loadImage(sketchPath()+"/assets/lang/images/"+name+".png");
if(name.equals("ru")||name.equals("ua")){
contentstring = loadStrings(sketchPath()+"/assets/lang/lang/"+name+".xml");
}
loadLang();
}
void loadLang(){
content = loadXML(sketchPath()+"/assets/lang/lang/"+name+".xml").getChildren("text");
}
String getTranslation(String id){
String ret = "NO TRANSLATION!";
for(int i = 0; i< content.length; i++){
if(content[i].getString("id").equals(id)){
if(name.equals("ru")||name.equals("ua")){
ret= contentstring[i+1].substring(contentstring[i+1].length()-7-content[i].getContent().length(),contentstring[i+1].length()-7);
}else{
ret = content[i].getContent()+"";
}
}
}
return ret;
}
PImage getImage(){
return langImage;
}
}