branch feature/45-remove-i18n created (now 73d0104)
This is an automated email from the git hooks/post-receive script. New change to branch feature/45-remove-i18n in repository nuiton-csv. See https://gitlab.nuiton.org/nuiton/nuiton-csv.git at 73d0104 Remove i18n dependency This branch includes the following new commits: new 73d0104 Remove i18n dependency The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 73d01040309ca0923a3ad418cc3e91d948d032ab Author: jcouteau <couteau@codelutin.com> Date: Wed Apr 28 08:30:10 2021 +0200 Remove i18n dependency -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/45-remove-i18n in repository nuiton-csv. See https://gitlab.nuiton.org/nuiton/nuiton-csv.git commit 73d01040309ca0923a3ad418cc3e91d948d032ab Author: jcouteau <couteau@codelutin.com> Date: Wed Apr 28 08:30:10 2021 +0200 Remove i18n dependency --- pom.xml | 40 ---------------------- src/main/java/org/nuiton/csv/Import.java | 25 ++++++-------- src/main/java/org/nuiton/csv/Import2.java | 31 +++++++---------- .../resources/i18n/nuiton-csv_en_GB.properties | 8 ----- .../resources/i18n/nuiton-csv_es_ES.properties | 8 ----- .../resources/i18n/nuiton-csv_fr_FR.properties | 8 ----- 6 files changed, 23 insertions(+), 97 deletions(-) diff --git a/pom.xml b/pom.xml index e847b56..1bc2cb6 100644 --- a/pom.xml +++ b/pom.xml @@ -80,11 +80,6 @@ <signatureArtifactId>java18</signatureArtifactId> <signatureVersion>1.0</signatureVersion> - <nuitonI18nVersion>4.0</nuitonI18nVersion> - - <!-- i18n configuration --> - <i18n.bundles>fr_FR,en_GB,es_ES</i18n.bundles> - <!-- Site locales --> <locales>fr</locales> </properties> @@ -97,12 +92,6 @@ <version>3.1</version> </dependency> - <dependency> - <groupId>org.nuiton.i18n</groupId> - <artifactId>nuiton-i18n</artifactId> - <version>${nuitonI18nVersion}</version> - </dependency> - <dependency> <groupId>net.sourceforge.javacsv</groupId> <artifactId>javacsv</artifactId> @@ -163,37 +152,8 @@ <build> <pluginManagement> - <plugins> - - <!-- plugin i18n --> - <plugin> - <groupId>org.nuiton.i18n</groupId> - <artifactId>i18n-maven-plugin</artifactId> - <version>${nuitonI18nVersion}</version> - </plugin> - - </plugins> </pluginManagement> <plugins> - - <!-- plugin i18n --> - <plugin> - <groupId>org.nuiton.i18n</groupId> - <artifactId>i18n-maven-plugin</artifactId> - <configuration> - <silent>true</silent> - <bundles>fr_FR,en_GB,es_ES</bundles> - </configuration> - <executions> - <execution> - <goals> - <goal>parserJava</goal> - <goal>gen</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> </build> </project> diff --git a/src/main/java/org/nuiton/csv/Import.java b/src/main/java/org/nuiton/csv/Import.java index 2ecb974..f9b3288 100644 --- a/src/main/java/org/nuiton/csv/Import.java +++ b/src/main/java/org/nuiton/csv/Import.java @@ -42,8 +42,6 @@ import java.util.List; import java.util.NoSuchElementException; import java.util.Set; -import static org.nuiton.i18n.I18n.t; - /** * Import engine for a given import model. * <p> @@ -219,7 +217,7 @@ public class Import<E> implements Iterable<E>, Closeable { } catch (Exception e) { reader.close(); throw new ImportRuntimeException( - t("csv.import.error.unableToReadField", + String.format("Unable to read value of column '%s' at line %s", field.getHeaderName(), lineNumber), e); } } @@ -231,7 +229,7 @@ public class Import<E> implements Iterable<E>, Closeable { T parsedValue = field.parseValue(value); return parsedValue; } catch (Exception e) { - String message = t("csv.import.error.unableToParseValue", + String message = String.format("Unable to parse value '%s' (column '%s', line %s)", value, field.getHeaderName(), lineNumber) + "\n" + e.getMessage(); throw new ImportRuntimeException(message, e); @@ -245,7 +243,7 @@ public class Import<E> implements Iterable<E>, Closeable { try { field.setValue(element, parsedValue); } catch (Exception e) { - String message = t("csv.import.error.unableToSetValue", + String message = String.format("Unable to set value '%s' (object '%s', line %s, column '%s')", parsedValue, element.toString(), lineNumber, field.getHeaderName()); @@ -270,7 +268,7 @@ public class Import<E> implements Iterable<E>, Closeable { validHeaderNames.add(importableColumn.getHeaderName()); } String validationMessage = - t("csv.import.error.unrecognizedHeaders", + String.format("Fields %s are not recognized. Accepted fields are %s.", StringUtil.join(csvHeaders, ", ", true), StringUtil.join(validHeaderNames, ", ", true)); throw new ImportRuntimeException(validationMessage); @@ -289,7 +287,7 @@ public class Import<E> implements Iterable<E>, Closeable { } } if (!doubleHeaderNames.isEmpty()) { - String message = t("csv.import.error.duplicatedHeaders", + String message = String.format("Fields %s are duplicated.", StringUtil.join(doubleHeaderNames, ", ", true)); throw new ImportRuntimeException( @@ -310,7 +308,7 @@ public class Import<E> implements Iterable<E>, Closeable { if (!mandatoryHeadersNames.isEmpty()) { String validationMessage = - t("csv.import.error.missingMandatoryHeaders", + String.format("The mandatory fields %s are missing", StringUtil.join(mandatoryHeadersNames, ", ", true)); throw new ImportRuntimeException(validationMessage); } @@ -320,12 +318,10 @@ public class Import<E> implements Iterable<E>, Closeable { try { boolean canReadHeaders = reader.readHeaders(); if (!canReadHeaders) { - throw new ImportRuntimeException( - t("csv.import.error.unableToReadHeaders")); + throw new ImportRuntimeException("Unable to read headers"); } } catch (IOException e) { - throw new ImportRuntimeException( - t("csv.import.error.unableToReadHeaders"), e); + throw new ImportRuntimeException("Unable to read headers", e); } try { @@ -335,8 +331,7 @@ public class Import<E> implements Iterable<E>, Closeable { } return result; } catch (IOException e) { - throw new ImportRuntimeException( - t("csv.import.error.unableToReadHeaders"), e); + throw new ImportRuntimeException("Unable to read headers", e); } } @@ -404,7 +399,7 @@ public class Import<E> implements Iterable<E>, Closeable { return hasNext; } catch (IOException e) { reader.close(); - throw new ImportRuntimeException(t("csv.import.error.unableToReadLine", 1), e); + throw new ImportRuntimeException(String.format("Unable to read line %s", 1), e); } } diff --git a/src/main/java/org/nuiton/csv/Import2.java b/src/main/java/org/nuiton/csv/Import2.java index 8dc46fb..b064a93 100644 --- a/src/main/java/org/nuiton/csv/Import2.java +++ b/src/main/java/org/nuiton/csv/Import2.java @@ -43,8 +43,6 @@ import java.util.List; import java.util.NoSuchElementException; import java.util.Set; -import static org.nuiton.i18n.I18n.t; - /** * Improve the first {@link Import} class with the notion of {@link ImportRow}. * @@ -173,7 +171,7 @@ public class Import2<E> implements Iterable<ImportRow<E>>, Closeable { T parsedValue = field.parseValue(value); return parsedValue; } catch (Exception e) { - String message = t("csv.import.error.unableToParseValue", + String message = String.format("Unable to parse value '%s' (column '%s', line %s)", value, field.getHeaderName(), lineNumber) + "\n" + e.getMessage(); throw new ImportRuntimeException(message, e); @@ -187,7 +185,7 @@ public class Import2<E> implements Iterable<ImportRow<E>>, Closeable { try { field.setValue(element, parsedValue); } catch (Exception e) { - String message = t("csv.import.error.unableToSetValue", + String message = String.format("Unable to set value '%s' (object '%s', line %s, column '%s')", parsedValue, element.toString(), lineNumber, field.getHeaderName()); @@ -212,7 +210,7 @@ public class Import2<E> implements Iterable<ImportRow<E>>, Closeable { validHeaderNames.add(importableColumn.getHeaderName()); } String validationMessage = - t("csv.import.error.unrecognizedHeaders", + String.format("Fields %s are not recognized. Accepted fields are %s.", StringUtil.join(csvHeaders, ", ", true), StringUtil.join(validHeaderNames, ", ", true)); throw new ImportRuntimeException(validationMessage); @@ -231,8 +229,8 @@ public class Import2<E> implements Iterable<ImportRow<E>>, Closeable { } } if (!doubleHeaderNames.isEmpty()) { - String message = t("csv.import.error.duplicatedHeaders", - StringUtil.join(doubleHeaderNames, ", ", true)); + String message = String.format("Fields %s are duplicated.", + StringUtil.join(doubleHeaderNames, ", ", true)); throw new ImportRuntimeException( message); @@ -252,7 +250,7 @@ public class Import2<E> implements Iterable<ImportRow<E>>, Closeable { if (!mandatoryHeadersNames.isEmpty()) { String validationMessage = - t("csv.import.error.missingMandatoryHeaders", + String.format("The mandatory fields %s are missing", StringUtil.join(mandatoryHeadersNames, ", ", true)); throw new ImportRuntimeException(validationMessage); } @@ -262,12 +260,10 @@ public class Import2<E> implements Iterable<ImportRow<E>>, Closeable { try { boolean canReadHeaders = reader.readHeaders(); if (!canReadHeaders) { - throw new ImportRuntimeException( - t("csv.import.error.unableToReadHeaders")); + throw new ImportRuntimeException("Unable to read headers"); } } catch (IOException e) { - throw new ImportRuntimeException( - t("csv.import.error.unableToReadHeaders"), e); + throw new ImportRuntimeException("Unable to read headers", e); } try { @@ -277,8 +273,7 @@ public class Import2<E> implements Iterable<ImportRow<E>>, Closeable { } return result; } catch (IOException e) { - throw new ImportRuntimeException( - t("csv.import.error.unableToReadHeaders"), e); + throw new ImportRuntimeException("Unable to read headers", e); } } @@ -342,7 +337,7 @@ public class Import2<E> implements Iterable<ImportRow<E>>, Closeable { return hasNext; } catch (IOException e) { reader.close(); - throw new ImportRuntimeException(t("csv.import.error.unableToReadLine", 1), e); + throw new ImportRuntimeException(String.format("Unable to read line %s", 1), e); } } @@ -405,7 +400,7 @@ public class Import2<E> implements Iterable<ImportRow<E>>, Closeable { if (strictMode) { // throw an error throw new ImportRuntimeException( - t("csv.import.error.unableToReadField", + String.format("Unable to read value of column '%s' at line %s", field.getHeaderName(), lineNumber), e); } else { row.addError(new ImportReadErrorInfo<>( @@ -420,7 +415,7 @@ public class Import2<E> implements Iterable<ImportRow<E>>, Closeable { parsedValue = parseValue(field, lineNumber, value); } catch (Exception e) { if (strictMode) { - String message = t("csv.import.error.unableToParseValue", + String message = String.format("Unable to parse value '%s' (column '%s', line %s)", value, field.getHeaderName(), lineNumber) + "\n" + e.getMessage(); throw new ImportRuntimeException(message, e); @@ -436,7 +431,7 @@ public class Import2<E> implements Iterable<ImportRow<E>>, Closeable { setValue(field, lineNumber, element, parsedValue); } catch (Exception e) { if (strictMode) { - String message = t("csv.import.error.unableToSetValue", + String message = String.format("Unable to set value '%s' (object '%s', line %s, column '%s')", parsedValue, element.toString(), lineNumber, field.getHeaderName()); diff --git a/src/main/resources/i18n/nuiton-csv_en_GB.properties b/src/main/resources/i18n/nuiton-csv_en_GB.properties deleted file mode 100644 index a91f6a2..0000000 --- a/src/main/resources/i18n/nuiton-csv_en_GB.properties +++ /dev/null @@ -1,8 +0,0 @@ -csv.import.error.duplicatedHeaders=Fields %s are duplicated. -csv.import.error.missingMandatoryHeaders=The mandatory fields %s are missing -csv.import.error.unableToParseValue=Unable to parse value '%s' (column '%s', line %s) -csv.import.error.unableToReadField=Unable to read value of column '%s' at line %s -csv.import.error.unableToReadHeaders=Unable to read headers -csv.import.error.unableToReadLine=Unable to read line %s -csv.import.error.unableToSetValue=Unable to set value '%s' (object '%s', line %s, column '%s') -csv.import.error.unrecognizedHeaders=Fields %s are not recognized. Accepted fields are %s. diff --git a/src/main/resources/i18n/nuiton-csv_es_ES.properties b/src/main/resources/i18n/nuiton-csv_es_ES.properties deleted file mode 100644 index de7d536..0000000 --- a/src/main/resources/i18n/nuiton-csv_es_ES.properties +++ /dev/null @@ -1,8 +0,0 @@ -csv.import.error.duplicatedHeaders=Fields %s are duplicated. -csv.import.error.missingMandatoryHeaders=The mandatory fields %s are missing -csv.import.error.unableToParseValue=Unable to parse value '%s' (column '%s', line %s) -csv.import.error.unableToReadField=Unable to read value of column '%s' at line %s -csv.import.error.unableToReadHeaders=Unable to read headers -csv.import.error.unableToReadLine=Unable to read line %s -csv.import.error.unableToSetValue=Unable to set value '%s' (object'%s', line %s, column '%s') -csv.import.error.unrecognizedHeaders=Fields %s are not recognized. Accepted fields are %s. diff --git a/src/main/resources/i18n/nuiton-csv_fr_FR.properties b/src/main/resources/i18n/nuiton-csv_fr_FR.properties deleted file mode 100644 index 3a54560..0000000 --- a/src/main/resources/i18n/nuiton-csv_fr_FR.properties +++ /dev/null @@ -1,8 +0,0 @@ -csv.import.error.duplicatedHeaders=Les champs %s sont dupliqués. -csv.import.error.missingMandatoryHeaders=Les champs obligatoires %s sont manquants -csv.import.error.unableToParseValue=Erreur lors de l'interprétation de la valeur '%s' (colonne '%s', ligne %s) -csv.import.error.unableToReadField=Impossible de lire la colonne '%s' à la ligne %s -csv.import.error.unableToReadHeaders=Impossible de lire les en-têtes de colonnes -csv.import.error.unableToReadLine=Impossible de lire la ligne %s -csv.import.error.unableToSetValue=Impossible d'enregistrer la valeur '%s' (objet '%s', ligne %s, column '%s') -csv.import.error.unrecognizedHeaders=Les champs %s ne sont pas reconnus. Les champs possibles sont %s. -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
participants (1)
-
nuiton.org scm