Checks the existing language files for correctness and completeness.
()
| 131 | * Checks the existing language files for correctness and completeness. |
| 132 | */ |
| 133 | static void check() { |
| 134 | read(Prop.language); |
| 135 | final StringBuilder sb = new StringBuilder(); |
| 136 | final HashSet<String> set = new HashSet<>(TEXTS.keySet()); |
| 137 | |
| 138 | final IOFile[] files = new IOFile("src/main/resources/lang").children(); |
| 139 | for(final IOFile file : files) { |
| 140 | final String lang = file.name().replace('.' + SUFFIX, ""); |
| 141 | if(lang.equals(Prop.language)) continue; |
| 142 | |
| 143 | read(lang); |
| 144 | for(final String text : set.toArray(String[]::new)) { |
| 145 | if(TEXTS.remove(text) == null) sb.append("- ").append(text).append('\n'); |
| 146 | } |
| 147 | if(!sb.isEmpty()) { |
| 148 | Util.err("Missing in %.lang:\n%", lang, sb); |
| 149 | sb.setLength(0); |
| 150 | } |
| 151 | for(final String s : TEXTS.keySet()) { |
| 152 | sb.append("- ").append(s).append('\n'); |
| 153 | } |
| 154 | if(!sb.isEmpty()) { |
| 155 | Util.err("Not defined in %.lang:\n%", lang, sb); |
| 156 | sb.setLength(0); |
| 157 | } |
| 158 | } |
| 159 | } |
| 160 | } |