adding custom package

This commit is contained in:
Sacha Greif 2013-11-21 11:32:09 +09:00
parent ef537c4987
commit 0cc4ca1bbb
10 changed files with 213 additions and 217 deletions

View file

@ -18,4 +18,4 @@ rss
iron-router iron-router
mailchimp mailchimp
nprogress nprogress
i18next-meteor telescope-i18n

View file

@ -49,8 +49,3 @@ Handlebars.registerHelper('canEdit', function(collectionName, item, action) {
// var item=collection.findOne(itemId); // var item=collection.findOne(itemId);
return item && canEdit(Meteor.user(), item, action); return item && canEdit(Meteor.user(), item, action);
}); });
Handlebars.registerHelper('i18n',
function(str){
// return ($.i18n != undefined ? $.i18n.t(str) : str);
}
);

View file

@ -18,16 +18,6 @@ Meteor.subscribe('settings', function(){
// runs once after settings have loaded // runs once after settings have loaded
Session.set('settingsLoaded',true); Session.set('settingsLoaded',true);
analyticsInit(); analyticsInit();
i18n = $.i18n;
// Localisation
i18n.init({
lng: getSetting("language"),
resStore: eval(getSetting("language")),
keyseparator: '::',
nsseparator: ':::'
});
}); });
// Categories // Categories

View file

@ -18,7 +18,7 @@ getNotification = function(event, properties, context){
case 'newReply': case 'newReply':
notification.subject = i18n.t('Someone replied to your comment on')+' "'+p.postHeadline+'"'; notification.subject = i18n.t('Someone replied to your comment on')+' "'+p.postHeadline+'"';
notification.text = p.commentAuthorName+i18n.t(' has replied to your comment on')+' "'+p.postHeadline+'": '+getPostCommentUrl(p.postId, p.commentId); notification.text = p.commentAuthorName+i18n.t(' has replied to your comment on')+' "'+p.postHeadline+'": '+getPostCommentUrl(p.postId, p.commentId);
notification.html = '<p><a href="'+getUserUrl(p.commentAuthorId)+'">'+p.commentAuthorName+'</a>'.i18n.t(' has replied to your comment on')+' "<a href="'+getPostCommentUrl(p.postId, p.commentId)+'" class="action-link">'+p.postHeadline+'</a>"</p>'; notification.html = '<p><a href="'+getUserUrl(p.commentAuthorId)+'">'+p.commentAuthorName+'</a>'+i18n.t(' has replied to your comment on')+' "<a href="'+getPostCommentUrl(p.postId, p.commentId)+'" class="action-link">'+p.postHeadline+'</a>"</p>';
if(context === 'email') if(context === 'email')
notification.html += '<p>'+p.commentExcerpt+'</p><a href="'+getPostCommentUrl(p.postId, p.commentId)+'" class="action-link">'+i18n.t('Read more')+'</a>'; notification.html += '<p>'+p.commentExcerpt+'</p><a href="'+getPostCommentUrl(p.postId, p.commentId)+'" class="action-link">'+i18n.t('Read more')+'</a>';
break; break;

View file

@ -1,6 +1,4 @@
fr = { i18n.translations.fr = {
'fr': {
translation: {
//Navigation //Navigation
"Menu": "Menu", "Menu": "Menu",
"Top": "Top", "Top": "Top",
@ -189,6 +187,4 @@ fr = {
"Please log in first": "Vous devez être connecté", "Please log in first": "Vous devez être connecté",
"Sign In/Sign Up with Twitter": "Connexion/Créer un compte avec Twitter", "Sign In/Sign Up with Twitter": "Connexion/Créer un compte avec Twitter",
"Load more": "Charger plus" "Load more": "Charger plus"
}
}
}; };

1
packages/telescope-i18n/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
.build*

View file

@ -0,0 +1,19 @@
i18n = {
translations: [],
t: function (str) {
var lang = getSetting('language', 'en');
if(i18n.translations[lang] && i18n.translations[lang][str]){
return i18n.translations[lang][str];
}
return str;
}
};
if(Meteor.isClient){
Handlebars.registerHelper('i18n', function(str){
return i18n.t(str);
});
}

View file

@ -0,0 +1,7 @@
Package.describe("Telescope i18n package");
Package.on_use(function (api) {
api.use(['handlebars'], 'client');
api.add_files(['i18n.js'], ['client', 'server']);
api.export('i18n');
});

View file

@ -8,9 +8,6 @@
}, },
"crypto-md5": {}, "crypto-md5": {},
"iron-router": {}, "iron-router": {},
"i18next-meteor": {
"git": "git://github.com/SachaG/i18next-meteor.git"
},
"nprogress": {} "nprogress": {}
} }
} }

View file

@ -10,10 +10,6 @@
}, },
"crypto-md5": {}, "crypto-md5": {},
"iron-router": {}, "iron-router": {},
"i18next-meteor": {
"git": "git://github.com/SachaG/i18next-meteor.git",
"branch": "master"
},
"nprogress": {} "nprogress": {}
}, },
"packages": { "packages": {
@ -23,9 +19,9 @@
"commit": "59a762e297082eea8b8cae00374c2b7ac6f89529" "commit": "59a762e297082eea8b8cae00374c2b7ac6f89529"
}, },
"crypto-base": { "crypto-base": {
"git": "https://github.com/tmeasday/meteor-crypto-base.git", "git": "https://github.com/oortcloud/meteor-crypto-base.git",
"tag": "v0.0.3", "tag": "v3.1.2.1",
"commit": "fdc0b7b3d24e2e31c5c95beddafe890ffbaafd42" "commit": "5df8d82a0595553415bbfae2930c6ecbeece5794"
}, },
"database-forms": { "database-forms": {
"git": "git://github.com/SachaG/database-forms.git", "git": "git://github.com/SachaG/database-forms.git",
@ -33,20 +29,15 @@
"commit": "b11ac7d5ca10df610ee5ca810cde45bb38ac81b7" "commit": "b11ac7d5ca10df610ee5ca810cde45bb38ac81b7"
}, },
"crypto-md5": { "crypto-md5": {
"git": "https://github.com/tmeasday/meteor-crypto-md5.git", "git": "https://github.com/oortcloud/meteor-crypto-md5.git",
"tag": "v0.0.2", "tag": "v3.1.2.2",
"commit": "a943bea4cffeac9a14c2825dfe57d32b9d677e6f" "commit": "75bbb3eeace302122d3554a6212a6fe92553fa18"
}, },
"iron-router": { "iron-router": {
"git": "https://github.com/EventedMind/iron-router.git", "git": "https://github.com/EventedMind/iron-router.git",
"tag": "v0.6.1", "tag": "v0.6.1",
"commit": "4e1ee0581d68bff422a915dacb0bd30eae10fe08" "commit": "4e1ee0581d68bff422a915dacb0bd30eae10fe08"
}, },
"i18next-meteor": {
"git": "git://github.com/SachaG/i18next-meteor.git",
"branch": "master",
"commit": "429adc8e5f8049a3b0f4e6186d94482799253059"
},
"nprogress": { "nprogress": {
"git": "https://github.com/zhouzhuojie/meteor-nprogress.git", "git": "https://github.com/zhouzhuojie/meteor-nprogress.git",
"tag": "v0.0.3", "tag": "v0.0.3",