add localisation support
currently only en_GB (TODO: dynamic language pack imports)
This commit is contained in:
parent
970590497f
commit
e326ac858e
17 changed files with 263 additions and 90 deletions
|
@ -9,10 +9,13 @@
|
|||
// import QuoteIcon from '$lib/../img/icons/quote.svg';
|
||||
import ReactionBar from '$lib/ui/post/ReactionBar.svelte';
|
||||
import ActionBar from '$lib/ui/post/ActionBar.svelte';
|
||||
import Lang from '$lib/lang.js';
|
||||
|
||||
const lang = Lang('en_GB');
|
||||
|
||||
let mention = (accounts) => {
|
||||
let res = `<a href=${account.url}>${account.rich_name}</a>`;
|
||||
if (accounts.length > 1) res += ` and <strong>${accounts.length - 1}</strong> others`;
|
||||
if (accounts.length > 1) res += ' ' + lang.string('notification.and_others').replaceAll('%1', accounts.length - 1);
|
||||
return res;
|
||||
};
|
||||
|
||||
|
@ -20,23 +23,23 @@
|
|||
let activity_text = function (type) {
|
||||
switch (type) {
|
||||
case "mention":
|
||||
return `%1 mentioned you.`;
|
||||
return lang.string('notification.mention');
|
||||
case "reblog":
|
||||
return `%1 boosted your post.`;
|
||||
return lang.string('notification.reblog');
|
||||
case "reaction":
|
||||
return `%1 reacted to your post.`;
|
||||
return lang.string('notification.reaction');
|
||||
case "follow":
|
||||
return `%1 followed you.`;
|
||||
return lang.string('notification.follow');
|
||||
case "follow_request":
|
||||
return `%1 requested to follow you.`;
|
||||
return lang.string('notification.follow.request');
|
||||
case "favourite":
|
||||
return `%1 favourited your post.`;
|
||||
return lang.string('notification.favourite');
|
||||
case "poll":
|
||||
return `%1's poll as ended.`;
|
||||
return lang.string('notification.poll');
|
||||
case "update":
|
||||
return `%1 updated their post.`;
|
||||
return lang.string('notification.update');
|
||||
default:
|
||||
return `%1 poked you!`;
|
||||
return lang.string('notification.default');
|
||||
}
|
||||
}(data.type);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue