- Timestamp:
- 2018-03-04T22:09:01+01:00 (6 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java
r13502 r13507 745 745 Reader reader = new BufferedReader(UTFInputStreamReader.create(s))) { 746 746 if (zip != null) 747 I18n.addTexts Zip(cache.getFile());747 I18n.addTexts(cache.getFile()); 748 748 result = TagCheck.readMapCSS(reader); 749 749 checks.remove(url); -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSource.java
r13506 r13507 516 516 zipFile = new ZipFile(file, StandardCharsets.UTF_8); 517 517 zipIcons = file; 518 I18n.addTexts Zip(zipIcons);518 I18n.addTexts(zipIcons); 519 519 ZipEntry zipEntry = zipFile.getEntry(zipEntryPath); 520 520 return zipFile.getInputStream(zipEntry); -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetReader.java
r13506 r13507 344 344 if (zip != null) { 345 345 zipIcons = cf.getFile(); 346 I18n.addTexts Zip(zipIcons);346 I18n.addTexts(zipIcons); 347 347 } 348 348 try (InputStreamReader r = UTFInputStreamReader.create(zip == null ? cf.getInputStream() : zip)) { -
trunk/src/org/openstreetmap/josm/tools/I18n.java
r13503 r13507 20 20 import java.util.Locale; 21 21 import java.util.Map; 22 import java.util.jar.JarInputStream;23 22 import java.util.zip.ZipEntry; 24 23 import java.util.zip.ZipFile; … … 370 369 /** 371 370 * I18n initialization for plugins. 372 * @param source file path/name of the JAR file containing translation strings371 * @param source file path/name of the JAR or Zip file containing translation strings 373 372 * @since 4159 374 373 */ 375 374 public static void addTexts(File source) { 376 if ("en".equals(loadedCode))377 return;378 final String enfile = "data/en.lang";379 final String langfile = "data/"+loadedCode+".lang";380 try (381 InputStream fis = Files.newInputStream(source.toPath());382 JarInputStream jar = new JarInputStream(fis)383 ) {384 ZipEntry e;385 boolean found = false;386 while (!found && (e = jar.getNextEntry()) != null) {387 String name = e.getName();388 if (enfile.equals(name))389 found = true;390 }391 if (found) {392 try (393 InputStream fisTrans = Files.newInputStream(source.toPath());394 JarInputStream jarTrans = new JarInputStream(fisTrans)395 ) {396 found = false;397 while (!found && (e = jarTrans.getNextEntry()) != null) {398 String name = e.getName();399 if (name.equals(langfile))400 found = true;401 }402 if (found)403 load(jar, jarTrans, true);404 }405 }406 } catch (IOException | InvalidPathException e) {407 Logging.trace(e);408 }409 }410 411 /**412 * I18n initialization for Zip based resources.413 * @param source input Zip source414 * @since 13502415 */416 public static void addTextsZip(File source) {417 375 if ("en".equals(loadedCode)) 418 376 return;
Note:
See TracChangeset
for help on using the changeset viewer.