@@ -5,7 +5,7 @@
|
||||
# --------------------------------------------------------------------------------
|
||||
# To update the sha, run `docker pull node:$VERSION-alpine`
|
||||
# look for something like: `Digest: sha256:0123456789abcdef`
|
||||
FROM node:18-alpine@sha256:93d91deea65c9a0475507e8bc8b1917d6278522322f00c00b3ab09cab6830060 as base
|
||||
FROM node:18-alpine@sha256:58878e9e1ed3911bdd675d576331ed8838fc851607aed3bb91e25dfaffab3267 as base
|
||||
|
||||
# This directory is owned by the node user
|
||||
ARG APP_HOME=/home/node/app
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* It looks for easy "low hanging fruit" that we can correct for.
|
||||
*
|
||||
*/
|
||||
export function correctTranslatedContentStrings(content, englishContent, debug = false) {
|
||||
export function correctTranslatedContentStrings(content, englishContent, context = {}) {
|
||||
// A lot of translations have corruptions around the AUTOTITLE links.
|
||||
// We've requested that these are corrected back but as a temporary
|
||||
// solution we'll manually recover now.
|
||||
@@ -86,5 +86,31 @@ export function correctTranslatedContentStrings(content, englishContent, debug =
|
||||
// are suddenly gone.
|
||||
content = content.replaceAll(' | | ', ' |\n| ')
|
||||
|
||||
// This is a bit of a hack, but it works.
|
||||
// It looks for patterns like this:
|
||||
//
|
||||
// Some words --------|-------|{
|
||||
//
|
||||
// And from that it tries to convert it to:
|
||||
//
|
||||
// Some words
|
||||
// --------|-------|{
|
||||
//
|
||||
// But because it's quite a broad solution specifically around any
|
||||
// Markdown table syntax, let's be extra careful and only apply it
|
||||
// to the select few pages with known problems.
|
||||
if (context.relativePath?.endsWith('scopes-for-oauth-apps.md')) {
|
||||
if (context.code === 'pt') {
|
||||
// As of Aug 2023, the Portuguese translation seems to have lost the
|
||||
// `|` characters in their Markdown table syntax.
|
||||
content = content.replace(/(\w)(\s-+\s-+\s){%/g, (whole, start, rest) => {
|
||||
return `${start}\n${rest.replace(/\s/g, '|')}`
|
||||
})
|
||||
}
|
||||
content = content.replace(/(\S\s*)(--+\|--+\|{)/, (whole, start, rest) => {
|
||||
return `${start}\n${rest}`
|
||||
})
|
||||
}
|
||||
|
||||
return content
|
||||
}
|
||||
|
||||
@@ -150,7 +150,10 @@ async function translateTree(dir, langObj, enTree) {
|
||||
)
|
||||
|
||||
// The "content" isn't a frontmatter key
|
||||
translatedData.markdown = correctTranslatedContentStrings(content, enPage.markdown)
|
||||
translatedData.markdown = correctTranslatedContentStrings(content, enPage.markdown, {
|
||||
relativePath,
|
||||
code: langObj.code,
|
||||
})
|
||||
|
||||
item.page = new Page(
|
||||
Object.assign(
|
||||
|
||||
Reference in New Issue
Block a user