diff --git a/client/coral-admin/src/containers/ModerationQueue/components/Comment.js b/client/coral-admin/src/containers/ModerationQueue/components/Comment.js index 7fb33cea2..99877a1af 100644 --- a/client/coral-admin/src/containers/ModerationQueue/components/Comment.js +++ b/client/coral-admin/src/containers/ModerationQueue/components/Comment.js @@ -14,7 +14,7 @@ import BanUserButton from 'coral-admin/src/components/BanUserButton'; const linkify = new Linkify(); -import {t, timeago} from 'coral-i18n/services/i18n'; +import {t, timeAgo} from 'coral-i18n/services/i18n'; const Comment = ({ actions = [], @@ -57,7 +57,7 @@ const Comment = ({ {comment.user.name} - {timeago(comment.created_at || Date.now() - props.index * 60 * 1000)} + {timeAgo(comment.created_at || Date.now() - props.index * 60 * 1000)} { translations = require(`json-loader!yaml-loader!../locales/${locale}.yml`)[locale]; }; @@ -24,8 +31,11 @@ export const loadTranslations = (translations) => { const locale = getLocale(); setLocale(locale); + // If we have a translations file, let's use that one. + // Otherwise get the core translations. if (translations !== undefined) { translations = translations[locale]; + return translations; } return fetchTranslations(locale); @@ -36,7 +46,9 @@ export const loadTranslations = (translations) => { } }; -export const timeago = (date) => timeago().format(date, getLocale().replace('-', '_')); +export const timeago = (time) => { + return timeagoInstance.format(new Date(time), getLocale()); +}; /** * Expose the translation function diff --git a/client/coral-plugin-best/BestButton.js b/client/coral-plugin-best/BestButton.js index 2a433cfce..629d7d05f 100644 --- a/client/coral-plugin-best/BestButton.js +++ b/client/coral-plugin-best/BestButton.js @@ -98,7 +98,7 @@ export class BestButton extends Component { ); diff --git a/client/coral-plugin-pubdate/PubDate.js b/client/coral-plugin-pubdate/PubDate.js index b81030fec..0445076e3 100644 --- a/client/coral-plugin-pubdate/PubDate.js +++ b/client/coral-plugin-pubdate/PubDate.js @@ -1,5 +1,5 @@ import React from 'react'; -import timeago from 'coral-i18n/services/i18n'; +import {timeago} from 'coral-i18n/services/i18n'; const name = 'coral-plugin-pubdate'; diff --git a/plugins/coral-plugin-respect/client/translations.json b/plugins/coral-plugin-respect/client/translations.json index 643f32ccf..a74e04b3f 100644 --- a/plugins/coral-plugin-respect/client/translations.json +++ b/plugins/coral-plugin-respect/client/translations.json @@ -4,7 +4,7 @@ "respected": "Respected" }, "es": { - "respect": "Respeto", + "respect": "Respetar", "respected": "Respetado" } }