]> WPIA git - gigi.git/blob - src/club/wpia/gigi/output/template/TemplateBlock.java
upd: rename package name and all references to it
[gigi.git] / src / club / wpia / gigi / output / template / TemplateBlock.java
1 package club.wpia.gigi.output.template;
2
3 import java.io.PrintWriter;
4 import java.util.Collection;
5 import java.util.Map;
6
7 import club.wpia.gigi.localisation.Language;
8
9 class TemplateBlock implements Translatable {
10
11     private String[] contents;
12
13     private Translatable[] vars;
14
15     public TemplateBlock(String[] contents, Translatable[] vars) {
16         this.contents = contents;
17         this.vars = vars;
18     }
19
20     @Override
21     public void output(PrintWriter out, Language l, Map<String, Object> vars) {
22         for (int i = 0; i < contents.length; i++) {
23             out.print(contents[i]);
24             if (i < this.vars.length) {
25                 this.vars[i].output(out, l, vars);
26             }
27         }
28     }
29
30     public void addTranslations(Collection<String> s) {
31         for (Translatable t : vars) {
32             t.addTranslations(s);
33         }
34     }
35
36 }