Add support for i18n using resource bundles

This commit is contained in:
Paul Schaub 2022-08-04 13:46:36 +02:00
parent a02af58160
commit 20c6bc4c36
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
18 changed files with 146 additions and 11 deletions

View file

@ -26,7 +26,7 @@ import java.sql.SQLException;
@CommandLine.Command(
name = "certificate-store",
description = "Store and manage public OpenPGP certificates",
resourceBundle = "msg_pgp-cert-d",
subcommands = {
CommandLine.HelpCommand.class,
Export.class,
@ -39,7 +39,6 @@ import java.sql.SQLException;
public class PGPCertDCli {
@CommandLine.Option(names = {"-s", "--store"}, paramLabel = "DIRECTORY",
description = "Overwrite the default certificate directory path",
scope = CommandLine.ScopeType.INHERIT)
File baseDirectory;

View file

@ -16,7 +16,7 @@ import java.io.InputStream;
import java.util.Iterator;
@CommandLine.Command(name = "export",
description = "Export all certificates in the store to Standard Output")
resourceBundle = "msg_export")
public class Export implements Runnable {
private static final Logger LOGGER = LoggerFactory.getLogger(Get.class);

View file

@ -16,15 +16,14 @@ import pgp.certificate_store.exception.BadNameException;
import picocli.CommandLine;
@CommandLine.Command(name = "get",
description = "Retrieve certificates from the store")
resourceBundle = "msg_get")
public class Get implements Runnable {
private static final Logger LOGGER = LoggerFactory.getLogger(Get.class);
@CommandLine.Parameters(
paramLabel = "IDENTIFIER",
arity = "1",
description = "Certificate identifier (fingerprint or special name)"
arity = "1"
)
String identifer;

View file

@ -20,7 +20,7 @@ import java.io.ByteArrayInputStream;
import java.io.IOException;
@CommandLine.Command(name = "import",
description = "Import certificates into the store from Standard Input")
resourceBundle = "msg_import")
public class Import implements Runnable {
private static final Logger LOGGER = LoggerFactory.getLogger(Import.class);

View file

@ -15,7 +15,7 @@ import picocli.CommandLine;
import java.io.IOException;
@CommandLine.Command(name = "insert",
description = "Insert or update a certificate")
resourceBundle = "msg_insert")
public class Insert implements Runnable {
private static final Logger LOGGER = LoggerFactory.getLogger(Insert.class);

View file

@ -27,7 +27,7 @@ import java.security.InvalidAlgorithmParameterException;
import java.security.NoSuchAlgorithmException;
@CommandLine.Command(name = "setup",
description = "Setup a new certificate directory")
resourceBundle = "msg_setup")
public class Setup implements Runnable {
public static final Logger LOGGER = LoggerFactory.getLogger(Setup.class);
@ -37,8 +37,7 @@ public class Setup implements Runnable {
static class Exclusive {
@CommandLine.Option(names = "--with-password",
paramLabel = "PASSWORD",
description = "Ask for a password for the trust-root key")
paramLabel = "PASSWORD")
String password;
@CommandLine.Option(names = "--import-from-stdin",

View file

@ -0,0 +1,11 @@
# SPDX-FileCopyrightText: 2022 Paul Schaub <vanitasvitae@fsfe.org>
#
# SPDX-License-Identifier: Apache-2.0
usage.header=Export all certificates in the store to Standard Output
# Generic TODO: Remove when bumping picocli to 4.7.0
usage.synopsisHeading=Usage:\u0020
usage.commandListHeading = %nCommands:%n
usage.optionListHeading = %nOptions:%n
usage.footerHeading=Powered by picocli%n
store=Overwrite the default certificate directory path

View file

@ -0,0 +1,11 @@
# SPDX-FileCopyrightText: 2022 Paul Schaub <vanitasvitae@fsfe.org>
#
# SPDX-License-Identifier: Apache-2.0
usage.header=Exportiere alle gespeicherten Zertifikate zur Standardausgabe
# Generic TODO: Remove when bumping picocli to 4.7.0
usage.synopsisHeading=Aufruf:\u0020
usage.commandListHeading=%nBefehle:%n
usage.optionListHeading = %nOptionen:%n
usage.footerHeading=Powered by Picocli%n
store=Überschreibe den Standardpfad des Zertifikatsverzeichnisses

View file

@ -0,0 +1,12 @@
# SPDX-FileCopyrightText: 2022 Paul Schaub <vanitasvitae@fsfe.org>
#
# SPDX-License-Identifier: Apache-2.0
usage.header=Retrieve certificates from the store
IDENTIFIER[0]=Certificate identifier (fingerprint or special name)
# Generic TODO: Remove when bumping picocli to 4.7.0
usage.synopsisHeading=Usage:\u0020
usage.commandListHeading = %nCommands:%n
usage.optionListHeading = %nOptions:%n
usage.footerHeading=Powered by picocli%n
store=Overwrite the default certificate directory path

View file

@ -0,0 +1,12 @@
# SPDX-FileCopyrightText: 2022 Paul Schaub <vanitasvitae@fsfe.org>
#
# SPDX-License-Identifier: Apache-2.0
usage.header=Frage Zertifikate aus dem Speicher ab
IDENTIFIER[0]=Zertifikatskennung (Fingerabdruck oder Spezialname)
# Generic TODO: Remove when bumping picocli to 4.7.0
usage.synopsisHeading=Aufruf:\u0020
usage.commandListHeading=%nBefehle:%n
usage.optionListHeading = %nOptionen:%n
usage.footerHeading=Powered by Picocli%n
store=Überschreibe den Standardpfad des Zertifikatsverzeichnisses

View file

@ -0,0 +1,11 @@
# SPDX-FileCopyrightText: 2022 Paul Schaub <vanitasvitae@fsfe.org>
#
# SPDX-License-Identifier: Apache-2.0
usage.header=Import certificates into the store from Standard Input
# Generic TODO: Remove when bumping picocli to 4.7.0
usage.synopsisHeading=Usage:\u0020
usage.commandListHeading = %nCommands:%n
usage.optionListHeading = %nOptions:%n
usage.footerHeading=Powered by picocli%n
store=Overwrite the default certificate directory path

View file

@ -0,0 +1,11 @@
# SPDX-FileCopyrightText: 2022 Paul Schaub <vanitasvitae@fsfe.org>
#
# SPDX-License-Identifier: Apache-2.0
usage.header=Importiere Zertifikate von der Standardeingabe in den Speicher
# Generic TODO: Remove when bumping picocli to 4.7.0
usage.synopsisHeading=Aufruf:\u0020
usage.commandListHeading=%nBefehle:%n
usage.optionListHeading = %nOptionen:%n
usage.footerHeading=Powered by Picocli%n
store=Überschreibe den Standardpfad des Zertifikatsverzeichnisses

View file

@ -0,0 +1,11 @@
# SPDX-FileCopyrightText: 2022 Paul Schaub <vanitasvitae@fsfe.org>
#
# SPDX-License-Identifier: Apache-2.0
usage.header=Insert or update a certificate
# Generic TODO: Remove when bumping picocli to 4.7.0
usage.synopsisHeading=Usage:\u0020
usage.commandListHeading = %nCommands:%n
usage.optionListHeading = %nOptions:%n
usage.footerHeading=Powered by picocli%n
store=Overwrite the default certificate directory path

View file

@ -0,0 +1,11 @@
# SPDX-FileCopyrightText: 2022 Paul Schaub <vanitasvitae@fsfe.org>
#
# SPDX-License-Identifier: Apache-2.0
usage.header=Aktualisiere oder importiere ein Zertifikat
# Generic TODO: Remove when bumping picocli to 4.7.0
usage.synopsisHeading=Aufruf:\u0020
usage.commandListHeading=%nBefehle:%n
usage.optionListHeading = %nOptionen:%n
usage.footerHeading=Powered by Picocli%n
store=Überschreibe den Standardpfad des Zertifikatsverzeichnisses

View file

@ -0,0 +1,11 @@
# SPDX-FileCopyrightText: 2022 Paul Schaub <vanitasvitae@fsfe.org>
#
# SPDX-License-Identifier: Apache-2.0
usage.header=Store and manage public OpenPGP certificates
store=Overwrite the default certificate directory path
# Generic TODO: Remove when bumping picocli to 4.7.0
usage.synopsisHeading=Usage:\u0020
usage.commandListHeading = %nCommands:%n
usage.optionListHeading = %nOptions:%n
usage.footerHeading=Powered by picocli%n

View file

@ -0,0 +1,11 @@
# SPDX-FileCopyrightText: 2022 Paul Schaub <vanitasvitae@fsfe.org>
#
# SPDX-License-Identifier: Apache-2.0
usage.header=Speichere und verwalte öffentliche OpenPGP Zertifikate
store=Überschreibe den Standardpfad des Zertifikatsverzeichnisses
# Generic TODO: Remove when bumping picocli to 4.7.0
usage.synopsisHeading=Aufruf:\u0020
usage.commandListHeading=%nBefehle:%n
usage.optionListHeading = %nOptionen:%n
usage.footerHeading=Powered by Picocli%n

View file

@ -0,0 +1,13 @@
# SPDX-FileCopyrightText: 2022 Paul Schaub <vanitasvitae@fsfe.org>
#
# SPDX-License-Identifier: Apache-2.0
usage.header=Setup a new certificate directory
with-password=Ask for a password for the trust-root key
import-from-stdin=Import trust-root from stdin
# Generic TODO: Remove when bumping picocli to 4.7.0
usage.synopsisHeading=Usage:\u0020
usage.commandListHeading = %nCommands:%n
usage.optionListHeading = %nOptions:%n
usage.footerHeading=Powered by picocli%n
store=Overwrite the default certificate directory path

View file

@ -0,0 +1,13 @@
# SPDX-FileCopyrightText: 2022 Paul Schaub <vanitasvitae@fsfe.org>
#
# SPDX-License-Identifier: Apache-2.0
usage.header=Richte ein neues Zertifikatsverzeichnis ein
with-password=Frage nach einem Passwort für den trust-root Schlüssel
import-from-stdin=Importiere trust-root Schlüssel von Standardeingabe
# Generic TODO: Remove when bumping picocli to 4.7.0
usage.synopsisHeading=Aufruf:\u0020
usage.commandListHeading=%nBefehle:%n
usage.optionListHeading = %nOptionen:%n
usage.footerHeading=Powered by Picocli%n
store=Überschreibe den Standardpfad des Zertifikatsverzeichnisses