feat(MoneyHistoryView): enhance activity translation for tax and reputation actions
All checks were successful
Deploy to production / deploy (push) Successful in 2m7s

- Added translation logic for activities related to tax from sales branches and reputation actions in the MoneyHistoryView component.
- Updated internationalization files to include new strings for these activities in multiple languages.
This commit is contained in:
Torsten Schulz (local)
2026-04-30 15:41:00 +02:00
parent c6ffdd10f7
commit 3365f1dd2a
16 changed files with 126 additions and 22 deletions

View File

@@ -127,26 +127,29 @@ export async function createTriggers() {
const updateMoney = `
CREATE OR REPLACE FUNCTION falukant_data.update_money(
p_falukant_user_id integer,
p_money_change numeric,
p_activity text,
p_changed_by integer DEFAULT NULL
p_money_change numeric,
p_activity text,
p_changed_by integer DEFAULT NULL::integer
)
RETURNS void
LANGUAGE plpgsql
AS $function$
DECLARE
v_money_before numeric(10,2);
v_money_after numeric(10,2);
v_money_before numeric(14,2);
v_money_after numeric(14,2);
v_moneyflow_id bigint;
BEGIN
SELECT money
INTO v_money_before
FROM falukant_data.falukant_user
WHERE id = p_falukant_user_id;
INTO v_money_before
FROM falukant_data.falukant_user
WHERE id = p_falukant_user_id;
IF NOT FOUND THEN
RAISE EXCEPTION 'FalukantUser mit ID % nicht gefunden', p_falukant_user_id;
END IF;
v_money_after := v_money_before + p_money_change;
INSERT INTO falukant_log.moneyflow (
falukant_user_id,
activity,
@@ -160,22 +163,24 @@ export async function createTriggers() {
p_falukant_user_id,
p_activity,
v_money_before,
NULL, -- Wird gleich aktualisiert
NULL, -- wird gleich aktualisiert
p_money_change,
p_changed_by,
NOW()
)
RETURNING id INTO v_moneyflow_id;
UPDATE falukant_data.falukant_user
SET money = v_money_after
WHERE id = p_falukant_user_id;
SET money = v_money_after
WHERE id = p_falukant_user_id;
UPDATE falukant_log.moneyflow
SET money_after = (
SELECT money
FROM falukant_data.falukant_user
SET money_after = (
SELECT money
FROM falukant_data.falukant_user
WHERE id = p_falukant_user_id
)
WHERE id = v_moneyflow_id;
)
WHERE id = v_moneyflow_id;
END;
$function$;
`;

View File

@@ -22,6 +22,10 @@
"view": {
"loading": "Nag-load…",
"edit": "Usba",
"reportBlog": "I-report ang blog",
"reportPost": "I-report ang post",
"reportBlogSent": "Na-report na ang blog sa moderation.",
"reportPostSent": "Na-report na ang post sa moderation.",
"entriesCount": "{count} ka entry",
"empty": "Walay mga entry.",
"fallbackDescription": "Public nga community blog sa YourPart.",

View File

@@ -339,6 +339,8 @@
"new nobility title": "Bag-ong titulo sa kadungganan",
"partyOrder": "Gi-order ang party",
"renovation_all": "Kompleto nga gi-renovate ang balay",
"taxFromSalesBranch": "Buhis gikan sa sales branch {branchId}",
"reputationAction": "Aksyon sa reputasyon: {action}",
"Buy storage (type: field)": "Bought tipigan (type: field)",
"Buy storage (type: iron)": "Bought tipigan (type: iron)",
"Buy storage (type: stone)": "Bought tipigan (type: stone)",
@@ -1238,6 +1240,8 @@
"running": "Running...",
"dailyLimit": "Daily limit: {remaining} sa {cap} actions remaining",
"cooldown": "Cooldown: {minutes} minutes remaining",
"success": "Malampuson ang aksyon. Reputasyon: +{gain}, Gasto: {cost}",
"successSimple": "Malampuson ang aksyon.",
"type": {
"soup_kitchen": "Comedor social",
"library_donation": "Donasyon sa library",

View File

@@ -67,6 +67,7 @@
"m-administration": {
"contactrequests": "Mga hangyo sa kontak",
"moderationReports": "Mga report sa moderasyon",
"moderationBadgeTitle": "Abli nga mga report sa moderasyon",
"users": "Mga user",
"userrights": "Mga katungod sa user",
"m-users": {

View File

@@ -127,8 +127,12 @@
"imageUpload": "Hulagway",
"submit": "Ipadala ang entry",
"noEntries": "Walay entry nga nakit-an",
"entryImageAlt": "Hulagway sa entry sa libro sa bisita"
"entryImageAlt": "Hulagway sa entry sa libro sa bisita",
"reportEntry": "I-report",
"deleteEntry": "Tangtanga",
"confirmDeleteEntry": "Tangtangon ba gyud kini nga entry sa libro sa bisita?"
},
"reportProfile": "I-report ang username/profile",
"interestedInGender": "Interesado sa",
"hasChildren": "Naay mga anak",
"smokes": "Pagpanigarilyo",
@@ -200,7 +204,8 @@
"title": "Hulagway"
},
"imagePreviewAlt": "Preview sa hulagway",
"imageLoadingAlt": "Nag-load ang hulagway"
"imageLoadingAlt": "Nag-load ang hulagway",
"reportImage": "I-report ang hulagway"
},
"guestbook": {
"kicker": "Libro sa bisita",
@@ -210,6 +215,14 @@
"nextPage": "Sunod",
"page": "Panid"
},
"reporting": {
"reasonPrompt": "Mubo nga rason sa report (pananglitan: spam, insulto, hate speech):",
"reasonTooShort": "Palihog butangi ug labing menos 3 ka karakter ang rason sa report.",
"profileReported": "Na-report na ang profile sa moderation.",
"imageReported": "Na-report na ang hulagway sa moderation.",
"guestbookReported": "Na-report na ang entry sa libro sa bisita sa moderation.",
"reportError": "Napakyas ang pagpadala sa report."
},
"diary": {
"kicker": "Personal nga mga entry",
"intro": "Mga hunahuna, nota ug mubo nga update sa usa ka malinawon ug personal nga tan-aw.",

View File

@@ -943,6 +943,8 @@
"new nobility title": "Neuer Adelstitel",
"partyOrder": "Fest bestellt",
"renovation_all": "Haus komplett renoviert",
"taxFromSalesBranch": "Steuer aus Verkaufsfiliale {branchId}",
"reputationAction": "Reputations-Aktion: {action}",
"health": {
"pill": "Gesundheitsmaßnahme: Tablette",
"doctor": "Gesundheitsmaßnahme: Arztbesuch",
@@ -1199,6 +1201,8 @@
"running": "Läuft...",
"dailyLimit": "Tägliches Limit: {remaining} von {cap} Aktionen übrig",
"cooldown": "Cooldown: Noch {minutes} Minuten",
"success": "Aktion erfolgreich ausgeführt. Ansehen: +{gain}, Kosten: {cost}",
"successSimple": "Aktion erfolgreich ausgeführt.",
"type": {
"soup_kitchen": "Suppenküche",
"library_donation": "Bibliotheksspende",

View File

@@ -318,6 +318,8 @@
"new nobility title": "New title of nobility",
"partyOrder": "Party ordered",
"renovation_all": "House fully renovated",
"taxFromSalesBranch": "Tax from sales branch {branchId}",
"reputationAction": "Reputation action: {action}",
"health": {
"pill": "Health measure: pill",
"doctor": "Health measure: doctor",
@@ -1190,6 +1192,8 @@
"running": "Running...",
"dailyLimit": "Daily limit: {remaining} of {cap} actions remaining",
"cooldown": "Cooldown: {minutes} minutes remaining",
"success": "Action executed successfully. Reputation: +{gain}, Cost: {cost}",
"successSimple": "Action executed successfully.",
"type": {
"soup_kitchen": "Soup Kitchen",
"library_donation": "Library Donation",

View File

@@ -22,6 +22,10 @@
"view": {
"loading": "Cargando…",
"edit": "Editar",
"reportBlog": "Reportar blog",
"reportPost": "Reportar entrada",
"reportBlogSent": "El blog se ha reportado a moderación.",
"reportPostSent": "La entrada se ha reportado a moderación.",
"entriesCount": "{count} entradas",
"empty": "No hay entradas.",
"fallbackDescription": "Blog público de la comunidad en YourPart.",

View File

@@ -943,6 +943,8 @@
"new nobility title": "Nuevo título nobiliario",
"partyOrder": "Festín encargado",
"renovation_all": "Casa renovada por completo",
"taxFromSalesBranch": "Impuesto de la sucursal de ventas {branchId}",
"reputationAction": "Acción de reputación: {action}",
"health": {
"pill": "Medida de salud: pastilla",
"doctor": "Medida de salud: visita al médico",
@@ -1199,6 +1201,8 @@
"running": "En curso…",
"dailyLimit": "Límite diario: quedan {remaining} de {cap} acciones",
"cooldown": "Enfriamiento: aún {minutes} minutos",
"success": "Acción ejecutada correctamente. Reputación: +{gain}, Coste: {cost}",
"successSimple": "Acción ejecutada correctamente.",
"type": {
"soup_kitchen": "Comedor social",
"library_donation": "Donación a la biblioteca",

View File

@@ -67,6 +67,7 @@
"m-administration": {
"contactrequests": "Solicitudes de contacto",
"moderationReports": "Reportes de moderación",
"moderationBadgeTitle": "Reportes de moderación abiertos",
"users": "Usuarios",
"userrights": "Permisos de usuario",
"m-users": {

View File

@@ -126,8 +126,12 @@
"imageUpload": "Imagen",
"submit": "Enviar entrada",
"noEntries": "No se han encontrado entradas",
"entryImageAlt": "Imagen de la entrada del libro de visitas"
"entryImageAlt": "Imagen de la entrada del libro de visitas",
"reportEntry": "Reportar",
"deleteEntry": "Eliminar",
"confirmDeleteEntry": "¿Eliminar esta entrada del libro de visitas?"
},
"reportProfile": "Reportar nombre de usuario/perfil",
"interestedInGender": "Interesado/a en",
"hasChildren": "Tiene hijos",
"smokes": "Fuma",
@@ -199,7 +203,8 @@
"title": "Imagen"
},
"imagePreviewAlt": "Vista previa de la imagen",
"imageLoadingAlt": "Cargando imagen"
"imageLoadingAlt": "Cargando imagen",
"reportImage": "Reportar imagen"
},
"guestbook": {
"kicker": "Libro de visitas",
@@ -209,6 +214,14 @@
"nextPage": "Siguiente",
"page": "Página"
},
"reporting": {
"reasonPrompt": "Motivo breve del reporte (p. ej. spam, insultos, discurso de odio):",
"reasonTooShort": "Introduce al menos 3 caracteres como motivo del reporte.",
"profileReported": "El perfil se ha reportado a moderación.",
"imageReported": "La imagen se ha reportado a moderación.",
"guestbookReported": "La entrada del libro de visitas se ha reportado a moderación.",
"reportError": "No se pudo enviar el reporte."
},
"diary": {
"kicker": "Entradas personales",
"intro": "Pensamientos, notas y pequeñas actualizaciones en una vista tranquila y personal.",

View File

@@ -22,6 +22,10 @@
"view": {
"loading": "Charger…",
"edit": "Modifier",
"reportBlog": "Signaler le blog",
"reportPost": "Signaler l'entrée",
"reportBlogSent": "Le blog a été signalé à la modération.",
"reportPostSent": "L'entrée a été signalée à la modération.",
"entriesCount": "{count} entrées",
"empty": "Aucune entrée disponible.",
"fallbackDescription": "Blog communautaire public sur YourPart.",

View File

@@ -932,6 +932,8 @@
"new nobility title": "Nouveau titre de noblesse",
"partyOrder": "Fermement commandé",
"renovation_all": "Maison entièrement rénovée",
"taxFromSalesBranch": "Taxe de la succursale de vente {branchId}",
"reputationAction": "Action de réputation : {action}",
"health": {
"pill": "Mesure sanitaire : tablette",
"doctor": "Mesure sanitaire : Visite chez le médecin",
@@ -1188,6 +1190,8 @@
"running": "En cours d'exécution...",
"dailyLimit": "Limite quotidienne : {remaining} sur {cap} actions restantes",
"cooldown": "Temps de recharge : {minutes} minutes restantes",
"success": "Action exécutée avec succès. Réputation : +{gain}, Coût : {cost}",
"successSimple": "Action exécutée avec succès.",
"type": {
"soup_kitchen": "Soupe populaire",
"library_donation": "Don à la bibliothèque",

View File

@@ -67,6 +67,7 @@
"m-administration": {
"contactrequests": "Kontaktanfragen",
"moderationReports": "Signalements de modération",
"moderationBadgeTitle": "Signalements de modération ouverts",
"users": "Benutzer",
"userrights": "Benutzerrechte",
"m-users": {

View File

@@ -126,8 +126,12 @@
"imageUpload": "Bild",
"submit": "Soumettre l'entrée",
"noEntries": "Aucune entrée trouvée",
"entryImageAlt": "Image pour l'entrée du livre d'or"
"entryImageAlt": "Image pour l'entrée du livre d'or",
"reportEntry": "Signaler",
"deleteEntry": "Supprimer",
"confirmDeleteEntry": "Supprimer cette entrée du livre d'or ?"
},
"reportProfile": "Signaler nom d'utilisateur/profil",
"interestedInGender": "Intéressé par",
"hasChildren": "A des enfants",
"smokes": "Fumée",
@@ -199,7 +203,8 @@
"title": "Bild"
},
"imagePreviewAlt": "Aperçu de l'image",
"imageLoadingAlt": "L'image est en cours de chargement"
"imageLoadingAlt": "L'image est en cours de chargement",
"reportImage": "Signaler l'image"
},
"guestbook": {
"kicker": "Livre d'or",
@@ -209,6 +214,14 @@
"nextPage": "Plus loin",
"page": "Page"
},
"reporting": {
"reasonPrompt": "Raison courte du signalement (p. ex. spam, insulte, discours haineux) :",
"reasonTooShort": "Veuillez saisir au moins 3 caractères comme raison du signalement.",
"profileReported": "Le profil a été signalé à la modération.",
"imageReported": "L'image a été signalée à la modération.",
"guestbookReported": "L'entrée du livre d'or a été signalée à la modération.",
"reportError": "Le signalement n'a pas pu être envoyé."
},
"diary": {
"kicker": "Entrées personnelles",
"intro": "Réflexions, notes et mises à jour rapides dans une vue calme et personnelle.",

View File

@@ -95,6 +95,31 @@ export default {
}
},
translateActivity(activity) {
if (typeof activity === 'string') {
const taxMatch = activity.match(/^tax from sales branch\s+(\d+)$/i);
if (taxMatch) {
return this.$t('falukant.moneyHistory.activities.taxFromSalesBranch', {
branchId: taxMatch[1],
});
}
const reputationMatch = activity.match(/^reputation action:\s*(.+)$/i);
if (reputationMatch) {
const actionKey = String(reputationMatch[1] || '').trim();
let actionLabel = actionKey;
if (actionKey) {
const reputationKey = `falukant.reputation.actions.type.${actionKey}`;
const reputationTranslation = this.$t(reputationKey);
if (reputationTranslation !== reputationKey) {
actionLabel = reputationTranslation;
}
}
return this.$t('falukant.moneyHistory.activities.reputationAction', {
action: actionLabel,
});
}
}
const candidates = [activity];
if (typeof activity === 'string') {