mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 07:37:25 +01:00
Use helper for backgrounds
This commit is contained in:
@@ -1,7 +1,8 @@
|
|||||||
import {each} from 'lodash';
|
import {each} from 'lodash';
|
||||||
import camelCase from 'lodash.camelcase';
|
import {
|
||||||
import capitalize from 'lodash.capitalize';
|
translator as t,
|
||||||
import {translator as t} from './helpers';
|
formatForTranslator
|
||||||
|
} from './helpers';
|
||||||
|
|
||||||
let sets = {
|
let sets = {
|
||||||
'062014': ['beach', 'fairy_ring', 'forest'],
|
'062014': ['beach', 'fairy_ring', 'forest'],
|
||||||
@@ -29,21 +30,13 @@ each(sets, (names, set) => {
|
|||||||
backgrounds[setName] = {};
|
backgrounds[setName] = {};
|
||||||
|
|
||||||
each(names, (name) => {
|
each(names, (name) => {
|
||||||
let envName = generateEnvName(name);
|
let formattedName = formatForTranslator(name);
|
||||||
|
|
||||||
backgrounds[setName][name] = {
|
backgrounds[setName][name] = {
|
||||||
text: t(`${envName}Text`),
|
text: t(`background${formattedName}Text`),
|
||||||
notes: t(`${envName}Notes`),
|
notes: t(`background${formattedName}Notes`),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function generateEnvName(name) {
|
|
||||||
let camelName = camelCase(name);
|
|
||||||
let capitalCamelName = capitalize(camelName);
|
|
||||||
let backgroundName = `background${capitalCamelName}`;
|
|
||||||
|
|
||||||
return backgroundName;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default backgrounds;
|
export default backgrounds;
|
||||||
|
|||||||
Reference in New Issue
Block a user