forked from blisstown/campfire
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
|
@ -1,3 +1,6 @@
|
|||
import Lang from '$lib/lang.js';
|
||||
const lang = Lang('en_GB');
|
||||
|
||||
const denoms = [
|
||||
{ unit: 's', min: 0 },
|
||||
{ unit: 'm', min: 60 },
|
||||
|
@ -18,6 +21,6 @@ export function shorthand(date) {
|
|||
unit = denoms[index].unit;
|
||||
}
|
||||
if (value > 0)
|
||||
return Math.floor(value) + unit + " ago";
|
||||
return lang.string('post.time').replaceAll('%1', Math.floor(value) + unit);
|
||||
return "in " + Math.floor(value) + unit;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue