diff --git a/i18n/de.json b/i18n/de.json
index 6211a4f..9959e71 100644
--- a/i18n/de.json
+++ b/i18n/de.json
@@ -93,7 +93,7 @@
"Anonymous":
"Anonym",
"Avatar generated from IP address":
- "Anvatar (generiert aus der IP-Adresse)",
+ "Avatar (generiert aus der IP-Adresse)",
"Add comment":
"Kommentar hinzufügen",
"Optional nickname…":
diff --git a/js/privatebin.js b/js/privatebin.js
index d925b43..7eaf15b 100644
--- a/js/privatebin.js
+++ b/js/privatebin.js
@@ -416,7 +416,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
}
// if no translation string cannot be found (in translations object)
- if (!translations.hasOwnProperty(messageId)) {
+ if (!translations.hasOwnProperty(messageId) || language === null) {
// if language is still loading and we have an elemt assigned
if (language === null && $element !== null) {
// handle the error by attaching the language loaded event
@@ -432,9 +432,9 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
// file is loaded
}
- // for all other langauges than English for which thsi behaviour
+ // for all other langauges than English for which this behaviour
// is expected as it is built-in, log error
- if (language !== 'en') {
+ if (language !== null && language !== 'en') {
console.error('Missing translation for: \'' + messageId + '\' in language ' + language);
// fallback to English
}
@@ -463,7 +463,13 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
// if $element is given, apply text to element
if ($element !== null) {
- $element.text(output);
+ // get last text node of element
+ var content = $element.contents();
+ if (content.length > 1) {
+ content[content.length - 1].nodeValue = ' ' + output;
+ } else {
+ $element.text(output);
+ }
}
return output;
@@ -1070,13 +1076,10 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
// show text
if (args !== null) {
- // get last text node of element
- var content = $element.contents();
- if (content.length > 1) {
- content[content.length - 1].nodeValue = ' ' + I18n._(args);
- } else {
- $element.text(I18n._(args));
- }
+ // add jQuery object to it as first parameter
+ args.unshift($element);
+ // pass it to I18n
+ I18n._.apply(this, args);
}
// show notification
@@ -1144,7 +1147,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
*/
me.showRemaining = function(message)
{
- console.error('remaining message shown: ', message);
+ console.log('remaining message shown: ', message);
handleNotification(1, $remainingTime, message);
}
@@ -1360,7 +1363,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
'This document will expire in %d ' + expiration[1] + 's.'
];
- Alert.showRemaining(expirationLabel, expiration[0]);
+ Alert.showRemaining([expirationLabel, expiration[0]]);
$remainingTime.removeClass('foryoureyesonly')
} else {
// never expires
@@ -2283,10 +2286,11 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
Helper.urls2links($commentEntryData);
// set nickname
- if (nickname.length > 0){
+ if (nickname.length > 0) {
$commentEntry.find('span.nickname').text(nickname);
} else {
- $commentEntry.find('span.nickname').html('' + I18n._('Anonymous') + '');
+ $commentEntry.find('span.nickname').html('');
+ I18n._($commentEntry.find('span.nickname i'), 'Anonymous');
}
// set date
@@ -2297,10 +2301,13 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
// if an avatar is available, display it
if (comment.meta.vizhash) {
$commentEntry.find('span.nickname')
- .before(
- ' '
- );
+ .before(
+ ' '
+ );
+ $(document).on('languageLoaded', function () {
+ $commentEntry.find('img.vizhash')
+ .prop('title', I18n._('Avatar generated from IP address'));
+ });
}
// finally append comment
diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php
index bcf4e33..28bfc93 100644
--- a/tpl/bootstrap.php
+++ b/tpl/bootstrap.php
@@ -69,7 +69,7 @@ if ($MARKDOWN):
-
+
diff --git a/tpl/page.php b/tpl/page.php
index dc80f36..4b55d76 100644
--- a/tpl/page.php
+++ b/tpl/page.php
@@ -47,7 +47,7 @@ if ($MARKDOWN):
-
+