5180 fichiers 38.5 Mo 0 téléchargements 238 vues mis à jour il y a 5 heures ui
nitro-v36-with-renderer-v36 / src / api / housekeeping / HousekeepingActionLabel.ts
HousekeepingActionLabel.ts 1.1 Ko Télécharger le fichier
import { LocalizeText } from '../utils/LocalizeText';

/** "user.ban" -> the localized "housekeeping.audit.action.user.ban", or the raw key when untranslated. */
export const localizeHousekeepingAction = (action: string): string => {
    const key = `housekeeping.audit.action.${action}`;
    const text = LocalizeText(key);

    return text && text !== key ? text : action;
};

/**
 * Name and reason of a sanction template in the operator's language: the text
 * files translate "housekeeping.template.<id>.name" / ".reason", and a template
 * without a translation keeps its own text.
 */
export const localizeSanctionTemplate = (template: { id: string; name: string; defaultReason: string }): { name: string; reason: string } => {
    const nameKey = `housekeeping.template.${template.id}.name`;
    const reasonKey = `housekeeping.template.${template.id}.reason`;
    const name = LocalizeText(nameKey);
    const reason = LocalizeText(reasonKey);

    return { name: name && name !== nameKey ? name : template.name, reason: reason && reason !== reasonKey ? reason : template.defaultReason };
};
15Sujets
1Dépôts
20Membres
2En ligne
Profile
Inscrit
Dernière visite
Messages
0
Votes positifs
0
Votes négatifs
0

Nous utilisons des cookies pour assurer le bon fonctionnement du site et améliorer votre expérience. en savoir plus

Autoriser