Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jpass- Adds user-selected language feature #32

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ Configuration
Default configurations can be overridden in `jpass.properties` file:

| Configuration key | Value type | Default value |
| ---------------------------------- | ---------- | ---------------- |
| ---------------------------------- | ---------- |------------------|
| ui.theme.dark.mode.enabled | boolean | `false` |
| clear.clipboard.on.exit.enabled | boolean | `false` |
| default.password.generation.length | integer | `14` |
| date.format | string | `yyyy-MM-dd` |
| entry.details | list | `TITLE,MODIFIED` |
| file.chooser.directory | string | `./` |
| language.languageSetting | string | en-US |
| language.languageSetting | string | `en-US` |

Regarding `language.languageSetting` please check
[languages](https://github.com/gaborbata/jpass/tree/master/src/main/resources/resources/languages)
Expand Down
2 changes: 1 addition & 1 deletion src/main/config/jpass.properties
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ date.format=yyyy-MM-dd
file.chooser.directory=./

# Locale ID to set the program language
language.languageSetting=en-US
language.languageSetting=en-US
22 changes: 11 additions & 11 deletions src/main/java/jpass/ui/EntryDetailsTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ public class EntryDetailsTable extends JTable {
private static final DateTimeFormatter FORMATTER
= DateUtils.createFormatter(Configuration.getInstance().get("date.format", "yyyy-MM-dd"));

private enum DetailType {
TITLE(getLocalizedMessages().getString(VIEW_WINDOW_TITLE), Entry::getTitle),
URL(getLocalizedMessages().getString(VIEW_WINDOW_URL), Entry::getUrl),
USER(getLocalizedMessages().getString(VIEW_WINDOW_USER), Entry::getUser),
MODIFIED(getLocalizedMessages().getString(VIEW_WINDOW_MODIFIED), entry -> DateUtils.formatIsoDateTime(entry.getLastModification(), FORMATTER)),
CREATED(getLocalizedMessages().getString(VIEW_WINDOW_CREATED), entry -> DateUtils.formatIsoDateTime(entry.getCreationDate(), FORMATTER));
public enum DetailType {
TITLE(VIEW_WINDOW_TITLE, Entry::getTitle),
URL(VIEW_WINDOW_URL, Entry::getUrl),
USER(VIEW_WINDOW_USER, Entry::getUser),
MODIFIED(VIEW_WINDOW_MODIFIED, entry -> DateUtils.formatIsoDateTime(entry.getLastModification(), FORMATTER)),
CREATED(VIEW_WINDOW_CREATED, entry -> DateUtils.formatIsoDateTime(entry.getCreationDate(), FORMATTER));

private final String description;
private final Function<Entry, String> valueMapper;
Expand Down Expand Up @@ -111,7 +111,7 @@ public EntryDetailsTable() {
}

tableModel = new DefaultTableModel();
detailsToDisplay.forEach(detail -> tableModel.addColumn(detail.getDescription()));
detailsToDisplay.forEach(detail -> tableModel.addColumn(getLocalizedMessages().getString(detail.getDescription())));
setModel(tableModel);
getTableHeader().setReorderingAllowed(false);
addMouseListener(new TableListener());
Expand All @@ -135,6 +135,10 @@ public Component prepareRenderer(TableCellRenderer renderer, int row, int column
return component;
}

public List<DetailType> getDetailsToDisplay() {
return detailsToDisplay;
}

public void clear() {
tableModel.setRowCount(0);
}
Expand All @@ -144,8 +148,4 @@ public void addRow(Entry entry) {
.map(detail -> detail.getValue(entry))
.toArray(Object[]::new));
}

public int rowCount() {
return tableModel.getRowCount();
}
}
Loading
Loading