X-Git-Url: http://git.nikiroo.be/?p=fanfix.git;a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Foutput%2FBasicOutput.java;h=9bf096cca1ef8f5b7e5594694dc88da558f2ec11;hp=1342eb03016189535039fedf322f41cadcb92ff7;hb=b2612f9dcd0a37f4ec22fcabe55390280e06daf2;hpb=bee7dffea9ef8d3312eee90993a9faaeac6c1127 diff --git a/src/be/nikiroo/fanfix/output/BasicOutput.java b/src/be/nikiroo/fanfix/output/BasicOutput.java index 1342eb0..9bf096c 100644 --- a/src/be/nikiroo/fanfix/output/BasicOutput.java +++ b/src/be/nikiroo/fanfix/output/BasicOutput.java @@ -11,7 +11,7 @@ import be.nikiroo.fanfix.data.Chapter; import be.nikiroo.fanfix.data.Paragraph; import be.nikiroo.fanfix.data.Paragraph.ParagraphType; import be.nikiroo.fanfix.data.Story; -import be.nikiroo.utils.ui.Progress; +import be.nikiroo.utils.Progress; /** * This class is the base class used by the other output classes. It can be used @@ -52,15 +52,23 @@ public abstract class BasicOutput { /** * A description of this output type. * + * @param longDesc + * TRUE for the long description, FALSE for the short one + * * @return the description */ - public String getDesc() { - String desc = Instance.getTrans().getStringX(StringId.OUTPUT_DESC, - this.name()); + public String getDesc(boolean longDesc) { + StringId id = longDesc ? StringId.OUTPUT_DESC + : StringId.OUTPUT_DESC_SHORT; + + String desc = Instance.getTrans().getStringX(id, this.name()); if (desc == null) { - desc = Instance.getTrans() - .getString(StringId.OUTPUT_DESC, this); + desc = Instance.getTrans().getString(id, this); + } + + if (desc == null) { + desc = this.toString(); } return desc; @@ -69,12 +77,17 @@ public abstract class BasicOutput { /** * The default extension to add to the output files. * + * @param readerTarget + * the target to point to to read the {@link Story} (for + * instance, the main entry point if this {@link Story} is in + * a directory bundle) + * * @return the extension */ - public String getDefaultExtension() { + public String getDefaultExtension(boolean readerTarget) { BasicOutput output = BasicOutput.getOutput(this, false); if (output != null) { - return output.getDefaultExtension(); + return output.getDefaultExtension(readerTarget); } return null; @@ -166,7 +179,7 @@ public abstract class BasicOutput { File targetDir = new File(target).getParentFile(); String targetName = new File(target).getName(); - String ext = getDefaultExtension(); + String ext = getDefaultExtension(false); if (ext != null && !ext.isEmpty()) { if (targetName.toLowerCase().endsWith(ext)) { targetName = targetName.substring(0, @@ -239,9 +252,14 @@ public abstract class BasicOutput { /** * The default extension to add to the output files. * + * @param readerTarget + * the target to point to to read the {@link Story} (for + * instance, the main entry point if this {@link Story} is in a + * directory bundle) + * * @return the extension */ - public String getDefaultExtension() { + public String getDefaultExtension(boolean readerTarget) { return ""; }