From 88bc2a77c477af581f316bcaab9aeb031d693c81 Mon Sep 17 00:00:00 2001 From: William Nolin Date: Wed, 21 Aug 2019 20:10:40 -0400 Subject: [PATCH] Languages --- .../configuration/LocaleConfiguration.java | 2 +- .../ColorRecipesExplorer/model/Material.java | 4 +- .../ColorRecipesExplorer/web/StringBank.java | 1 + .../creators/MaterialCreatorController.java | 5 +- .../MaterialTypeCreatorController.java | 5 +- src/main/resources/application.properties | 2 +- src/main/resources/lang/messages.properties | 41 ------------- .../resources/lang/messages_en.properties | 27 +++++++-- src/main/resources/static/css/main.css | 1 + .../resources/templates/company/created.html | 7 +-- .../resources/templates/company/creator.html | 9 ++- .../resources/templates/company/remover.html | 21 +++---- src/main/resources/templates/fragments.html | 10 +++- src/main/resources/templates/images/add.html | 4 +- src/main/resources/templates/index.html | 24 ++++---- src/main/resources/templates/inventory.html | 4 +- .../resources/templates/material/created.html | 13 ++--- .../resources/templates/material/creator.html | 53 +++++++++-------- .../resources/templates/material/edit.html | 50 ++++++++-------- .../resources/templates/material/editor.html | 51 +++++++--------- .../resources/templates/material/remover.html | 55 ++++++++---------- .../resources/templates/material/simdut.html | 18 +++--- .../templates/materialType/creator.html | 33 ++++++----- src/main/resources/templates/mix/creator.html | 4 +- src/main/resources/templates/mix/editor.html | 4 +- .../resources/templates/recipe/created.html | 4 +- .../resources/templates/recipe/creator.html | 4 +- src/main/resources/templates/recipe/edit.html | 4 +- .../resources/templates/recipe/editor.html | 4 +- .../resources/templates/recipe/explore.html | 4 +- .../resources/templates/recipe/remover.html | 4 +- src/main/resources/templates/touchup.html | 4 +- workdir/recipes.mv.db | Bin 45056 -> 36864 bytes 33 files changed, 218 insertions(+), 258 deletions(-) delete mode 100644 src/main/resources/lang/messages.properties diff --git a/src/main/java/fyloz/trial/ColorRecipesExplorer/core/configuration/LocaleConfiguration.java b/src/main/java/fyloz/trial/ColorRecipesExplorer/core/configuration/LocaleConfiguration.java index 72d80b3..8116b78 100644 --- a/src/main/java/fyloz/trial/ColorRecipesExplorer/core/configuration/LocaleConfiguration.java +++ b/src/main/java/fyloz/trial/ColorRecipesExplorer/core/configuration/LocaleConfiguration.java @@ -26,7 +26,7 @@ public class LocaleConfiguration implements WebMvcConfigurer { @Bean public LocaleResolver localeResolver() { SessionLocaleResolver localeResolver = new SessionLocaleResolver(); - localeResolver.setDefaultLocale(Locale.FRENCH); + localeResolver.setDefaultLocale(Locale.ENGLISH); return localeResolver; } diff --git a/src/main/java/fyloz/trial/ColorRecipesExplorer/model/Material.java b/src/main/java/fyloz/trial/ColorRecipesExplorer/model/Material.java index dc71d85..d180665 100644 --- a/src/main/java/fyloz/trial/ColorRecipesExplorer/model/Material.java +++ b/src/main/java/fyloz/trial/ColorRecipesExplorer/model/Material.java @@ -3,6 +3,7 @@ package fyloz.trial.ColorRecipesExplorer.model; import org.hibernate.annotations.ColumnDefault; import javax.persistence.*; +import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; import java.io.Serializable; import java.util.Objects; @@ -16,6 +17,7 @@ public class Material extends BeanModel implements Serializable { private Integer materialID = 0; @NotNull + @NotEmpty private String materialCode; @NotNull @@ -25,7 +27,7 @@ public class Material extends BeanModel implements Serializable { @ColumnDefault("false") private boolean isMixType = false; - // Peut être null pour la création des types de mélanges + @NotNull @ManyToOne private MaterialType materialType; diff --git a/src/main/java/fyloz/trial/ColorRecipesExplorer/web/StringBank.java b/src/main/java/fyloz/trial/ColorRecipesExplorer/web/StringBank.java index 15d61f3..ba3c1a6 100644 --- a/src/main/java/fyloz/trial/ColorRecipesExplorer/web/StringBank.java +++ b/src/main/java/fyloz/trial/ColorRecipesExplorer/web/StringBank.java @@ -34,6 +34,7 @@ public class StringBank { public static final String MATERIAL_ID = "materialID"; public static final String MATERIAL_CODE = "materialCode"; public static final String MATERIAL_TYPES = "materialTypes"; + public static final String MATERIAL_TYPE = "materialType"; public static final String RECIPES = "recipes"; public static final String RECIPE = "recipe"; public static final String RECIPE_ID = "recipeID"; diff --git a/src/main/java/fyloz/trial/ColorRecipesExplorer/web/controller/creators/MaterialCreatorController.java b/src/main/java/fyloz/trial/ColorRecipesExplorer/web/controller/creators/MaterialCreatorController.java index 2460312..611a7b0 100644 --- a/src/main/java/fyloz/trial/ColorRecipesExplorer/web/controller/creators/MaterialCreatorController.java +++ b/src/main/java/fyloz/trial/ColorRecipesExplorer/web/controller/creators/MaterialCreatorController.java @@ -35,7 +35,8 @@ public class MaterialCreatorController { * @return La page à afficher. */ @GetMapping(CREATOR_MATERIAL) - public String showCreationPage(Model model) { + public String showCreationPage(Model model, Material material) { + model.addAttribute(MATERIAL, material == null ? new Material() : material); model.addAttribute(MATERIAL_TYPES, materialTypeService.getAll()); return CREATOR_MATERIAL; } @@ -77,6 +78,6 @@ public class MaterialCreatorController { model.addAttribute(RESPONSE_ERROR, String.format(MATERIAL_ALREADY_EXIST, material.getMaterialCode())); } - return showCreationPage(model); + return showCreationPage(model, material); } } diff --git a/src/main/java/fyloz/trial/ColorRecipesExplorer/web/controller/creators/MaterialTypeCreatorController.java b/src/main/java/fyloz/trial/ColorRecipesExplorer/web/controller/creators/MaterialTypeCreatorController.java index 630e600..d47653e 100644 --- a/src/main/java/fyloz/trial/ColorRecipesExplorer/web/controller/creators/MaterialTypeCreatorController.java +++ b/src/main/java/fyloz/trial/ColorRecipesExplorer/web/controller/creators/MaterialTypeCreatorController.java @@ -25,7 +25,8 @@ public class MaterialTypeCreatorController { } @GetMapping(CREATOR_MATERIAL_TYPE) - public String showPage() { + public String showPage(Model model, MaterialType materialType) { + model.addAttribute(MATERIAL_TYPE, materialType == null ? new MaterialType() : materialType); return CREATOR_MATERIAL_TYPE; } @@ -41,6 +42,6 @@ public class MaterialTypeCreatorController { model.addAttribute(RESPONSE_ERROR, String.format(MIX_TYPE_ALREADY_USED, materialType.getMaterialTypeName())); } - return showPage(); + return showPage(model, materialType); } } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index a06cf65..98716f3 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -17,7 +17,7 @@ spring.thymeleaf.template-loader-path=classpath:/templates spring.thymeleaf.suffix=.html spring.thymeleaf.cache=false # Messages -spring.messages.cache-duration=1 +spring.messages.fallback-to-system-locale=false #spring.messages.basename=lang/messages #spring.messages.encoding=UTF-8 #server.tomcat.uri-encoding=UTF-8 diff --git a/src/main/resources/lang/messages.properties b/src/main/resources/lang/messages.properties deleted file mode 100644 index 2078aa6..0000000 --- a/src/main/resources/lang/messages.properties +++ /dev/null @@ -1,41 +0,0 @@ -menu.list=Liste -menu.add=Ajouter -menu.edit=Modifier -menu.delete=Supprimer -menu.inventory=Inventaire -menu.others=Autres -recipe.color=Couleur -recipe.description=Courte description -recipe.sample=Échantillon -recipe.approbationDate=Date d'approbation -recipe.remark=Remarque -recipe.notice=Note -recipe.steps=Étapes -keyword.company=Bannière -keyword.material=Produit -keyword.recipe=Recette -keyword.touchUpKitPDF=PDF Kits de retouche -keyword.quantity=Quantité -keyword.type=Type -keyword.units=Unités -keyword.edit=Modifier -keyword.use=Utiliser -keyword.save=Enregistrer -keyword.back=Retour -mix.location=Position -material.code=Code -material.inventoryQuantity=Quantité en inventaire -material.type=Type de produit -material.SIMDUTFile=Fichier SIMDUT -units.milliliters=Millilitres -units.liters=Litres -units.gallons=Gallons -inventory.lowQuantity=Quantité faible -inventory.hideOthers=Cacher les autres produits -inventory.showOnly=Voir seulement -product.error.notFound=Aucun produit n'a été trouvé. -app.title=Explorateur de recettes de couleur -footer.lang=See in english -company.add.title=Ajout d'une bannière -company.success.created=La bannière {0} à été enregistrée. -company.form.companyName=Nom de la bannière diff --git a/src/main/resources/lang/messages_en.properties b/src/main/resources/lang/messages_en.properties index 68d4778..068f951 100644 --- a/src/main/resources/lang/messages_en.properties +++ b/src/main/resources/lang/messages_en.properties @@ -26,16 +26,35 @@ keyword.back=Back mix.location=Location material.code=Code material.inventoryQuantity=Inventory quantity -material.type=Product type +material.type=Material type material.SIMDUTFile=SIMDUT File units.milliliters=Milliliters units.liters=Liters units.gallons=Gallons inventory.lowQuantity=Low quantity -inventory.hideOthers=Hide other products +inventory.hideOthers=Hide other materials inventory.showOnly=Show only -product.error.notFound=No products were found. +material.error.anyFound=No materials were found. app.title=Color recipes explorer footer.lang=Voir en français company.add.title=Adding a banner -company.success.created=The banner {0} has been saved. \ No newline at end of file +company.success.created=The banner {0} has been saved. +keyword.see=See +company.error.anyFound=No banners were found. +recipe.warning.notApproved=This recipe is not approved +company.delete.title=Delete banners +company.success.deleted=The banner {0} has been deleted. +keyword.delete=Delete +material.add.title=Adding a material +material.success.created=The material {0} has been saved. +material.editing.title=Editing {0} +material.delete.title=Delete materials +material.success.deleted=The material {0} has been deleted. +material.success.saved=The material {0} has been saved. +material.edit.title=Edit materials +material.simdut.choose=Choose material's SIMDUT file +materialType.add.title=Add a material type +materialType.name=Material type name +materialType.prefix=Prefix +keyword.characters=characters +materialType.usePercents=Use percentages \ No newline at end of file diff --git a/src/main/resources/static/css/main.css b/src/main/resources/static/css/main.css index a12f46e..a25fbba 100644 --- a/src/main/resources/static/css/main.css +++ b/src/main/resources/static/css/main.css @@ -17,6 +17,7 @@ header, footer { footer { position: fixed; + height: 5%; bottom: 0; padding-top: 10px; } diff --git a/src/main/resources/templates/company/created.html b/src/main/resources/templates/company/created.html index 48ff137..e4660db 100644 --- a/src/main/resources/templates/company/created.html +++ b/src/main/resources/templates/company/created.html @@ -1,8 +1,7 @@ - + - - + @@ -17,7 +16,7 @@ - + diff --git a/src/main/resources/templates/company/creator.html b/src/main/resources/templates/company/creator.html index c6db49c..b33e2be 100644 --- a/src/main/resources/templates/company/creator.html +++ b/src/main/resources/templates/company/creator.html @@ -1,8 +1,7 @@ - + - - + @@ -22,7 +21,7 @@ - + @@ -37,7 +36,7 @@ - + diff --git a/src/main/resources/templates/company/remover.html b/src/main/resources/templates/company/remover.html index 9198275..0e47154 100644 --- a/src/main/resources/templates/company/remover.html +++ b/src/main/resources/templates/company/remover.html @@ -1,11 +1,9 @@ - + - - Supprimer des bannières + - - +