* improved docs

This commit is contained in:
Reinhard Pointner 2011-09-22 12:24:10 +00:00
parent d80e5683d5
commit ba622eafd1
3 changed files with 28 additions and 5 deletions

View File

@ -99,10 +99,18 @@ public class ArgumentBean {
public Language getLanguage() { public Language getLanguage() {
// try to look up by language code
Language language = Language.getLanguage(lang); Language language = Language.getLanguage(lang);
if (language == null) if (language == null) {
throw new IllegalArgumentException("Illegal language code: " + lang); // try too look up by language name
language = Language.getLanguageByName(lang);
if (language == null) {
// unable to lookup language
throw new IllegalArgumentException("Illegal language code: " + lang);
}
}
return language; return language;
} }

View File

@ -83,6 +83,16 @@ public class Language {
} }
public static Language getLanguageByName(String name) {
for (Language it : availableLanguages()) {
if (name.equalsIgnoreCase(it.getName()))
return it;
}
return null;
}
public static List<Language> availableLanguages() { public static List<Language> availableLanguages() {
ResourceBundle bundle = ResourceBundle.getBundle(Language.class.getName()); ResourceBundle bundle = ResourceBundle.getBundle(Language.class.getName());
return getLanguages(bundle.getString("languages.all").split(",")); return getLanguages(bundle.getString("languages.all").split(","));

View File

@ -144,7 +144,7 @@
<tr> <tr>
<td>-non-strict</td> <td>-non-strict</td>
<td>use less strict matching</td> <td>use less strict matching</td>
<td><small class="comment">(off by default)</small></td> <td><small class="comment">(strict by default)</small></td>
</tr> </tr>
<tr> <tr>
<td>-get-subtitles</td> <td>-get-subtitles</td>
@ -158,7 +158,7 @@
</tr> </tr>
<tr> <tr>
<td>--lang</td> <td>--lang</td>
<td><a href="http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes">2-letter language code</a></td> <td><a href="http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes" target="_blank">2-letter language code</a></td>
<td>en, de, fr, es, ja, zh, etc</td> <td>en, de, fr, es, ja, zh, etc</td>
</tr> </tr>
<tr> <tr>
@ -192,7 +192,12 @@
</tr> </tr>
<tr> <tr>
<td>-clear</td> <td>-clear</td>
<td>clear cache and settings</td> <td>clear cache and preferences</td>
<td></td>
</tr>
<tr>
<td>-no-analytics</td>
<td>disable <a href="https://sourceforge.net/projects/filebot/forums/forum/723389/topic/4719727" target="_blank">analytics</a></td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>