diff --git a/README.md b/README.md index 53e522e..4a13a77 100644 --- a/README.md +++ b/README.md @@ -130,6 +130,18 @@ If you have valid facebook app id, we recommend you configure it to use Facebook }); ``` +## I18n + +```js + ShareIt.configure({ + titles: { + 'facebook': function() {return TAPi18n.__('Share on Facebook');}, + 'googleplus': function() {return TAPi18n.__('Share on Google+');}, + 'pinterest': function() {return TAPi18n.__('Share on Pinterest');}, + 'twitter': function() {return TAPi18n.__('Share on Twitter');} + } + }); +``` ## Roadmap diff --git a/client/views/facebook/facebook.html b/client/views/facebook/facebook.html index fcafc7b..81008e7 100644 --- a/client/views/facebook/facebook.html +++ b/client/views/facebook/facebook.html @@ -1,6 +1,6 @@ diff --git a/client/views/googleplus/googleplus.html b/client/views/googleplus/googleplus.html index 71c6d98..6ff49a9 100644 --- a/client/views/googleplus/googleplus.html +++ b/client/views/googleplus/googleplus.html @@ -1,6 +1,6 @@ diff --git a/client/views/pinterest/pinterest.html b/client/views/pinterest/pinterest.html index 4e1c1f1..4894630 100644 --- a/client/views/pinterest/pinterest.html +++ b/client/views/pinterest/pinterest.html @@ -1,5 +1,5 @@ diff --git a/client/views/twitter/twitter.html b/client/views/twitter/twitter.html index 78bd10f..a466747 100644 --- a/client/views/twitter/twitter.html +++ b/client/views/twitter/twitter.html @@ -1,5 +1,5 @@ diff --git a/shareit.js b/shareit.js index 9f67d13..5e48ac0 100644 --- a/shareit.js +++ b/shareit.js @@ -27,7 +27,13 @@ ShareIt = { iconOnly: false, faSize: '', faClass: '', - applyColors: true + applyColors: true, + titles: { + 'facebook': 'Share on Facebook', + 'googleplus': 'Share on Google+', + 'pinterest': 'Share on Pinterest', + 'twitter': 'Share on Twitter' + } }, configure: function(hash) { return this.settings = $.extend(true, this.settings, hash); @@ -55,6 +61,10 @@ ShareIt = { } }; +Template.registerHelper('titleShareIt', function(name) { + return typeof(ShareIt.settings.titles[name]) == "function" ? ShareIt.settings.titles[name]() : ShareIt.settings.titles[name]; +}); + ShareIt.init = function(hash) { this.settings = $.extend(true, this.settings, hash); window.twttr = (function(d, s, id) {