From 3627ef25f62628c946fb78303963a5b7897f54f2 Mon Sep 17 00:00:00 2001 From: John Livingston Date: Wed, 5 Jul 2023 12:10:27 +0200 Subject: [PATCH] FEP-1970: name attribute. Related to #113. --- server/lib/federation/outgoing.ts | 7 +++++-- .../content/contributing/translate/_index.en.md | 3 ++- .../content/contributing/translate/_index.fr.md | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/server/lib/federation/outgoing.ts b/server/lib/federation/outgoing.ts index 9421f91f..721532c8 100644 --- a/server/lib/federation/outgoing.ts +++ b/server/lib/federation/outgoing.ts @@ -12,6 +12,7 @@ import { getBoshUri, getWSUri, getWSS2SUri, getPublicChatUri } from '../uri/webc import { canonicalizePluginUri } from '../uri/canonicalize' import { getProsodyDomain } from '../prosody/config/domain' import { fillVideoCustomFields } from '../custom-fields' +import { loc } from '../loc' /** * This function adds LiveChat information on video ActivityPub data if relevant. @@ -84,11 +85,13 @@ async function videoBuildJSONLD ( 'chat-no-anonymous': settings['chat-no-anonymous'] }) + const chatTitle = loc('chat_for_live_stream') + ' ' + video.name + // Adding attachments, as described in FEP-1970 const discussionLinks: LiveChatVideoObject['attachment'] = [] discussionLinks.push({ type: 'Link', - name: 'Chat', // TODO: getter naming, maybe use chat_for_live_stream loc string + name: chatTitle, rel: 'discussion', href: getPublicChatUri(options, videoJsonld) }) @@ -99,7 +102,7 @@ async function videoBuildJSONLD ( if (serverInfos.directs2s) { discussionLinks.push({ type: 'Link', - name: 'Chat', // TODO: getter naming, maybe use chat_for_live_stream loc string + name: chatTitle, rel: 'discussion', href: 'xmpp://' + roomJID + '?join' }) diff --git a/support/documentation/content/contributing/translate/_index.en.md b/support/documentation/content/contributing/translate/_index.en.md index 1a46e5d8..116b8ee6 100644 --- a/support/documentation/content/contributing/translate/_index.en.md +++ b/support/documentation/content/contributing/translate/_index.en.md @@ -73,7 +73,8 @@ Now, you can simply call `peertubeHelpers.translate(LOC_USE_CHAT)` in your code. ### Use translations in back-end code In theory, the only parts of the backend code where you need localization is the -settings declaration. Here we need to get english strings from the translation key. +settings declaration and standardized data (ActivityPub, RSS, ...). +Here we need to get english strings from the translation key. Note: you should never need another language translation from backend code. Localization must be done on front-end. diff --git a/support/documentation/content/contributing/translate/_index.fr.md b/support/documentation/content/contributing/translate/_index.fr.md index 0ddf4486..e6e8b64b 100644 --- a/support/documentation/content/contributing/translate/_index.fr.md +++ b/support/documentation/content/contributing/translate/_index.fr.md @@ -78,7 +78,7 @@ Vous pouvez maintenant utiliser `peertubeHelpers.translate(LOC_USE_CHAT)` dans v ### Utiliser un segment dans le code back-end -En théorie, les seules parties du code qui ont besoin de traductions sont les déclarations de paramètres. +En théorie, les seules parties du code qui ont besoin de traductions sont les déclarations de paramètres et la génération de données standardisées (ActivityPub, RSS, ...). Ici on a besoin de récupérer les chaînes anglaises à partir des clés de traduction. Note: vous ne devriez jamais avoir besoin d'autres langues que l'anglais pour le code backend.