diff --git a/client/coral-admin/src/components/ModerationKeysModal.js b/client/coral-admin/src/components/ModerationKeysModal.js index c3031c8a5..b83099125 100644 --- a/client/coral-admin/src/components/ModerationKeysModal.js +++ b/client/coral-admin/src/components/ModerationKeysModal.js @@ -7,8 +7,8 @@ const shortcuts = [ { title: 'modqueue.navigation', shortcuts: { - 'j': 'modqueue.nextcomment', - 'k': 'modqueue.prevcomment', + 'j': 'modqueue.next_comment', + 'k': 'modqueue.prev_comment', 's': 'modqueue.singleview', '?': 'modqueue.thismenu' } diff --git a/client/coral-admin/src/containers/ModerationQueue/components/Comment.js b/client/coral-admin/src/containers/ModerationQueue/components/Comment.js index 99877a1af..a81d6f361 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)}

{closedAt === 'open' ? 'Close' : 'Open'} {t('configure.comment_stream')}

- {(closedAt === 'open' && closedTimeout) ?

{t('configure.comment_stream_will_close')} {this.getClosedIn()}.

: ''} + {(closedAt === 'open' && closedTimeout) ?

{t('configure.comment_stream_will_close')} {this.getClosedIn()}.

: ''} > // Add es timeago locale for the timeago registration. time.register('es', esTA); let timeagoInstance = time(); @@ -26,15 +27,26 @@ const setLocale = (locale) => { const getLocale = () => (localStorage.getItem('locale') || navigator.language || defaultLanguage).split('-')[0]; -export const loadTranslations = (translations) => { +const extend = (obj, src) => { + + for (let key in src) { + if (src.hasOwnProperty(key)) { + obj[key] = src[key]; + } + } + return obj; +}; + +export const loadTranslations = (new_translations) => { try { 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]; + if (new_translations !== undefined) { + translations = extend(translations, new_translations[locale]); + return translations; } @@ -60,6 +72,7 @@ export const timeago = (time) => { * any extra parameters are optional and replace a variable marked by {0}, {1}, etc in the translation. */ const t = (key, ...replacements) => { + if (has(translations, key)) { let translation = get(translations, key); diff --git a/plugins/coral-plugin-respect/client/index.js b/plugins/coral-plugin-respect/client/index.js index 7994eaeb2..e76ecbd15 100644 --- a/plugins/coral-plugin-respect/client/index.js +++ b/plugins/coral-plugin-respect/client/index.js @@ -3,7 +3,7 @@ import RespectButton from './containers/RespectButton'; import translations from './translations.json'; import {loadTranslations} from 'coral-i18n/services/i18n'; -Promise.all([loadTranslations(translations)]); +loadTranslations(translations); export default { slots: {