Skip to content

Commit

Permalink
Language code in title
Browse files Browse the repository at this point in the history
  • Loading branch information
berk76 committed Jul 26, 2019
1 parent 756f567 commit d49b20f
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/main/java/cz/webstones/words/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public Main() throws DictionaryException {

initComponents();
this.setLocationRelativeTo(null);
setTitleText(Service.version, "");
setTitleText(Service.version, "", null);
jLabel1.setText("");
jLabel2.setText("");
jLabel3.setText("");
Expand Down Expand Up @@ -130,13 +130,22 @@ public void updateObserver() {
break;

case stateDictionaryLoaded:
this.setTitleText(Service.version, dict.getDictionaryName());
try {
this.setTitleText(Service.version, dict.getDictionaryName(), dict.getLanguage());
} catch (IOException ex) {
errorDialog.showError("Error: Cannot get language.", ex);
}
break;

}
}

private void setTitleText(String name, String dictionary) {
setTitle(String.format("%s (%s)", name, dictionary));
private void setTitleText(String name, String dictionary, LanguageDto lang) {
String langCode = "";
if (lang != null) {
langCode = lang.getCode();
}
setTitle(String.format("%s - %s [%s]", name, dictionary, langCode));
}

private void play(WordDto w) {
Expand Down

0 comments on commit d49b20f

Please sign in to comment.