From 0b63e00e22956da990f02c5a19423aa2b8e760f9 Mon Sep 17 00:00:00 2001 From: Sebastian Annies Date: Mon, 17 Aug 2015 09:48:36 +0200 Subject: [PATCH] fixing missing localization problem for options and arguments --- args4j/src/org/kohsuke/args4j/CmdLineParser.java | 4 +++- args4j/src/org/kohsuke/args4j/spi/OptionHandler.java | 6 ++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/args4j/src/org/kohsuke/args4j/CmdLineParser.java b/args4j/src/org/kohsuke/args4j/CmdLineParser.java index c387b119..f22ddd0b 100644 --- a/args4j/src/org/kohsuke/args4j/CmdLineParser.java +++ b/args4j/src/org/kohsuke/args4j/CmdLineParser.java @@ -366,7 +366,9 @@ private String createDefaultValuePart(OptionHandler handler) { } private String localize(String s, ResourceBundle rb) { - if(rb!=null) return rb.getString(s); + if(rb!=null && rb.containsKey(s)) { + return rb.getString(s); + } return s; } diff --git a/args4j/src/org/kohsuke/args4j/spi/OptionHandler.java b/args4j/src/org/kohsuke/args4j/spi/OptionHandler.java index cb1f0095..faeb17af 100644 --- a/args4j/src/org/kohsuke/args4j/spi/OptionHandler.java +++ b/args4j/src/org/kohsuke/args4j/spi/OptionHandler.java @@ -82,10 +82,8 @@ public String getMetaVariable(ResourceBundle rb) { token = getDefaultMetaVariable(); if(token==null) return null; - if(rb!=null) { - String localized = rb.getString(token); - if(localized!=null) - token = localized; + if(rb!=null && rb.containsKey(token)) { + token = rb.getString(token); } return token;