@ -46,6 +47,12 @@ async function routes(app: FastifyInstance) {
description:
description:
'As `users/whoami` answers it: `authenticated: false` alone for a guest, otherwise the account and its group-wide permissions.',
'As `users/whoami` answers it: `authenticated: false` alone for a guest, otherwise the account and its group-wide permissions.',
additionalProperties: true
additionalProperties: true
},
locales:{
type:'array',
description:
'Every installed locale, named and coded as this wiki refers to it. None of it can be worked out from a code alone: the short forms depend on which other locales exist, and an administrator can override either. Sent here because the locale selector needs it to label itself on the first paint.',
items:{$ref:'Locale#'}
}
}
}
}
}
}
@ -69,7 +76,8 @@ async function routes(app: FastifyInstance) {
summary:'Fetch the latest locales from the Wiki.js repository',
description:
'Reads the published locale metadata and records any locale not seen before as available. An installed locale is re-downloaded only when its published hash differs from the one stored, so a run that finds nothing new costs a single request.',
tags:['Locales'],
response:{
200:{
description:'Locales fetched successfully',
type:'object',
properties:{
ok:{type:'boolean'},
added:{
type:'integer',
description:'Locales newly available, whose strings were not downloaded.'
},
updated:{
type:'integer',
description:'Installed locales whose strings changed upstream and were refreshed.'
summary:'Download the strings of an available locale',
description:
'Downloads the published strings file for a locale that has a row but no strings, making it installable on a site. Fetch the locale list first: a locale nobody has heard of yet has no row to install.',
tags:['Locales'],
params:{
type:'object',
properties:{
code:{type:'string',description:'The locale code, e.g. `fr-FR`.'}
summary:'Set what a locale is called and addressed as',
description:
'Overrides the name and the short code derived from the language tag — `zh` for `zh-CN`. The locale is still identified everywhere by its `code`, so nothing already recorded against it moves. An empty value puts the derived form back, and so does the derived form itself.',
tags:['Locales'],
params:{
type:'object',
properties:{
code:{type:'string',description:'The locale code, e.g. `zh-CN`.'}
}
},
body:{
type:'object',
properties:{
customName:{
type:['string','null'],
maxLength: 255,
description:'The name to show, or empty to go back to the derived one.'
},
customCode:{
type:['string','null'],
maxLength: 255,
description:'The short code to show, or empty to go back to the derived one.'
@ -736,7 +736,7 @@ async function routes(app: FastifyInstance) {
schema:{
schema:{
summary:'Move a page to another path',
summary:'Move a page to another path',
description:
description:
'Also renames it when a title is given. The tree entry moves with it, and any folder the new path needs is created.',
'Also renames it when a title is given, and moves it to another locale when one is given. The tree entry moves with it, any folder the new path needs is created, and the copy on every storage target follows.\n\nMoving between locales needs `manage:pages` at the destination as well as at the source, since page rules are granted per locale.',
tags:['Pages'],
tags:['Pages'],
params: pageIdParam,
params: pageIdParam,
body:{
body:{
@ -748,6 +748,11 @@ async function routes(app: FastifyInstance) {
maxLength: 255,
maxLength: 255,
pattern:'^/?[a-zA-Z0-9-_/]*$'
pattern:'^/?[a-zA-Z0-9-_/]*$'
},
},
locale:{
type:'string',
maxLength: 255,
description:'The locale to move it to. Stays in its own when absent.'
},
title:{
title:{
type:'string',
type:'string',
minLength: 1,
minLength: 1,
@ -783,6 +788,22 @@ async function routes(app: FastifyInstance) {
if(!mayOnPage(req,'manage:pages',target)){
if(!mayOnPage(req,'manage:pages',target)){
returnreply.forbidden('You are not allowed to move this page.')
returnreply.forbidden('You are not allowed to move this page.')
description:'The language tag identifying this locale, e.g. `zh-CN`.'
},
language:{
type:'string',
description:'The bare language subtag, e.g. `zh`.'
},
name:{
type:'string',
description:
'The name in English, qualified by region only where a second locale shares the language: "German", but "Chinese (China)" beside "Chinese (Taiwan)".'
},
nativeName:{
type:'string',
description:'The same name, in the locale itself.'
},
customName:{
type:['string','null'],
description:'The name an administrator set instead, or null.'
},
customCode:{
type:['string','null'],
description:'The short code an administrator set instead, or null.'
},
derivedCode:{
type:'string',
description:
'The short code the tag gives on its own: the language subtag where nothing else shares it, the whole tag where something does. What clearing `customCode` goes back to.'
},
displayCode:{
type:'string',
description:'The short code to show: `customCode`, or `derivedCode`.'
},
displayName:{
type:'string',
description:
'The single line to show wherever the locale is offered rather than described: `customName`, or the native name.'
},
isRTL:{
type:'boolean',
description:'Whether the script runs right to left.'
},
isInstalled:{
type:'boolean',
description:
'Whether the strings have been downloaded. A locale that is merely published upstream has a row so it can be offered, but nothing to serve until it is installed.'
},
completeness:{
type:'integer',
description:'How much of the string set is translated, as a percentage.'