Localization refactoring:

* the front-end now use global constants, based on the translation key
* build-client.js use the ESBuild "define" directive to replace these
  globals at compile time, by the english value
* build:client must now be called after build:languages
* moving the loadLoc and loc backend functions in a separate lib
This commit is contained in:
John Livingston
2023-06-12 19:26:28 +02:00
parent 7285c8b0a8
commit f73ccbbf7e
12 changed files with 199 additions and 93 deletions

View File

@ -76,10 +76,10 @@ function register (registerOptions: RegisterClientOptions): void {
const p = new Promise<void>((resolve, reject) => {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
Promise.all([
peertubeHelpers.translate('Open chat'),
peertubeHelpers.translate('Open chat in a new window'),
peertubeHelpers.translate('Close chat'),
peertubeHelpers.translate('Share chat link')
peertubeHelpers.translate(LOC_OPEN_CHAT),
peertubeHelpers.translate(LOC_OPEN_CHAT_NEW_WINDOW),
peertubeHelpers.translate(LOC_CLOSE_CHAT),
peertubeHelpers.translate(LOC_SHARE_CHAT_LINK)
]).then(labels => {
const labelOpen = labels[0]
const labelOpenBlank = labels[1]