Skip to content
Snippets Groups Projects
Commit b192f35c authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms Committed by Elmar Ludwig
Browse files

replace .toLocaleString() with $gettext(), fixes #3027

Closes #3027

Merge request studip/studip!2037
parent bcbe8beb
No related branches found
No related tags found
No related merge requests found
import { $gettext } from '../lib/gettext.js'; import { $gettext, $gettextInterpolate } from '../lib/gettext.js';
// Allow fieldsets to collapse // Allow fieldsets to collapse
$(document).on( $(document).on(
...@@ -313,18 +313,21 @@ STUDIP.ready(function () { ...@@ -313,18 +313,21 @@ STUDIP.ready(function () {
$(this.$el).find('input, select, textarea').each(function () { $(this.$el).find('input, select, textarea').each(function () {
if (!this.validity.valid) { if (!this.validity.valid) {
let note = { let note = {
'name': $(this.labels[0]).find('.textlabel').text(), name: $(this.labels[0]).find('.textlabel').text(),
'description': "Fehler!".toLocaleString(), description: $gettext('Fehler!'),
'describedby': this.id describedby: this.id
}; };
if (this.validity.tooShort) { if (this.validity.tooShort) {
note.description = "Geben Sie mindestens %s Zeichen ein.".toLocaleString().replace("%s", this.minLength); note.description = $gettextInterpolate(
$gettext('Geben Sie mindestens %{min} Zeichen ein.'),
{min: this.minLength}
);
} }
if (this.validity.valueMissing) { if (this.validity.valueMissing) {
if (this.type === 'checkbox') { if (this.type === 'checkbox') {
note.description = "Dieses Feld muss ausgewählt sein.".toLocaleString(); note.description = $gettext('Dieses Feld muss ausgewählt sein.');
} else { } else {
note.description = "Hier muss ein Wert eingetragen werden.".toLocaleString(); note.description = $gettext('Hier muss ein Wert eingetragen werden.');
} }
} }
v.STUDIPFORM_VALIDATIONNOTES.push(note); v.STUDIPFORM_VALIDATIONNOTES.push(note);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment