1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00

Some translations are done

This commit is contained in:
Zhiyuan Zheng
2020-11-30 00:24:53 +01:00
parent 1493e20962
commit 0e3528d2cd
42 changed files with 428 additions and 176 deletions

View File

@ -1,5 +1,7 @@
import { store } from 'src/store'
const relativeTime = (date: string) => {
let units = {
const units = {
year: 24 * 60 * 60 * 1000 * 365,
month: (24 * 60 * 60 * 1000 * 365) / 12,
day: 24 * 60 * 60 * 1000,
@ -8,14 +10,20 @@ const relativeTime = (date: string) => {
second: 1000
}
let rtf = new Intl.RelativeTimeFormat('zh', { numeric: 'auto' })
const rtf = new Intl.RelativeTimeFormat(store.getState().settings.language, {
numeric: 'auto'
})
let elapsed: number = new Date(date) - new Date()
const elapsed = +new Date(date) - +new Date()
// "Math.abs" accounts for both "past" & "future" scenarios
for (var u in units)
if (Math.abs(elapsed) > units[u] || u == 'second')
for (const u in units) {
// @ts-ignore
if (Math.abs(elapsed) > units[u] || u == 'second') {
// @ts-ignore
return rtf.format(Math.round(elapsed / units[u]), u)
}
}
}
export default relativeTime

View File

@ -1,19 +1,30 @@
export default {
FONT_SIZE_S: 12,
FONT_SIZE_M: 14,
FONT_SIZE_L: 18,
const Base = 4
FONT_WEIGHT_BOLD: '600',
export const StyleConstants = {
Font: {
Size: {
S: 12,
M: 14,
L: 18
},
Weight: {
Bold: '600' as '600'
}
},
SPACING_XS: 4,
SPACING_S: 8,
SPACING_M: 16,
SPACING_L: 24,
SPACING_XL: 40,
Spacing: {
XS: Base,
S: Base * 2,
M: Base * 4,
L: Base * 6,
XL: Base * 10,
Global: {
PagePadding: Base * 6
}
},
GLOBAL_PAGE_PADDING: 24, // SPACING_M
GLOBAL_SPACING_BASE: 8, // SPACING_S
AVATAR_S: 52,
AVATAR_L: 104
Avatar: {
S: 52,
L: 104
}
}