0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-09-19 23:31:11 +02:00

simplified pluralization logic

Dieser Commit ist enthalten in:
Faizaan Gagan 2021-01-20 14:22:52 +05:30
Ursprung cdfd699491
Commit 7bc7c4013e
2 geänderte Dateien mit 7 neuen und 7 gelöschten Zeilen

Datei anzeigen

@ -3,14 +3,13 @@ import I18n from "I18n";
export default registerUnbound("char-counter", function(body, maxLength) {
let bodyLength = body ? body.length : 0;
let length = maxLength || bodyLength;
let characterString = length == 1 ? 'wizard.character' : 'wizard.characters';
let finalString;
if(maxLength) {
finalString = `<div class="body-length">${bodyLength} / ${maxLength} ${ I18n.t(characterString)}</div>`;
if (maxLength) {
finalString = `<div class="body-length">${bodyLength} / ${I18n.t('wizard.x_characters', { count: parseInt(maxLength) })}</div>`;
} else {
finalString = `<div class="body-length">${bodyLength} ${ I18n.t(characterString)}</div>`;
finalString = `<div class="body-length">${I18n.t('wizard.x_characters', { count: parseInt(bodyLength) })}</div>`;
}
return new Handlebars.SafeString(finalString);
});

Datei anzeigen

@ -471,8 +471,9 @@ en:
requires_login: "You need to be logged in to access this wizard."
reset: "Reset this wizard."
step_not_permitted: "You're not permitted to view this step."
characters: "Characters"
character: "Character"
x_characters:
one: "%{count} Character"
other: "%{count} Characters"
wizard_composer:
show_preview: "Preview Post"