Ghost/ghost/admin/app/helpers/humanize-setting-key.js
Kevin Ansfield 4fa13bfa9f Fixed capitalization of API and CTA in theme setting labels
no issue

- added `{{humanize-setting-key}}` helper that uses the base `humanize` output but then forces capitalization for known acronyms
- updated `<CustomThemeSettings::Select>` to use the new helper
2021-10-12 10:11:24 +01:00

17 lines
465 B
JavaScript

import {helper} from '@ember/component/helper';
import {humanize} from 'ember-cli-string-helpers/helpers/humanize';
export function humanizeSettingKey([key]) {
let humanized = humanize([key]);
const allCaps = ['API', 'CTA'];
allCaps.forEach((str) => {
const regex = new RegExp(`(^| )(${str})( |$)`, 'gi');
humanized = humanized.replace(regex, `$1${str}$3`);
});
return humanized;
}
export default helper(humanizeSettingKey);