i18n is the first widget to be loaded, add video locales, embedder uses i18n, only render mustache template with i18n if the views are passed
This commit is contained in:
parent
a6530f4db1
commit
099e0a6e24
4 changed files with 16 additions and 6 deletions
|
|
@ -16,9 +16,9 @@ javascripts:
|
||||||
- public/javascripts/vendor/fileuploader.js
|
- public/javascripts/vendor/fileuploader.js
|
||||||
- public/javascripts/vendor/Mustache.js
|
- public/javascripts/vendor/Mustache.js
|
||||||
- public/javascripts/diaspora.js
|
- public/javascripts/diaspora.js
|
||||||
|
- public/javascripts/widgets/i18n.js
|
||||||
- public/javascripts/widgets/alert.js
|
- public/javascripts/widgets/alert.js
|
||||||
- public/javascripts/widgets/embedder.js
|
- public/javascripts/widgets/embedder.js
|
||||||
- public/javascripts/widgets/i18n.js
|
|
||||||
- public/javascripts/widgets/timeago.js
|
- public/javascripts/widgets/timeago.js
|
||||||
- public/javascripts/view.js
|
- public/javascripts/view.js
|
||||||
- public/javascripts/stream.js
|
- public/javascripts/stream.js
|
||||||
|
|
|
||||||
|
|
@ -499,4 +499,8 @@ en:
|
||||||
next: "Next"
|
next: "Next"
|
||||||
previous: "Previous"
|
previous: "Previous"
|
||||||
javascripts:
|
javascripts:
|
||||||
confirm_dialog: "Are you sure?"
|
confirm_dialog: "Are you sure?"
|
||||||
|
videos:
|
||||||
|
watch: "Watch this video on {{provider}}"
|
||||||
|
unknown: "Unknown video type"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,15 +56,17 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
Embedder.prototype.registerServices = function() {
|
Embedder.prototype.registerServices = function() {
|
||||||
|
var watchVideoOn = Diaspora.widgets.i18n.t("videos.watch");
|
||||||
|
console.log(watchVideoOn);
|
||||||
this.register("youtube.com",
|
this.register("youtube.com",
|
||||||
'<a href="//www.youtube.com/watch?v={{video-id}}" target="_blank">Watch this video on Youtube</a><br />' +
|
'<a href="//www.youtube.com/watch?v={{video-id}}" target="_blank">' + $.mustache(watchVideoOn, { provider: "YouTube" }) + 'Youtube</a><br />' +
|
||||||
'<iframe class="youtube-player" type="text/html" src="http://www.youtube.com/embed/{{video-id}}"></iframe>');
|
'<iframe class="youtube-player" type="text/html" src="http://www.youtube.com/embed/{{video-id}}"></iframe>');
|
||||||
|
|
||||||
this.register("vimeo.com",
|
this.register("vimeo.com",
|
||||||
'<a href="http://vimeo.com/{{video-id}}">Watch this video on Vimeo</a><br />' +
|
'<a href="http://vimeo.com/{{video-id}}">' + $.mustache(watchVideoOn, { provider: "Vimeo" }) + '</a><br />' +
|
||||||
'<iframe class="vimeo-player" src="http://player.vimeo.com/video/{{video-id}}"></iframe>');
|
'<iframe class="vimeo-player" src="http://player.vimeo.com/video/{{video-id}}"></iframe>');
|
||||||
|
|
||||||
this.register("undefined", '<p>Unknown video type - {{host}}</p>');
|
this.register("undefined", '<p>' + Diaspora.widgets.i18n.t("videos.unknown") + ' - {{host}}</p>');
|
||||||
};
|
};
|
||||||
|
|
||||||
Embedder.prototype.onVideoLinkClicked = function(evt) {
|
Embedder.prototype.onVideoLinkClicked = function(evt) {
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,10 @@ Diaspora.widgets.add("i18n", function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $.mustache(ret, views || {});
|
if(typeof views === "object") {
|
||||||
|
return $.mustache(ret, views || {});
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
Loading…
Reference in a new issue