Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat - create page by action to verify status - (TEST) #1586

Open
wants to merge 31 commits into
base: gh-pages
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
8aa1746
feat - create page by action to verify status
carlosstenzel Aug 30, 2024
917818c
feat - create file to re-write
carlosstenzel Aug 30, 2024
0015734
fix - adjust path
carlosstenzel Aug 30, 2024
570d5a5
feat - change actions
carlosstenzel Aug 30, 2024
d66f270
fix - try run direct script
carlosstenzel Aug 30, 2024
f0633ca
feat - migrete for run script
carlosstenzel Aug 30, 2024
1875a9e
fix - force create and commit file
carlosstenzel Aug 30, 2024
a67b098
fix - test commit in PR
carlosstenzel Aug 30, 2024
2d9acdf
fix - add command to check branch
carlosstenzel Aug 30, 2024
7e1098c
fix - add git status
carlosstenzel Aug 30, 2024
7e8070c
fix - change commit method
carlosstenzel Aug 30, 2024
90348cc
fix - change ref to branch
carlosstenzel Aug 30, 2024
1e47e27
fix - add ref in action
carlosstenzel Aug 30, 2024
22179c0
fix - remove command
carlosstenzel Aug 30, 2024
40aa526
fix - set set name
carlosstenzel Aug 30, 2024
7c1c685
fix - test force checkout
carlosstenzel Aug 30, 2024
ac87df2
fix - comment command
carlosstenzel Aug 30, 2024
39a47ca
fix - change ref in ckeckout
carlosstenzel Aug 30, 2024
caa46a5
fix - change version
carlosstenzel Aug 30, 2024
2c17089
feat - run manual script
carlosstenzel Aug 30, 2024
c4074fa
Merge branch 'expressjs:gh-pages' into feat/create-status-page
carlosstenzel Aug 30, 2024
7a069cd
fix - adjust layout
carlosstenzel Aug 30, 2024
c22e9e6
Merge branch 'feat/create-status-page' of https://github.com/carlosst…
carlosstenzel Aug 30, 2024
c5fae64
fix - change script
carlosstenzel Aug 30, 2024
b3878e4
fix - try change version
carlosstenzel Aug 30, 2024
3c5a8a1
fix - try new ref
carlosstenzel Aug 30, 2024
dab4e70
fix - remove fetch-depth
carlosstenzel Aug 30, 2024
dbb1fba
fix - remove fix
carlosstenzel Aug 30, 2024
b947150
fix - try add permission
carlosstenzel Aug 31, 2024
cc0bc69
fix - remove npm i in action
carlosstenzel Sep 2, 2024
7dd9444
fix - add ref for pull request
carlosstenzel Sep 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/status-translation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: status-translation

on:
pull_request:
branches:
- gh-pages
paths:
- 'en/**'
- 'de/**'
- 'es/**'
- 'fr/**'
- 'it/**'
- 'ja/**'
- 'ko/**'
- 'pt-br/**'
- 'ru/**'
- 'sk/**'
- 'th/**'
- 'tr/**'
- 'uk/**'
- 'uz/**'
- 'zh-cn/**'
- 'zh-tw/**'

jobs:
verify-translation:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v4
with:
node-version: '20'
- run: |
npm install
carlosstenzel marked this conversation as resolved.
Show resolved Hide resolved
npm run verify-translation

git branch --show-current

git config --global user.name 'GitHub Actions Bot'
git config --global user.email "carlosstenzel@hotmail.com"
git add .
git status
git commit -m "generated"
git push


3 changes: 3 additions & 0 deletions _includes/header/header-en.html
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@
<li>
<a href="/{{ page.lang }}/changelog/4x.html">Release Change Log</a>
</li>
<li>
<a href="/{{ page.lang }}/resources/status-translate.html">Status Translate</a>
</li>
</ul>
</li>
</ul>
Expand Down
63 changes: 63 additions & 0 deletions en/resources/status-translate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
layout: page
title: Status Translate
menu: resources
lang: en
redirect_from: "/resources/status-translate.html"
---

# Status Translate

This page shows the status of the translation of the documentation into different languages.

| en | pt-br | es | de | fr | it | ja | ko | ru | tr | th | sk | uz | zh-cn | zh-tw |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| guide/behind-proxies.md | ✅ | ✅ | 🔄 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| guide/database-integration.md | ✅ | ✅ | 🔄 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| guide/debugging.md | ✅ | ✅ | 🔄 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| guide/error-handling.md | ✅ | ✅ | 🔄 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| guide/migrating-4.md | ✅ | ✅ | 🔄 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| guide/migrating-5.md | ✅ | ✅ | 🔄 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ |
| guide/overriding-express-api.md | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ |
| guide/routing.md | ✅ | ✅ | 🔄 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| guide/using-middleware.md | ✅ | ✅ | 🔄 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| guide/using-template-engines.md | ✅ | ✅ | 🔄 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| guide/writing-middleware.md | ✅ | ✅ | 🔄 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ |
| resources/community.md | ✅ | ✅ | 🔄 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| resources/contributing.md | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ |
| resources/glossary.md | ✅ | ✅ | 🔄 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| resources/middleware.md | ✅ | ✅ | 🔄 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| resources/status-translate.md | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| resources/utils.md | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ |
| resources/middleware/body-parser.md | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ |
| resources/middleware/compression.md | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ |
| resources/middleware/connect-rid.md | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ |
| resources/middleware/cookie-parser.md | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ |
| resources/middleware/cookie-session.md | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ |
| resources/middleware/cors.md | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ |
| resources/middleware/errorhandler.md | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ |
| resources/middleware/method-override.md | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ |
| resources/middleware/morgan.md | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ |
| resources/middleware/multer.md | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ |
| resources/middleware/response-time.md | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ |
| resources/middleware/serve-favicon.md | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ |
| resources/middleware/serve-index.md | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ |
| resources/middleware/serve-static.md | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ |
| resources/middleware/session.md | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ |
| resources/middleware/timeout.md | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ |
| resources/middleware/vhost.md | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ |
| starter/basic-routing.md | ✅ | ✅ | 🔄 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| starter/examples.md | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| starter/faq.md | ✅ | ✅ | 🔄 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| starter/generator.md | ✅ | ✅ | 🔄 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| starter/hello-world.md | ✅ | ✅ | 🔄 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| starter/installing.md | ✅ | ✅ | 🔄 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| starter/static-files.md | ✅ | ✅ | 🔄 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| advanced/best-practice-performance.md | ✅ | ✅ | 🔄 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ |
| advanced/best-practice-security.md | ✅ | ✅ | 🔄 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ |
| advanced/developing-template-engines.md | ✅ | ✅ | 🔄 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| advanced/healthcheck-graceful-shutdown.md | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| advanced/security-updates.md | ✅ | ✅ | 🔄 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| 3x/api.md | ✅ | ✅ | 🔄 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| 4x/api.md | ✅ | ✅ | 🔄 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| 5x/api.md | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"version": "0.0.0",
"private": true,
"scripts": {
"test": "eslint --ignore-path .gitignore --ignore-pattern _includes/readmes/ \"**/*.md\""
"test": "eslint --ignore-path .gitignore --ignore-pattern _includes/readmes/ \"**/*.md\"",
"verify-translation": "node ./translationStatusScript.js"
},
"devDependencies": {
"eslint": "^8.54.0",
Expand Down
109 changes: 109 additions & 0 deletions translationStatusScript.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
const fs = require('node:fs')

const contentBase = `---
layout: page
title: Status Translate
menu: resources
lang: en
redirect_from: "/resources/status-translate.html"
---

# Status Translate

This page shows the status of the translation of the documentation into different languages.

| en |`

let content = contentBase

const languageBase = 'en'
const verifyLanguage = ['pt-br', 'es', 'de', 'fr', 'it', 'ja', 'ko', 'ru', 'tr', 'th', 'sk', 'uz', 'zh-cn', 'zh-tw']

const statusTranslate = []
statusTranslate[`${languageBase}`] = []

verifyLanguage.forEach((language) => {
content = content + ` ${language} |`
statusTranslate[`${language}`] = []
})

content = content + '\n |---|'

verifyLanguage.forEach(() => {
content = content + '---|'
})

content = content + '\n'

const ignoreFiles = ['resources/status-translate']

const languageBaseFiles = ['guide', 'resources', 'resources/middleware', 'starter', 'advanced', '3x', '4x', '5x']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not necessary to keep checking if the API versions are translated, and I don't think it will be necessary to keep looking at 'resources/middleware' either, as it is an external resource that is extracted by running a script.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the language (th) there are translated 'resources/middleware'

https://deploy-preview-1586--expressjscom-preview.netlify.app/en/resources/status-translate

Captura de Tela 2024-09-01 às 22 09 38

the API page has been translated into other languages


languageBaseFiles.forEach((pathVerify) => {
const files = fs.readdirSync(`./${languageBase}/${pathVerify}`)
const filesFiltered = files.filter((file) => file.includes('.md'))

verifyLanguage.forEach((language) => {
const verifyPath = fs.existsSync(`./${language}/${pathVerify}`)

let filesCompare = []
let filesFilteredCompare = []

if (verifyPath) {
filesCompare = fs.readdirSync(`./${language}/${pathVerify}`)
filesFilteredCompare = filesCompare.filter((file) => file.includes('.md'))
}

filesFiltered.forEach((file) => {
const getFileName = file

if (ignoreFiles.includes(getFileName)) return

statusTranslate[languageBase][`${pathVerify}/${getFileName}`] = `${pathVerify}/${getFileName}`

const getDateModified = fs.statSync(`./${languageBase}/${pathVerify}/${file}`).mtime
const dateFile = new Date(getDateModified)

if (filesFilteredCompare.includes(file)) {
const verifyFileToCompare = fs.existsSync(`./${language}/${pathVerify}/${file}`)

if (!verifyFileToCompare) {
statusTranslate[language][`${pathVerify}/${getFileName}`] = '❌'
return
}

const getDateModifiedCompare = fs.statSync(`./${language}/${pathVerify}/${file}`).mtime
const dateCompare = new Date(getDateModifiedCompare)

if (dateFile.getTime() <= dateCompare.getTime()) {
statusTranslate[language][`${pathVerify}/${getFileName}`] = '✅'
} else {
statusTranslate[language][`${pathVerify}/${getFileName}`] = '🔄'
}
} else {
statusTranslate[language][`${pathVerify}/${getFileName}`] = '❌'
}
})
})
})

let createTable = ''

Object.keys(statusTranslate[languageBase]).forEach((key) => {
createTable = createTable + `| ${key} | `
verifyLanguage.forEach((language) => {
createTable = createTable + `${statusTranslate[language][key]} | `
})
createTable = createTable + '\n'
})

content = content + `${createTable}`

fs.writeFile('./en/resources/status-translate.md', content, (err) => {
if (err) {
console.error(err)
} else {
// file written successfully
console.log('Status Translate file created')
}
})
Loading