feat(translation): add translation for now and short date

This commit is contained in:
Toinane 2020-06-25 02:20:45 +02:00
parent ef7937fdd3
commit 8b5096c701
5 changed files with 34 additions and 21 deletions

View File

@ -77,14 +77,14 @@ class SourcesTab extends React.Component<SourcesTabProps, SourcesTabState> {
fetchFrequencyOptions = (): IDropdownOption[] => [
{ key: "0", text: intl.get("sources.unlimited") },
{ key: "15", text: intl.get("time.m", { m: 15 }) },
{ key: "30", text: intl.get("time.m", { m: 30 }) },
{ key: "60", text: intl.get("time.h", { h: 1 }) },
{ key: "120", text: intl.get("time.h", { h: 2 }) },
{ key: "180", text: intl.get("time.h", { h: 3 }) },
{ key: "360", text: intl.get("time.h", { h: 6 }) },
{ key: "720", text: intl.get("time.h", { h: 12 }) },
{ key: "1440", text: intl.get("time.d", { d: 1 }) }
{ key: "15", text: intl.get("time.minute", { m: 15 }) },
{ key: "30", text: intl.get("time.minute", { m: 30 }) },
{ key: "60", text: intl.get("time.hour", { h: 1 }) },
{ key: "120", text: intl.get("time.hour", { h: 2 }) },
{ key: "180", text: intl.get("time.hour", { h: 3 }) },
{ key: "360", text: intl.get("time.hour", { h: 6 }) },
{ key: "720", text: intl.get("time.hour", { h: 12 }) },
{ key: "1440", text: intl.get("time.day", { d: 1 }) }
]
onFetchFrequencyChange = (_, option: IDropdownOption) => {

View File

@ -1,4 +1,5 @@
import * as React from "react"
import intl = require("react-intl-universal")
interface TimeProps {
date: Date
@ -26,10 +27,10 @@ class Time extends React.Component<TimeProps> {
displayTime(past: Date, now: Date): string {
// difference in seconds
let diff = (now.getTime() - past.getTime()) / 60000
if (diff < 1) return "now"
else if (diff < 60) return Math.floor(diff) + "m"
else if (diff < 1440) return Math.floor(diff / 60) + "h"
else return Math.floor(diff / 1440) + "d"
if (diff < 1) return intl.get("time.now")
else if (diff < 60) return Math.floor(diff) + intl.get("time.m")
else if (diff < 1440) return Math.floor(diff / 60) + intl.get("time.h")
else return Math.floor(diff / 1440) + intl.get("time.d")
}
render() {

View File

@ -16,9 +16,13 @@
"confirm": "Confirm",
"cancel": "Cancel",
"time": {
"m": "{m, plural, =1 {# minute} other {# minutes}}",
"h": "{h, plural, =1 {# hour} other {# hours}}",
"d": "{d, plural, =1 {# day} other {# days}}"
"now": "now",
"m": "m",
"h": "h",
"d": "d",
"minute": "{m, plural, =1 {# minute} other {# minutes}}",
"hour": "{h, plural, =1 {# hour} other {# hours}}",
"day": "{d, plural, =1 {# day} other {# days}}"
},
"log": {
"empty": "No notifications",

View File

@ -16,9 +16,13 @@
"confirm": "Confirmer",
"cancel": "Annuler",
"time": {
"m": "{m, plural, =1 {# minute} other {# minutes}}",
"h": "{h, plural, =1 {# heure} other {# heures}}",
"d": "{d, plural, =1 {# jour} other {# jours}}"
"now": "maintenant",
"m": "m",
"h": "h",
"d": "j",
"minute": "{m, plural, =1 {# minute} other {# minutes}}",
"hour": "{h, plural, =1 {# heure} other {# heures}}",
"day": "{d, plural, =1 {# jour} other {# jours}}"
},
"log": {
"empty": "Aucune notification",

View File

@ -16,9 +16,13 @@
"confirm": "确认",
"cancel": "取消",
"time": {
"m": "{m}分钟",
"h": "{h}小时",
"d": "{d}天"
"now": "now",
"m": "m",
"h": "h",
"d": "d",
"minute": "{m}分钟",
"hour": "{h}小时",
"day": "{d}天"
},
"log": {
"empty": "无消息",