feat: translate backend
All checks were successful
Deploy Production Server / if_merged (pull_request) Successful in 7m23s
All checks were successful
Deploy Production Server / if_merged (pull_request) Successful in 7m23s
This commit is contained in:
@@ -1,32 +1,34 @@
|
||||
package fr.titionfire.ffsaf.utils;
|
||||
|
||||
import fr.titionfire.ffsaf.domain.service.TradService;
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@RegisterForReflection
|
||||
public enum Contact {
|
||||
COURRIEL("Courriel"),
|
||||
TELEPHONE("Téléphone"),
|
||||
SITE("Site web"),
|
||||
FACEBOOK("Facebook"),
|
||||
INSTAGRAM("Instagram"),
|
||||
AUTRE("Autre");
|
||||
COURRIEL,
|
||||
TELEPHONE,
|
||||
SITE,
|
||||
FACEBOOK,
|
||||
INSTAGRAM,
|
||||
AUTRE;
|
||||
|
||||
public String name;
|
||||
|
||||
Contact(String name) {
|
||||
this.name = name;
|
||||
public String getName(TradService trad) {
|
||||
return switch (this) {
|
||||
case COURRIEL -> trad.translate("Contact.COURRIEL");
|
||||
case TELEPHONE -> trad.translate("Contact.TELEPHONE");
|
||||
case SITE -> trad.translate("Contact.SITE");
|
||||
case FACEBOOK -> trad.translate("Contact.FACEBOOK");
|
||||
case INSTAGRAM -> trad.translate("Contact.INSTAGRAM");
|
||||
case AUTRE -> trad.translate("Contact.AUTRE");
|
||||
};
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public static HashMap<String, String> toSite() {
|
||||
public static HashMap<String, String> toSite(TradService trad) {
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
for (Contact contact : Contact.values()) {
|
||||
map.put(contact.toString(), contact.name);
|
||||
map.put(contact.toString(), contact.getName(trad));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user