1
0
mirror of https://github.com/keeweb/keeweb.git synced 2024-06-25 07:37:46 +02:00
keeweb/app/scripts/hbs-helpers/res.js
2021-02-01 22:24:53 +01:00

26 lines
652 B
JavaScript

import Handlebars from 'hbs';
import { Locale } from 'util/locale';
Handlebars.registerHelper('res', function (key, options) {
let value = Locale[key];
if (value) {
const ix = value.indexOf('{}');
if (ix >= 0) {
value = value.replace('{}', options.fn(this));
}
}
return value;
});
Handlebars.registerHelper('Res', (key, options) => {
let value = Locale[key];
if (value) {
value = value[0].toUpperCase() + value.substr(1);
const ix = value.indexOf('{}');
if (ix >= 0) {
value = value.replace('{}', options.fn(this));
}
}
return value;
});