translating default subject title

This commit is contained in:
Roland Osborne 2023-10-06 16:51:23 -07:00
parent 8d7e88d12b
commit 132b880127
6 changed files with 18 additions and 6 deletions

View File

@ -185,6 +185,8 @@ const Strings = [
policy: 'Terms of Use and User Policy', policy: 'Terms of Use and User Policy',
editMessage: 'Edit Message Text', editMessage: 'Edit Message Text',
emptyTopic: 'Empty Topic',
notes: 'Notes',
}, },
{ {
languageCode: 'fr', languageCode: 'fr',
@ -366,6 +368,8 @@ const Strings = [
policy: 'Conditions d\'Utilisation et Politique d\'Utilisation', policy: 'Conditions d\'Utilisation et Politique d\'Utilisation',
editMessage: 'Modifier le Texte du Message', editMessage: 'Modifier le Texte du Message',
emptyTopic: 'Pas de Messages',
notes: 'Notes',
}, },
{ {
languageCode: 'es', languageCode: 'es',
@ -547,6 +551,8 @@ const Strings = [
policy: 'Términos de Uso y Política de Usuario', policy: 'Términos de Uso y Política de Usuario',
editMessage: 'Editar Texto del Mensaje', editMessage: 'Editar Texto del Mensaje',
emptyTopic: 'Ningún Mensaje',
notes: 'Notas',
}, },
{ {
languageCode: 'de', languageCode: 'de',
@ -728,6 +734,8 @@ const Strings = [
policy: 'Nutzungsbedingungen und Benutzerrichtlinien', policy: 'Nutzungsbedingungen und Benutzerrichtlinien',
editMessage: 'Nachrichtentext Bearbeiten', editMessage: 'Nachrichtentext Bearbeiten',
emptyTopic: 'Keine Nachrichten',
notes: 'Anmerkungen',
}, },
{ {
languageCode: 'pt', languageCode: 'pt',
@ -894,6 +902,8 @@ const Strings = [
terms: 'Ver Termos de Serviço', terms: 'Ver Termos de Serviço',
policy: 'Termos de Uso e Política do Usuário', policy: 'Termos de Uso e Política do Usuário',
editMessage: 'Editar Texto da Mensagem', editMessage: 'Editar Texto da Mensagem',
emptyTopic: 'Sem Mensagens',
notes: 'Notas',
}, },
]; ];

View File

@ -1,6 +1,6 @@
import { getCardByGuid } from 'context/cardUtil'; import { getCardByGuid } from 'context/cardUtil';
export function getChannelSubjectLogo(cardId, profileGuid, channel, cards, cardImageUrl) { export function getChannelSubjectLogo(cardId, profileGuid, channel, cards, cardImageUrl, strings) {
let subject; let subject;
try { try {
@ -31,7 +31,7 @@ export function getChannelSubjectLogo(cardId, profileGuid, channel, cards, cardI
if (!subject) { if (!subject) {
if (contacts.length === 0) { if (contacts.length === 0) {
subject = 'Notes'; subject = strings?.notes;
} }
else { else {
const names = []; const names = [];

View File

@ -109,7 +109,7 @@ export function useChannels() {
} }
const profileGuid = profile.state?.identity?.guid; const profileGuid = profile.state?.identity?.guid;
const { logo, subject } = getChannelSubjectLogo(cardId, profileGuid, item, card.state.cards, card.actions.getCardImageUrl); const { logo, subject } = getChannelSubjectLogo(cardId, profileGuid, item, card.state.cards, card.actions.getCardImageUrl, state.strings);
const updated = (loginTimestamp < timestamp) && (readRevision < topicRevision); const updated = (loginTimestamp < timestamp) && (readRevision < topicRevision);

View File

@ -79,7 +79,7 @@ export function useConversation() {
const hosted = conversation.state.card == null; const hosted = conversation.state.card == null;
const cards = card.state.cards; const cards = card.state.cards;
cardImageUrl = card.actions.getCardImageUrl; cardImageUrl = card.actions.getCardImageUrl;
const { logo, subject } = getChannelSubjectLogo(cardId, profileGuid, channel, cards, cardImageUrl); const { logo, subject } = getChannelSubjectLogo(cardId, profileGuid, channel, cards, cardImageUrl, state.strings);
if (channel?.topicRevision && channel.readRevision !== channel.topicRevision) { if (channel?.topicRevision && channel.readRevision !== channel.topicRevision) {
conversation.actions.setChannelReadRevision(channel.topicRevision); conversation.actions.setChannelReadRevision(channel.topicRevision);

View File

@ -124,7 +124,7 @@ export function useDetails(clear) {
const channel = conversation.state.channel; const channel = conversation.state.channel;
const cards = card.state.cards; const cards = card.state.cards;
const cardImageUrl = card.actions.getCardImageUrl; const cardImageUrl = card.actions.getCardImageUrl;
const { logo, subject } = getChannelSubjectLogo(hostId, profileGuid, channel, cards, cardImageUrl); const { logo, subject } = getChannelSubjectLogo(hostId, profileGuid, channel, cards, cardImageUrl, state.strings);
let timestamp; let timestamp;
const { timeFull, monthLast } = profile.state || {}; const { timeFull, monthLast } = profile.state || {};

View File

@ -6,9 +6,11 @@ import { ProfileContext } from 'context/ProfileContext';
import { getChannelSeals, isUnsealed, getContentKey, encryptChannelSubject, decryptChannelSubject, decryptTopicSubject } from 'context/sealUtil'; import { getChannelSeals, isUnsealed, getContentKey, encryptChannelSubject, decryptChannelSubject, decryptTopicSubject } from 'context/sealUtil';
import { getCardByGuid } from 'context/cardUtil'; import { getCardByGuid } from 'context/cardUtil';
import { getChannelSubjectLogo } from 'context/channelUtil'; import { getChannelSubjectLogo } from 'context/channelUtil';
import { getLanguageStrings } from 'constants/Strings';
export function useSharing() { export function useSharing() {
const [state, setState] = useState({ const [state, setState] = useState({
strings: getLanguageStrings(),
channels: [], channels: [],
}); });
@ -59,7 +61,7 @@ export function useSharing() {
} }
const profileGuid = profile.state?.identity?.guid; const profileGuid = profile.state?.identity?.guid;
const { logo, subject } = getChannelSubjectLogo(cardId, profileGuid, item, card.state.cards, card.actions.getCardImageUrl); const { logo, subject } = getChannelSubjectLogo(cardId, profileGuid, item, card.state.cards, card.actions.getCardImageUrl, state.strings);
return { cardId, channelId, subject, message, logo, timestamp, locked, unlocked }; return { cardId, channelId, subject, message, logo, timestamp, locked, unlocked };
} }