@sparklink-pro/apant
Version:
Apollo & Antd tools
24 lines • 822 B
JavaScript
import { isString, mapValues } from 'lodash-es';
// @ts-ignore
import pluriel from 'pluriel';
export const TypeTranslatorFr = (typesMap) => {
const types = mapValues(typesMap, (config) => (isString(config) ? { name: config } : config));
return {
name: (type, count = 1) => {
const baseName = types[type].name;
return count > 1 ? pluriel(baseName) : baseName;
},
article: (type, plural = false) => {
if (plural) {
return 'des';
}
if (types[type].female) {
return 'une';
}
return 'un';
},
pastParticiple: (type, plural = false) => `${types[type].female ? 'e' : ''}${plural ? 's' : ''}`,
};
};
export default TypeTranslatorFr;
//# sourceMappingURL=fr.js.map