Skip to content

Commit

Permalink
Fix Xlsx2Po outputting incorrect filenames
Browse files Browse the repository at this point in the history
Also Fix exception in Xlsx2Po when cell is in numeric format
  • Loading branch information
tomcashman committed Aug 4, 2021
1 parent 1332041 commit 2bfad60
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[1.9.2]
- Fix Xlsx2Po outputting incorrect filenames
- Fix exception in Xlsx2Po when cell is in numeric format

[1.9.1]
- Fix PoFile not reading UTF8 characters correctly depending on constructor used
- TranslationEntry no longer outputs empty comments
Expand Down
11 changes: 9 additions & 2 deletions gettext-xlsx/src/main/java/org/mini2Dx/gettext/xlsx/Xlsx2Po.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public static void convertFile(final File xlsxFile, final File poDirectory) thro
if(!directory.exists()) {
directory.mkdirs();
}
outputFiles.put(locale, new File(directory, sheet.getSheetName().replace(".pot", ".po")));
outputFiles.put(locale, new File(directory, xlsxFile.getName().replace(".pot", ".po").replace(".xlsx", ".po")));
poFiles.put(locale, new PoFile(locale));
localeIndices.put(columnIndex, locale);
}
Expand Down Expand Up @@ -115,6 +115,13 @@ private static String getCell(final Row row, final int columnIndex) {
if(row.getCell(columnIndex) == null) {
return "";
}
return row.getCell(columnIndex).getStringCellValue().trim();
try {
return row.getCell(columnIndex).getStringCellValue().trim();
} catch (IllegalStateException e) {
if(e.getMessage().contains("Cannot get a STRING value from a NUMERIC cell")) {
return String.valueOf(row.getCell(columnIndex).getNumericCellValue());
}
throw e;
}
}
}

0 comments on commit 2bfad60

Please sign in to comment.