i18n of drafty preview elements

This commit is contained in:
or-else
2021-04-28 13:34:14 -07:00
parent 8715251e9b
commit f6acbaab21
14 changed files with 130 additions and 27 deletions
+4 -1
View File
@@ -172,5 +172,8 @@
"tags_editor_no_tags": "Schlagworte hinzufügen",
"title_manage_tags": "Verwalten",
"channel_prompt": "Dies ist ein Sender",
"channel": "Sender"
"channel": "Sender",
"drafty_attachment": "Dateianhang",
"drafty_form": "Formular:",
"drafty_image": "Bild"
}
+3
View File
@@ -43,6 +43,9 @@
"delete_messages_warning": "Are you sure you want to delete all messages for everyone? It cannot be undone.",
"deleted_content": "content deleted",
"download_action": "download",
"drafty_attachment": "Attachment",
"drafty_form": "Form:",
"drafty_image": "Picture",
"email_dative": "email",
"email_prompt": "Email, e.g. jdoe@example.com",
"enable_peers_messaging": "Enable",
+4 -1
View File
@@ -172,5 +172,8 @@
"tags_editor_no_tags": "Añadir etiquetas",
"title_manage_tags": "Gestionar",
"channel_prompt": "Este es un canal",
"channel": "canal"
"channel": "canal",
"drafty_attachment": "Archivo",
"drafty_form": "Formulario:",
"drafty_image": "Imagen"
}
+12
View File
@@ -175,6 +175,18 @@
"defaultMessage": "download",
"description": "Call to action [download]"
},
"drafty_attachment": {
"defaultMessage": "Attachment",
"description": "Comment for attachment in drafty preview"
},
"drafty_form": {
"defaultMessage": "Form:",
"description": "Comment for form in drafty preview"
},
"drafty_image": {
"defaultMessage": "Picture",
"description": "Comment for embedded images in drafty preview"
},
"email_dative": {
"defaultMessage": "email",
"description": "Dative case of 'email', i.e. 'email' in 'by email'"
+4 -1
View File
@@ -175,5 +175,8 @@
"messages_not_readable": "메시지에 액세스 할 수 없습니다",
"deleted_content": "내용이 삭제되었습니다",
"channel_prompt": "이 채널입니다",
"channel": "채널"
"channel": "채널",
"drafty_attachment": "부착",
"drafty_form": "형태:",
"drafty_image": "이미지"
}
+4 -1
View File
@@ -172,5 +172,8 @@
"cannot_initiate_file_upload": "Nu se poate face încărcarea.",
"tags_not_found": "Niciun tag definit. Adaugă.",
"tags_editor_no_tags": "Adaugă tag-uri",
"title_manage_tags": "Administrează"
"title_manage_tags": "Administrează",
"drafty_attachment": "Atasament",
"drafty_form": "Formă:",
"drafty_image": "Imagine"
}
+4 -1
View File
@@ -172,5 +172,8 @@
"no_connection": "Нет связи",
"code_doesnot_match": "Код не совпадает",
"channel_prompt": "Создать канал",
"channel": "канал"
"channel": "канал",
"drafty_attachment": "Аттачмент",
"drafty_form": "Форма:",
"drafty_image": "Картинка"
}
+4 -1
View File
@@ -172,5 +172,8 @@
"no_connection": "无连接",
"code_doesnot_match": "代码不匹配",
"channel_prompt": "这是一个频道",
"channel": "频道"
"channel": "频道",
"drafty_attachment": "附件",
"drafty_form": "形式:",
"drafty_image": "图像"
}
+27 -6
View File
@@ -173,7 +173,10 @@
"tags_editor_no_tags": "Schlagworte hinzufügen",
"title_manage_tags": "Verwalten",
"channel_prompt": "Dies ist ein Sender",
"channel": "Sender"
"channel": "Sender",
"drafty_attachment": "Dateianhang",
"drafty_form": "Formular:",
"drafty_image": "Bild"
},
"en": {
"action_block_contact": "Block Contact",
@@ -220,6 +223,9 @@
"delete_messages_warning": "Are you sure you want to delete all messages for everyone? It cannot be undone.",
"deleted_content": "content deleted",
"download_action": "download",
"drafty_attachment": "Attachment",
"drafty_form": "Form:",
"drafty_image": "Picture",
"email_dative": "email",
"email_prompt": "Email, e.g. jdoe@example.com",
"enable_peers_messaging": "Enable",
@@ -525,7 +531,10 @@
"tags_editor_no_tags": "Añadir etiquetas",
"title_manage_tags": "Gestionar",
"channel_prompt": "Este es un canal",
"channel": "canal"
"channel": "canal",
"drafty_attachment": "Archivo",
"drafty_form": "Formulario:",
"drafty_image": "Imagen"
},
"ko": {
"validate_credential_action": "확인",
@@ -701,7 +710,10 @@
"messages_not_readable": "메시지에 액세스 할 수 없습니다",
"deleted_content": "내용이 삭제되었습니다",
"channel_prompt": "이 채널입니다",
"channel": "채널"
"channel": "채널",
"drafty_attachment": "부착",
"drafty_form": "형태:",
"drafty_image": "이미지"
},
"ro": {
"validate_credential_action": "confirmă",
@@ -877,7 +889,10 @@
"cannot_initiate_file_upload": "Nu se poate face încărcarea.",
"tags_not_found": "Niciun tag definit. Adaugă.",
"tags_editor_no_tags": "Adaugă tag-uri",
"title_manage_tags": "Administrează"
"title_manage_tags": "Administrează",
"drafty_attachment": "Atasament",
"drafty_form": "Formă:",
"drafty_image": "Imagine"
},
"ru": {
"contacts_not_found": "Чатов нет<br />¯∖_(ツ)_/¯",
@@ -1053,7 +1068,10 @@
"no_connection": "Нет связи",
"code_doesnot_match": "Код не совпадает",
"channel_prompt": "Создать канал",
"channel": "канал"
"channel": "канал",
"drafty_attachment": "Аттачмент",
"drafty_form": "Форма:",
"drafty_image": "Картинка"
},
"zh": {
"archived_contacts": "已归档联系人 ({count})",
@@ -1229,6 +1247,9 @@
"no_connection": "无连接",
"code_doesnot_match": "代码不匹配",
"channel_prompt": "这是一个频道",
"channel": "频道"
"channel": "频道",
"drafty_attachment": "附件",
"drafty_form": "形式:",
"drafty_image": "图像"
}
}
+27 -5
View File
@@ -1,6 +1,6 @@
// A single topic or user.
import React from 'react';
import { FormattedMessage } from 'react-intl';
import { defineMessages, FormattedMessage, injectIntl } from 'react-intl';
import ContactBadges from './contact-badges.jsx';
import LetterTile from './letter-tile.jsx';
@@ -11,7 +11,25 @@ import { Drafty } from 'tinode-sdk';
import { deliveryMarker } from '../lib/utils.js';
export default class Contact extends React.Component {
const messages = defineMessages({
drafty_image: {
id: 'drafty_image',
defaultMessage: 'Picture',
description: 'Comment for embedded images in drafty preview'
},
drafty_form: {
id: 'drafty_form',
defaultMessage: 'Form: ',
description: 'Comment for form in drafty preview'
},
drafty_attachment: {
id: 'drafty_attachment',
defaultMessage: 'Attachment',
description: 'Comment for attachment in drafty preview'
},
});
class Contact extends React.Component {
constructor(props) {
super(props);
@@ -105,6 +123,7 @@ function draftyFormatter(style, data, values, key) {
let el = Drafty.tagName(style);
const attr = { key: key };
if (el) {
const { formatMessage } = this.props.intl;
switch (style) {
case 'BR':
// Replace new line with a space.
@@ -122,7 +141,7 @@ function draftyFormatter(style, data, values, key) {
case 'IM':
// Replace image with '[icon] Image'.
el = React.Fragment;
values = [<i key="im" className="material-icons">photo</i>, 'Picture'];
values = [<i key="im" className="material-icons">photo</i>, formatMessage(messages.drafty_image)];
break;
case 'BN':
el = 'span';
@@ -130,14 +149,15 @@ function draftyFormatter(style, data, values, key) {
break;
case 'FM':
el = React.Fragment;
values = [<i key="fm" className="material-icons">dashboard</i>, 'Form: '].concat(values || []);
values = [<i key="fm" className="material-icons">dashboard</i>,
formatMessage(messages.drafty_form)].concat(values || []);
break;
case 'RW':
el = React.Fragment;
break;
case 'EX':
el = React.Fragment;
values = [<i key="ex" className="material-icons">attachment</i>, 'Attachment'];
values = [<i key="ex" className="material-icons">attachment</i>, formatMessage(messages.drafty_attachment)];
break;
default:
if (el == '_UNKN') {
@@ -151,3 +171,5 @@ function draftyFormatter(style, data, values, key) {
return values;
}
};
export default injectIntl(Contact);