FEP-1970: name attribute.

Related to #113.
This commit is contained in:
John Livingston 2023-07-05 12:10:27 +02:00
parent f7e7cddf72
commit 3627ef25f6
No known key found for this signature in database
GPG Key ID: B17B5640CE66CDBC
3 changed files with 8 additions and 4 deletions

View File

@ -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'
})

View File

@ -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.

View File

@ -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.