Skip to content
Snippets Groups Projects
Commit 366f1f46 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms
Browse files

fix translation using gettextInterpolate(), fixes #1062

Closes #1062

Merge request studip/studip!1099
parent 225a8fdb
No related branches found
No related tags found
No related merge requests found
Showing
with 155 additions and 47 deletions
import { $gettextInterpolate } from '../lib/gettext.js';
import { $gettext, $gettextInterpolate } from '../lib/gettext.js';
STUDIP.domReady(() => {
$('del.diffdel').each(function() {
......@@ -44,7 +44,10 @@ STUDIP.domReady(() => {
senddata,
function(data) {
if (data) {
var info = $gettextInterpolate('Entfernt von %{user} am %{time}', data);
var info = $gettextInterpolate(
$gettext('Entfernt von %{user} am %{time}'),
data
);
del.attr('title', info);
$('<del class="difflog"/>').text(` [${info}] `).insertAfter(del);
}
......@@ -137,7 +140,10 @@ STUDIP.domReady(() => {
senddata,
function(data) {
if (data) {
var info = $gettextInterpolate('Änderung durch %{user} am %{time}', data);
var info = $gettextInterpolate(
$gettext('Änderung durch %{user} am %{time}'),
data
);
ins.attr('title', info);
$('<ins class="difflog"/>').text(` [${info}] `).insertAfter(ins);
}
......@@ -169,7 +175,10 @@ STUDIP.domReady(() => {
);
function onSuccess(data) {
if (data) {
var info = $gettextInterpolate('Hinzugefügt von %{user} am %{time}', data);
var info = $gettextInterpolate(
$gettext('Hinzugefügt von %{user} am %{time}'),
data
);
curtable.attr('title', info);
const log = $('<ins class="difflog"/>').text(` [${info}] `);
const cell = $('<td/>').append(log);
......@@ -201,7 +210,10 @@ STUDIP.domReady(() => {
);
function onSuccess(data) {
if (data) {
var info = $gettextInterpolate('Entfernt von %{user} am %{time}', data);
var info = $gettextInterpolate(
$gettext('Entfernt von %{user} am %{time}'),
data
);
curtable.attr('title', info);
const log = $('<del class="difflog"/>').text(` [${info}] `);
const cell = $('<td/>').append(log);
......
......@@ -6,7 +6,7 @@
<studip-icon v-if="item.icon" :shape="item.icon" role="info" size="20" class="text-bottom" alt=""></studip-icon>
<input v-if="name" type="hidden" :name="name + '[]'" :value="item.value">
<span>{{item.name}}</span>
<button v-if="item.deletable" @click.prevent="deleteItem(item)" :title="$gettextInterpolate('%{ name } löschen', {name: item.name})" class="undecorated">
<button v-if="item.deletable" @click.prevent="deleteItem(item)" :title="$gettextInterpolate($gettext('%{ name } löschen'), {name: item.name})" class="undecorated">
<studip-icon shape="trash" role="clickable" size="20" class="text-bottom"></studip-icon>
</button>
</li>
......
......@@ -33,7 +33,10 @@ export default {
return classes;
},
getTitle (i, index) {
let title = this.$gettextInterpolate('Gruppe %{ group }', {group: i});
let title = this.$gettextInterpolate(
this.$gettext('Gruppe %{ group }'),
{group: i}
);
if (this.course.group === index) {
title += ' (' + this.$gettext('ausgewählt') + ')';
}
......
......@@ -71,7 +71,10 @@ export default {
});
let selection_header = document.createElement('div');
selection_header.setAttribute('id', this.count_text_id);
selection_header.innerText = this.$gettextInterpolate('Sie haben %{ count } Personen ausgewählt', {count: this.count});
selection_header.innerText = this.$gettextInterpolate(
this.$gettext('Sie haben %{ count } Personen ausgewählt'),
{count: this.count}
);
$('#' + this.select_box_id).multiSelect({
selectableHeader: '<div>' + this.$gettext('Suchergebnisse') + '</div>',
......@@ -105,7 +108,10 @@ export default {
if (searchcount === 0) {
view.append(
'--',
view.$gettextInterpolate('Es wurden keine neuen Ergebnisse für "%{ needle }" gefunden.', {needle: view.searchTerm}),
view.$gettextInterpolate(
view.$gettext('Es wurden keine neuen Ergebnisse für "%{ needle }" gefunden.'),
{needle: view.searchTerm}
),
true
);
view.refresh();
......@@ -158,7 +164,10 @@ export default {
updateCount(){
this.count = $('#' + this.select_box_id + ' option:enabled:selected').length;
$('#' + this.count_text_id).text(this.$gettextInterpolate('Sie haben %{ count } Personen ausgewählt', {count: this.count}));
$('#' + this.count_text_id).text(this.$gettextInterpolate(
this.$gettext('Sie haben %{ count } Personen ausgewählt'),
{count: this.count}
));
},
async updateSelection() {
......
......@@ -178,7 +178,12 @@ export default {
async deleteElement() {
await this.loadStructuralElement(this.currentId);
if (this.blockedByAnotherUser) {
this.companionInfo({ info: this.$gettextInterpolate('Löschen nicht möglich, da %{blockingUserName} die Seite bearbeitet.', {blockingUserName: this.blockingUserName}) });
this.companionInfo({
info: this.$gettextInterpolate(
this.$gettext('Löschen nicht möglich, da %{blockingUserName} die Seite bearbeitet.'),
{blockingUserName: this.blockingUserName}
)
});
return false;
}
......
......@@ -42,7 +42,7 @@
<td class="perm">
<input
class="right"
:title="$gettextInterpolate('Leserechte für %{ userName }', { userName: user_perm.username })"
:title="$gettextInterpolate($gettext('Leserechte für %{ userName }'), { userName: user_perm.username })"
type="radio"
:name="`${user_perm.id}_right`"
value="read"
......@@ -53,7 +53,7 @@
<td class="perm">
<input
class="right"
:title="$gettextInterpolate('Lese- und Schreibrechte für %{ userName }', { userName: user_perm.username })"
:title="$gettextInterpolate($gettext('Lese- und Schreibrechte für %{ userName }'), { userName: user_perm.username })"
type="radio"
:name="`${user_perm.id}_right`"
value="write"
......@@ -75,7 +75,7 @@
<td class="actions">
<button
class="cw-permission-delete"
:title="$gettextInterpolate('Entfernen der Rechte von %{ userName }', { userName: user_perm.username })"
:title="$gettextInterpolate($gettext('Entfernen der Rechte von %{ userName }'), { userName: user_perm.username })"
@click.prevent="confirmDeleteUserPerm(index)"
>
</button>
......@@ -211,9 +211,15 @@ export default {
getExpiryTitle(userName, date) {
if (date) {
return this.$gettextInterpolate('Die Berechtigungen für %{ userName } laufen am folgendem Datum ab: %{ dateStr }', { userName: userName, dateStr: new Date(date).toLocaleDateString() })
return this.$gettextInterpolate(
this.$gettext('Die Berechtigungen für %{ userName } laufen am folgendem Datum ab: %{ dateStr }'),
{ userName: userName, dateStr: new Date(date).toLocaleDateString() }
);
} else {
return this.$gettextInterpolate('Das Ablaufdatum der Berechtigungen für %{ userName }', { userName: userName });
return this.$gettextInterpolate(
this.$gettext('Das Ablaufdatum der Berechtigungen für %{ userName }'),
{ userName: userName }
);
}
},
......
......@@ -74,7 +74,7 @@
<studip-dialog
v-if="showClearReleases"
:title="$gettext('Löschen der Freigabe')"
:question="$gettextInterpolate('Möchten Sie die Freigabe für %{ pageTitle} wirklich löschen?', {pageTitle: this.selectedElement.attributes.title})"
:question="$gettextInterpolate($gettext('Möchten Sie die Freigabe für %{ pageTitle} wirklich löschen?'), {pageTitle: this.selectedElement.attributes.title})"
height="220"
@confirm="clearReleases"
@close="closeClearReleases"
......
......@@ -19,7 +19,7 @@
</a>
</nav>
<div v-if="selected" class="cw-dashboard-progress-chapter">
<a :href="chapterUrl" :title="$gettextInterpolate('%{ pageTitle } öffnen', {pageTitle: selected.name})">
<a :href="chapterUrl" :title="$gettextInterpolate($gettext('%{ pageTitle } öffnen'), {pageTitle: selected.name})">
<h1>{{ selected.name }}</h1>
</a>
<courseware-progress-circle
......
......@@ -7,7 +7,7 @@
<studip-icon v-if="blockedByAnotherUser" shape="lock-locked" />
<span>{{ blockTitle }}</span>
<span v-if="blockedByAnotherUser" class="cw-default-block-blocker-warning">
| {{ $gettextInterpolate('wird im Moment von %{ userName } bearbeitet', { userName: this.blockingUserName }) }}
| {{ $gettextInterpolate($gettext('wird im Moment von %{ userName } bearbeitet'), { userName: this.blockingUserName }) }}
</span>
<span v-if="!block.attributes.visible" class="cw-default-block-invisible-info">
......@@ -253,7 +253,12 @@ export default {
}
if (this.blockedByAnotherUser) {
this.companionWarning({ info: this.$gettextInterpolate('Ihre Änderungen konnten nicht gespeichert werden, da %{blockingUserName} die Bearbeitung übernommen hat.', {blockingUserName: this.blockingUserName}) });
this.companionWarning({
info: this.$gettextInterpolate(
this.$gettext('Ihre Änderungen konnten nicht gespeichert werden, da %{blockingUserName} die Bearbeitung übernommen hat.'),
{blockingUserName: this.blockingUserName}
)
});
this.displayFeature(false);
this.$emit('closeEdit');
}
......@@ -280,7 +285,12 @@ export default {
if (this.blockedByThisUser) {
this.showDeleteDialog = true;
} else {
this.companionInfo({ info: this.$gettextInterpolate('Löschen nicht möglich, da %{blockingUserName} den Block bearbeitet.', {blockingUserName: this.blockingUserName}) });
this.companionInfo({
info: this.$gettextInterpolate(
this.$gettext('Löschen nicht möglich, da %{blockingUserName} den Block bearbeitet.'),
{blockingUserName: this.blockingUserName}
)
});
}
}
},
......@@ -294,7 +304,12 @@ export default {
async executeDelete() {
await this.loadBlock({ id: this.block.id, options: { include: 'edit-blocker' } });
if (this.blockedByAnotherUser) {
this.companionInfo({ info: this.$gettextInterpolate('Löschen nicht möglich, da %{blockingUserName} die Bearbeitung übernommen hat.', {blockingUserName: this.blockingUserName}) });
this.companionInfo({
info: this.$gettextInterpolate(
this.$gettext('Löschen nicht möglich, da %{blockingUserName} die Bearbeitung übernommen hat.'),
{blockingUserName: this.blockingUserName}
)
});
return false;
}
const containerId = this.block.relationships.container.data.id;
......
......@@ -8,7 +8,7 @@
<studip-icon v-if="blockedByAnotherUser" shape="lock-locked" />
<span>{{ container.attributes.title }} ({{container.attributes.width}})</span>
<span v-if="blockedByAnotherUser" class="cw-default-container-blocker-warning">
| {{ $gettextInterpolate('wird im Moment von %{ userName } bearbeitet', { userName: this.blockingUserName }) }}
| {{ $gettextInterpolate($gettext('wird im Moment von %{ userName } bearbeitet'), { userName: this.blockingUserName }) }}
</span>
<courseware-container-actions
:canEdit="canEdit"
......@@ -164,7 +164,12 @@ export default {
this.$emit('storeContainer');
}
if (this.blockedByAnotherUser) {
this.companionWarning({ info: this.$gettextInterpolate('Ihre Änderungen konnten nicht gespeichert werden, da %{blockingUserName} die Bearbeitung übernommen hat.', {blockingUserName: this.blockingUserName}) });
this.companionWarning({
info: this.$gettextInterpolate(
this.$gettext('Ihre Änderungen konnten nicht gespeichert werden, da %{blockingUserName} die Bearbeitung übernommen hat.'),
{blockingUserName: this.blockingUserName}
)
});
this.$emit('closeEdit');
}
if (this.blockerId === null) {
......@@ -182,7 +187,12 @@ export default {
if (this.blockedByThisUser) {
this.showDeleteDialog = true;
} else {
this.companionInfo({ info: this.$gettextInterpolate('Löschen nicht möglich, da %{blockingUserName} den Abschnitt bearbeitet.', {blockingUserName: this.blockingUserName}) });
this.companionInfo({
info: this.$gettextInterpolate(
this.$gettext('Löschen nicht möglich, da %{blockingUserName} den Abschnitt bearbeitet.'),
{blockingUserName: this.blockingUserName}
)
});
}
}
},
......@@ -196,7 +206,12 @@ export default {
async executeDelete() {
await this.loadContainer({ id: this.container.id, options: { include: 'edit-blocker' } });
if (this.blockedByAnotherUser) {
this.companionInfo({ info: this.$gettextInterpolate('Löschen nicht möglich, da %{blockingUserName} die Bearbeitung übernommen hat.', {blockingUserName: this.blockingUserName}) });
this.companionInfo({
info: this.$gettextInterpolate(
this.$gettext('Löschen nicht möglich, da %{blockingUserName} die Bearbeitung übernommen hat.'),
{blockingUserName: this.blockingUserName}
)
});
return false;
}
await this.deleteContainer({
......
......@@ -243,9 +243,15 @@ export default {
let title = this.elementName;
if (this.elementInserterActive && this.moveSelfPossible && this.canEdit) {
if (this.isRemote || this.isOwn) {
title = this.$gettextInterpolate('%{ elementTitle } kopieren', {elementTitle: this.elementName});
title = this.$gettextInterpolate(
this.$gettext('%{ elementTitle } kopieren'),
{elementTitle: this.elementName}
);
} else {
title = this.$gettextInterpolate('%{ elementTitle } verschieben', {elementTitle: this.elementName});
title = this.$gettextInterpolate(
this.$gettext('%{ elementTitle } verschieben'),
{elementTitle: this.elementName}
);
}
}
......@@ -400,7 +406,10 @@ export default {
elementId: element.id,
migrate: false
}).catch((error) => {
let message = this.$gettextInterpolate('%{ pageTitle } konnte nicht kopiert werden.', {pageTitle: element.attributes.title});
let message = this.$gettextInterpolate(
this.$gettext('%{ pageTitle } konnte nicht kopiert werden.'),
{pageTitle: element.attributes.title}
);
this.text.copyProcessFailed.push(message);
this.showFailedCopyProcessCompanion();
});
......@@ -412,7 +421,10 @@ export default {
parentId: parentId,
elementId: element.id,
}).catch((error) => {
let message = this.$gettextInterpolate('%{ pageTitle } konnte nicht verknüpft werden.', {pageTitle: element.attributes.title});
let message = this.$gettextInterpolate(
this.$gettext('%{ pageTitle } konnte nicht verknüpft werden.'),
{pageTitle: element.attributes.title}
);
this.text.linkProcessFailed.push(message);
this.showFailedLinkProcessCompanion();
});
......@@ -449,7 +461,10 @@ export default {
parentId: parentId,
container: container,
}).catch((error) => {
let message = this.$gettextInterpolate('Abschnitt "%{ containerTitle }" konnte nicht kopiert werden', {containerTitle: container.attributes.title});
let message = this.$gettextInterpolate(
this.$gettext('Abschnitt "%{ containerTitle }" konnte nicht kopiert werden'),
{containerTitle: container.attributes.title}
);
this.text.copyProcessFailed.push(message);
this.showFailedCopyProcessCompanion();
});
......@@ -512,7 +527,10 @@ export default {
parentId: parentId,
block: block,
}).catch((error) => {
let message = this.$gettextInterpolate('Block "%{ blockTitle }" konnte nicht kopiert werden', {blockTitle: block.attributes.title});
let message = this.$gettextInterpolate(
this.$gettext('Block "%{ blockTitle }" konnte nicht kopiert werden'),
{blockTitle: block.attributes.title}
);
this.text.copyProcessFailed.push(message);
this.showFailedCopyProcessCompanion();
});
......
......@@ -87,9 +87,15 @@ export default {
let title = this.element.attributes.title;
if (this.inserter) {
if (this.type === 'remote' || this.type === 'own') {
title = this.$gettextInterpolate('%{ elementTitle } kopieren', {elementTitle: this.element.attributes.title});
title = this.$gettextInterpolate(
this.$gettext('%{ elementTitle } kopieren'),
{elementTitle: this.element.attributes.title}
);
} else {
title = this.$gettextInterpolate('%{ elementTitle } verschieben', {elementTitle: this.element.attributes.title});
title = this.$gettextInterpolate(
this.$gettext('%{ elementTitle } verschieben'),
{elementTitle: this.element.attributes.title}
);
}
}
......
......@@ -78,7 +78,7 @@
<div v-if="structuralElementLoaded" class="cw-companion-box-wrapper">
<courseware-companion-box
v-if="blockedByAnotherUser"
:msgCompanion="$gettextInterpolate('Die Einstellungen dieser Seite werden im Moment von %{blockingUserName} bearbeitet', {blockingUserName: blockingUserName})"
:msgCompanion="$gettextInterpolate($gettext('Die Einstellungen dieser Seite werden im Moment von %{blockingUserName} bearbeitet'), {blockingUserName: blockingUserName})"
mood="pointing"
>
<template #companionActions>
......@@ -125,7 +125,7 @@
/>
<courseware-companion-box
v-if="editView"
:msgCompanion="$gettextInterpolate('Dieser Inhalt ist aus den persönlichen Lerninhalten von %{ ownerName } verlinkt und kann nur dort bearbeitet werden.', { ownerName: ownerName })"
:msgCompanion="$gettextInterpolate($gettext('Dieser Inhalt ist aus den persönlichen Lerninhalten von %{ ownerName } verlinkt und kann nur dort bearbeitet werden.'), { ownerName: ownerName })"
mood="pointing"
/>
<component
......@@ -808,7 +808,10 @@ export default {
textDelete.alert = this.$gettext('Möchten Sie die Seite wirklich löschen?');
if (this.structuralElementLoaded) {
textDelete.alert =
this.$gettextInterpolate('Möchten Sie die Seite %{ pageTitle } und alle ihre Unterseiten wirklich löschen?', {pageTitle: this.structuralElement.attributes.title});
this.$gettextInterpolate(
this.$gettext('Möchten Sie die Seite %{ pageTitle } und alle ihre Unterseiten wirklich löschen?'),
{pageTitle: this.structuralElement.attributes.title}
);
}
return textDelete;
......@@ -1364,7 +1367,12 @@ export default {
case 'deleteCurrentElement':
await this.loadStructuralElement(this.currentId);
if (this.blockedByAnotherUser) {
this.companionInfo({ info: this.$gettextInterpolate('Löschen nicht möglich, da %{blockingUserName} die Seite bearbeitet.', {blockingUserName: this.blockingUserName}) });
this.companionInfo({
info: this.$gettextInterpolate(
this.$gettext('Löschen nicht möglich, da %{blockingUserName} die Seite bearbeitet.'),
{blockingUserName: this.blockingUserName}
)
});
return false;
}
......@@ -1440,7 +1448,12 @@ export default {
async storeCurrentElement() {
await this.loadStructuralElement(this.currentElement.id);
if (this.blockedByAnotherUser) {
this.companionWarning({ info: this.$gettextInterpolate('Ihre Änderungen konnten nicht gespeichert werden, da %{blockingUserName} die Bearbeitung übernommen hat.', {blockingUserName: this.blockingUserName}) });
this.companionWarning({
info: this.$gettextInterpolate(
this.$gettext('Ihre Änderungen konnten nicht gespeichert werden, da %{blockingUserName} die Bearbeitung übernommen hat.'),
{blockingUserName: this.blockingUserName}
)
});
this.showElementEditDialog(false);
return false;
}
......@@ -1553,7 +1566,12 @@ export default {
async deleteCurrentElement() {
await this.loadStructuralElement(this.currentElement.id);
if (this.blockedByAnotherUser) {
this.companionWarning({ info: this.$gettextInterpolate('Löschen nicht möglich, da %{blockingUserName} die Bearbeitung übernommen hat.', {blockingUserName: this.blockingUserName}) });
this.companionWarning({
info: this.$gettextInterpolate(
this.$gettext('Löschen nicht möglich, da %{blockingUserName} die Bearbeitung übernommen hat.'),
{blockingUserName: this.blockingUserName}
)
});
this.showElementDeleteDialog(false);
return false;
}
......@@ -1600,8 +1618,10 @@ export default {
});
let newElement = this.$store.getters['courseware-structural-elements/lastCreated'];
this.companionSuccess({
info:
this.$gettextInterpolate('Die Seite %{ pageTitle } wurde erfolgreich angelegt.', {pageTitle: newElement.attributes.title})
info: this.$gettextInterpolate(
this.$gettext('Die Seite %{ pageTitle } wurde erfolgreich angelegt.'),
{pageTitle: newElement.attributes.title}
)
});
this.newChapterName = '';
},
......
......@@ -13,9 +13,8 @@ export default {
data: {
text: text,
},
}).then( () => {
this.companionInfo({ info: this.$gettextInterpolate('Der Vorschlag wurde verschickt.') });
this.companionInfo({ info: this.$gettext('Der Vorschlag wurde verschickt.') });
});
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment