Localized help urls:

Links to documentation are now using the front-end language to point to the translated documentation page
(except for some links generated from the backend, in the diagnostic tool for example).

Partial fix for #224.
This commit is contained in:
John Livingston
2023-09-06 17:58:54 +02:00
parent 21de3404c3
commit 5ecff1d916
5 changed files with 57 additions and 8 deletions

View File

@ -1,7 +1,7 @@
import type { Video } from '@peertube/peertube-types'
import type { RegisterClientOptions } from '@peertube/peertube-types/client'
import { videoHasWebchat, videoHasRemoteWebchat } from 'shared/lib/video'
import { helpUrl } from 'shared/lib/help'
import { localizedHelpUrl } from './utils/help'
import { logger } from './videowatch/logger'
import { closeSVG, openBlankChatSVG, openChatSVG, shareChatUrlSVG, helpButtonSVG } from './videowatch/buttons'
import { displayButton, displayButtonOptions } from './videowatch/button'
@ -74,6 +74,9 @@ function register (registerOptions: RegisterClientOptions): void {
container: HTMLElement, video: Video, showOpenBlank: boolean, showShareUrlButton: boolean
): Promise<void> {
logger.log('Adding livechat in the DOM...')
const viewersDocumentationHelpUrl = await localizedHelpUrl(registerOptions, {
page: 'documentation/user/viewers'
})
const p = new Promise<void>((resolve, reject) => {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
Promise.all([
@ -137,9 +140,7 @@ function register (registerOptions: RegisterClientOptions): void {
buttonContainer,
name: 'help',
label: labelHelp,
href: helpUrl({
page: 'documentation/user/viewers'
}),
href: viewersDocumentationHelpUrl,
targetBlank: true,
icon: helpButtonSVG,
additionalClasses: []