From 04ac39877d11acf15914eff28312406f86ddfb7a Mon Sep 17 00:00:00 2001
From: blavenie <benoit.lavenier@e-is.pro>
Date: Tue, 11 Apr 2017 10:05:30 +0200
Subject: [PATCH] Add i18n

---
 .../i18n/duniter4j-es-core_en_GB.properties   | 14 +++----
 .../i18n/duniter4j-es-core_fr_FR.properties   |  4 +-
 .../user/service/AdminService.java            |  9 ++++-
 .../user/service/MessageService.java          |  2 +-
 .../i18n/duniter4j-es-user_en_GB.properties   | 39 +++++++------------
 .../i18n/duniter4j-es-user_fr_FR.properties   | 20 +++++-----
 6 files changed, 42 insertions(+), 46 deletions(-)

diff --git a/duniter4j-es-core/src/main/resources/i18n/duniter4j-es-core_en_GB.properties b/duniter4j-es-core/src/main/resources/i18n/duniter4j-es-core_en_GB.properties
index f7bd9849..ef9d3b43 100644
--- a/duniter4j-es-core/src/main/resources/i18n/duniter4j-es-core_en_GB.properties
+++ b/duniter4j-es-core/src/main/resources/i18n/duniter4j-es-core_en_GB.properties
@@ -1,10 +1,10 @@
-duniter4j-elasticsearch.config=
+duniter4j-es-core.config=
 duniter4j.blockIndexerService.detectFork.invalidBlock=[%s] [%s] Detecting fork\: block \#%s -> new hash [%s]
 duniter4j.blockIndexerService.detectFork.invalidBlockchain=[%s] [%s] Peer has another blockchain (no common blocks \!). Skipping block \#%s - hash [%s].
 duniter4j.blockIndexerService.detectFork.remoteBlockNotFound=[%s] [%s] Unable to get block \#%s from peer\: %s
 duniter4j.blockIndexerService.detectFork.resync=[%s] [%s] Rollback index from block \#%s, and resync
 duniter4j.blockIndexerService.indexBlock=[%s] [%s] Indexing block \#%s - hash [%s]
-duniter4j.blockIndexerService.indexLastBlocks.invalidBlockchain=
+duniter4j.blockIndexerService.indexLastBlocks.invalidBlockchain=[%s] [%s] Peer has another blockchain (no common blocks \!). Skipping last blocks indexation.
 duniter4j.blockIndexerService.indexLastBlocks.otherPeers.task=Indexing missing blocks of [%s] from other peers
 duniter4j.blockIndexerService.indexLastBlocks.progress=[%s] [%s] Indexing block \#%s / %s (%s%%)...
 duniter4j.blockIndexerService.indexLastBlocks.remoteParametersError=[%s] Error when calling [/blockchain/parameters]\: %s
@@ -34,11 +34,11 @@ duniter4j.config.option.tasks.queueCapacity.description=
 duniter4j.config.option.temp.directory.description=
 duniter4j.config.option.version.description=
 duniter4j.config.parse.error=
-duniter4j.es.networkService.indexPeer=
-duniter4j.es.networkService.indexPeers.progress=
-duniter4j.es.networkService.indexPeers.remoteParametersError=
-duniter4j.es.networkService.indexPeers.succeed=
-duniter4j.es.networkService.indexPeers.task=
+duniter4j.es.networkService.indexPeer=[%s] Indexing peer [%s]...
+duniter4j.es.networkService.indexPeers.progress=[%s] [%s] Indexing peers (%s%%)...
+duniter4j.es.networkService.indexPeers.remoteParametersError=[%s] Error when calling [/blockchain/parameters]\: %s
+duniter4j.es.networkService.indexPeers.succeed=[%s] [%s] All peers indexed\: found [%s] in [%s ms]
+duniter4j.es.networkService.indexPeers.task=[%s] [%s] Indexing peers...
 duniter4j.executor.task.waitingExecution=
 duniter4j.job.stopped=
 duniter4j.job.stopping=
diff --git a/duniter4j-es-core/src/main/resources/i18n/duniter4j-es-core_fr_FR.properties b/duniter4j-es-core/src/main/resources/i18n/duniter4j-es-core_fr_FR.properties
index f8468a74..efaaec94 100644
--- a/duniter4j-es-core/src/main/resources/i18n/duniter4j-es-core_fr_FR.properties
+++ b/duniter4j-es-core/src/main/resources/i18n/duniter4j-es-core_fr_FR.properties
@@ -43,7 +43,7 @@ duniter4j.executor.task.waitingExecution=
 duniter4j.job.stopped=
 duniter4j.job.stopping=
 duniter4j.job.success=
-duniter4j.removeServiceUtils.waitThenRetry=Remote request failed [%s]. Waiting then retry [%s/%s]...
+duniter4j.removeServiceUtils.waitThenRetry=
 duniter4j.task.issuer.system=Système
 duniter4j.task.starting=Démarrage du traitement...
-duniter4j.threadPool.clusterHealthStatus.changed=Cluster health status changed to [%s]. Executing pending job...
+duniter4j.threadPool.clusterHealthStatus.changed=
diff --git a/duniter4j-es-user/src/main/java/org/duniter/elasticsearch/user/service/AdminService.java b/duniter4j-es-user/src/main/java/org/duniter/elasticsearch/user/service/AdminService.java
index e014f885..c3506d79 100644
--- a/duniter4j-es-user/src/main/java/org/duniter/elasticsearch/user/service/AdminService.java
+++ b/duniter4j-es-user/src/main/java/org/duniter/elasticsearch/user/service/AdminService.java
@@ -40,6 +40,13 @@ import java.util.Locale;
  */
 public class AdminService extends AbstractService {
 
+    static {
+        // Reserve i18n
+        I18n.n("duniter.admin.event.subject.INFO");
+        I18n.n("duniter.admin.event.subject.WARN");
+        I18n.n("duniter.admin.event.subject.ERROR");
+    }
+
     private final UserEventService userEventService;
     private final MailService mailService;
 
@@ -86,7 +93,7 @@ public class AdminService extends AbstractService {
         if (StringUtils.isNotBlank(adminEmail)) {
             String subjectPrefix = pluginSettings.getMailSubjectPrefix();
             mailService.sendTextEmail(
-                    I18n.l(locale, "duniter4j.event.subject."+event.getType().name(), subjectPrefix),
+                    I18n.l(locale, "duniter.admin.event.subject."+event.getType().name(), subjectPrefix),
                     event.getLocalizedMessage(locale),
                     adminEmail);
         }
diff --git a/duniter4j-es-user/src/main/java/org/duniter/elasticsearch/user/service/MessageService.java b/duniter4j-es-user/src/main/java/org/duniter/elasticsearch/user/service/MessageService.java
index b1424cd2..9ee9d154 100644
--- a/duniter4j-es-user/src/main/java/org/duniter/elasticsearch/user/service/MessageService.java
+++ b/duniter4j-es-user/src/main/java/org/duniter/elasticsearch/user/service/MessageService.java
@@ -140,7 +140,7 @@ public class MessageService extends AbstractService {
         // Notify recipient
         userEventService.notifyUser(UserEvent.newBuilder(UserEvent.EventType.INFO, UserEventCodes.MESSAGE_RECEIVED.name())
                 .setRecipient(recipient)
-                .setMessage(I18n.n("duniter.user.event.message.received"), issuer, ModelUtils.minifyPubkey(issuer))
+                .setMessage(I18n.n("duniter.user.event.MESSAGE_RECEIVED"), issuer, ModelUtils.minifyPubkey(issuer))
                 .setTime(time)
                 .setReference(INDEX, INBOX_TYPE, messageId)
                 .build());
diff --git a/duniter4j-es-user/src/main/resources/i18n/duniter4j-es-user_en_GB.properties b/duniter4j-es-user/src/main/resources/i18n/duniter4j-es-user_en_GB.properties
index 829d6574..be87b6c8 100644
--- a/duniter4j-es-user/src/main/resources/i18n/duniter4j-es-user_en_GB.properties
+++ b/duniter4j-es-user/src/main/resources/i18n/duniter4j-es-user_en_GB.properties
@@ -1,27 +1,16 @@
-duniter.invitation.cert.received=
-duniter.user.event.CERT_RECEIVED=
-duniter.user.event.CERT_SENT=
-duniter.user.event.INVITATION_TO_CERTIFY=
-duniter.user.event.MEMBER_ACTIVE=
-duniter.user.event.MEMBER_JOIN=
-duniter.user.event.MEMBER_LEAVE=
+duniter.user.event.CERT_RECEIVED=You have received a certification from %2$s.
+duniter.user.event.CERT_SENT=Your certification to %2$s was executed.
+duniter.user.event.INVITATION_TO_CERTIFY=%2$s invites you to certify an identity.
+duniter.user.event.MEMBER_ACTIVE=Your membership to %1$s has been renewed successfully.
+duniter.user.event.MEMBER_JOIN=You are now a member of currency %1$s!
+duniter.user.event.MEMBER_LEAVE=You are not a member anymore of currency %1$s!
 duniter.user.event.NODE_BMA_DOWN=Duniter node [%1$s\:%2$s] is DOWN\: no access from ES node [%3$s]. Last connexion at %4$d. Blockchain indexation waiting.
 duniter.user.event.NODE_BMA_UP=Duniter node [%1$s\:%2$s] is UP again.
-duniter.user.event.NODE_STARTED=Node started on cluster Duniter4j ES [%s]
-duniter.user.event.TX_RECEIVED=
-duniter.user.event.TX_SENT=
-duniter.user.event.active=
-duniter.user.event.cert.received=
-duniter.user.event.cert.sent=
-duniter.user.event.join=
-duniter.user.event.leave=
-duniter.user.event.message.received=
-duniter.user.event.ms.active=
-duniter.user.event.ms.join=
-duniter.user.event.ms.leave=
-duniter.user.event.tx.received=
-duniter.user.event.tx.sent=
-duniter4j.event.subject.ERROR=[%s] Error message
-duniter4j.event.subject.INFO=[%s] Information message
-duniter4j.event.subject.WARN=[%s] Warning message
-duniter4j.ws.user.open=User [%s] connecting with id [%s] with locale [%s]
+duniter.user.event.NODE_STARTED=Your node ES API [%1$s] is UP.
+duniter.user.event.TX_RECEIVED=You received a payment from %2$s.
+duniter.user.event.TX_SENT=Your payment to %2$s was executed.
+duniter.user.event.MESSAGE_RECEIVED=You received a message from %2$s.
+duniter.admin.event.subject.ERROR=[%s] Error message
+duniter.admin.event.subject.INFO=[%s] Information message
+duniter.admin.event.subject.WARN=[%s] Warning message
+duniter4j.ws.user.open=User [%1$s] connecting with id [%2$s] with locale [%3$s]
diff --git a/duniter4j-es-user/src/main/resources/i18n/duniter4j-es-user_fr_FR.properties b/duniter4j-es-user/src/main/resources/i18n/duniter4j-es-user_fr_FR.properties
index 74e0b613..f664bccd 100644
--- a/duniter4j-es-user/src/main/resources/i18n/duniter4j-es-user_fr_FR.properties
+++ b/duniter4j-es-user/src/main/resources/i18n/duniter4j-es-user_fr_FR.properties
@@ -1,16 +1,16 @@
 duniter.user.event.CERT_RECEIVED=%2$s vous a certifié (certification prise en compte).
 duniter.user.event.CERT_SENT=Votre certification de %2$s a été pris en compte.
 duniter.user.event.INVITATION_TO_CERTIFY=%2$s vous invite à certifier une identité.
-duniter.user.event.MEMBER_ACTIVE=Votre adhésion comme membre a bien été renouvellée
-duniter.user.event.MEMBER_JOIN=Vous êtes maintenant membre de la monnaie
-duniter.user.event.MEMBER_LEAVE=Votre adhésion comme membre à expirée
+duniter.user.event.MEMBER_ACTIVE=Votre adhésion comme membre a bien été renouvellée.
+duniter.user.event.MEMBER_JOIN=Vous êtes maintenant membre de la monnaie %1$s !
+duniter.user.event.MEMBER_LEAVE=Votre adhésion comme membre à expirée.
 duniter.user.event.NODE_BMA_DOWN=Noeud Duniter [%1$s\:%2$s] non joignable, depuis le noeud ES API [%3$s]. Dernière connexion à %4$d. Indexation de blockchain en attente.
 duniter.user.event.NODE_BMA_UP=Noeud Duniter [%1$s\:%2$s] à nouveau accessible.
-duniter.user.event.NODE_STARTED=Noeud ES API démarré sur le cluster Duniter [%1$s]
-duniter.user.event.TX_RECEIVED=Vous avez recu un paiement de %2$s
-duniter.user.event.TX_SENT=Votre paiement à %2$s a bien été executé
-duniter.user.event.message.received=Vous avez reçu un message de %2$s
-duniter4j.event.subject.ERROR=%s Message d'erreur
-duniter4j.event.subject.INFO=%s Message d'information
-duniter4j.event.subject.WARN=%s Message d'avertissement
+duniter.user.event.NODE_STARTED=Noeud ES API [%1$s] est démarré.
+duniter.user.event.TX_RECEIVED=Vous avez recu un paiement de %2$s.
+duniter.user.event.TX_SENT=Votre paiement à %2$s a bien été executé.
+duniter.user.event.MESSAGE_RECEIVED=Vous avez reçu un message de %2$s.
+duniter.admin.event.subject.ERROR=%s Message d'erreur
+duniter.admin.event.subject.INFO=%s Message d'information
+duniter.admin.event.subject.WARN=%s Message d'avertissement
 duniter4j.ws.user.open=Utilisateur [%1$s] connecté id\=[%2$s] sur la locale [%3$s]
-- 
GitLab