diff --git a/.github/scripts/download-translations.js b/.github/scripts/download-translations.js index 918be97d3..8f35be0de 100644 --- a/.github/scripts/download-translations.js +++ b/.github/scripts/download-translations.js @@ -1,45 +1,60 @@ -import axios from 'axios'; -import fs from 'fs-extra'; -import path from 'path'; -import { URLSearchParams } from 'url'; +import axios from "axios"; +import fs from "fs-extra"; +import path from "path"; +import { URLSearchParams } from "url"; // POEditor API information const API_TOKEN = process.env.POEDITOR_API; const PROJECT_ID = process.env.POEDITOR_PROJECT_ID; -const LANGUAGES = (process.env.LANGUAGES || 'tr,en').split(','); -const EXPORT_FORMAT = process.env.EXPORT_FORMAT || 'key_value_json'; +const LANGUAGES = (process.env.LANGUAGES || "tr,en").split(","); +const EXPORT_FORMAT = process.env.EXPORT_FORMAT || "key_value_json"; // POEditor API endpoint -const API_URL = 'https://api.poeditor.com/v2'; +const API_URL = "https://api.poeditor.com/v2"; + +function normalizeLanguageCode(language) { + if (language.includes("-")) { + const [base, region] = language.split("-"); + return `${base}-${region.toUpperCase()}`; + } + return language; +} // Function to download translations async function downloadTranslations() { try { - console.log('Downloading translations from POEditor...'); + console.log("Downloading translations from POEditor..."); console.log(`Using export format: ${EXPORT_FORMAT}`); for (const language of LANGUAGES) { console.log(`Downloading translations for ${language} language...`); // Get export URL from POEditor - const exportResponse = await axios.post(`${API_URL}/projects/export`, + const exportResponse = await axios.post( + `${API_URL}/projects/export`, new URLSearchParams({ api_token: API_TOKEN, id: PROJECT_ID, language: language, - type: EXPORT_FORMAT + type: EXPORT_FORMAT, }) ); - if (exportResponse.data.response.status !== 'success') { - throw new Error(`Failed to get export URL for ${language} language: ${JSON.stringify(exportResponse.data)}`); + if (exportResponse.data.response.status !== "success") { + throw new Error( + `Failed to get export URL for ${language} language: ${JSON.stringify( + exportResponse.data + )}` + ); } const fileUrl = exportResponse.data.result.url; console.log(`Export URL obtained for ${language}`); // Download translation file - const downloadResponse = await axios.get(fileUrl, { responseType: 'json' }); + const downloadResponse = await axios.get(fileUrl, { + responseType: "json", + }); const translations = downloadResponse.data; console.log(`Downloaded translations for ${language}`); @@ -48,9 +63,11 @@ async function downloadTranslations() { // If data is in array format, convert it to key-value format if (Array.isArray(translations)) { - console.log(`Converting array format to key-value format for ${language}`); + console.log( + `Converting array format to key-value format for ${language}` + ); formattedTranslations = {}; - translations.forEach(item => { + translations.forEach((item) => { if (item.term && item.definition) { formattedTranslations[item.term] = item.definition; } @@ -58,16 +75,19 @@ async function downloadTranslations() { } // Determine the output filename based on language - const filename = language === 'en' ? 'gb.json' : `${language}.json`; - const outputPath = path.join(process.cwd(), 'temp', filename); + const normalizedLanguage = normalizeLanguageCode(language); + const filename = `${normalizedLanguage}.json`; + const outputPath = path.join(process.cwd(), "temp", filename); await fs.writeJson(outputPath, formattedTranslations, { spaces: 2 }); - console.log(`Translations for ${language} language successfully downloaded and saved as: ${filename}`); + console.log( + `Translations for ${language} language successfully downloaded and saved as: ${filename}` + ); } - console.log('All translations successfully downloaded!'); + console.log("All translations successfully downloaded!"); } catch (error) { - console.error('An error occurred while downloading translations:', error); + console.error("An error occurred while downloading translations:", error); process.exit(1); } } @@ -76,15 +96,15 @@ async function downloadTranslations() { async function main() { try { // Clean temp folder - await fs.emptyDir(path.join(process.cwd(), 'temp')); + await fs.emptyDir(path.join(process.cwd(), "temp")); // Download translations await downloadTranslations(); } catch (error) { - console.error('An error occurred during the process:', error); + console.error("An error occurred during the process:", error); process.exit(1); } } // Run script -main(); \ No newline at end of file +main(); diff --git a/.github/workflows/poeditor-sync.yml b/.github/workflows/poeditor-sync.yml index 8446745bc..83dac7f09 100644 --- a/.github/workflows/poeditor-sync.yml +++ b/.github/workflows/poeditor-sync.yml @@ -7,13 +7,12 @@ on: languages: description: "Languages to synchronize (comma separated, e.g.: tr,en,es)" required: false - default: "tr,en" + default: "ar,zh-tw,cs,en,fi,fr,de,pt-br,ru,es,tr" format: description: "Export format (key_value_json or json)" required: false default: "key_value_json" - permissions: contents: write pull-requests: write @@ -93,6 +92,12 @@ jobs: id: date run: echo "date=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_OUTPUT + - name: Format client code + run: | + cd client + npm ci + npm run format + - name: Create Pull Request uses: peter-evans/create-pull-request@v7 with: diff --git a/README.md b/README.md index b1330a17a..d276af81f 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ If you have any questions, suggestions or comments, please use our [Discord chan ## 🧩 Features -- Completely open source, deployable on your servers +- Completely open source, deployable on your servers or home devices (e.g Raspberry Pi 4 or 5) - Website monitoring - Page speed monitoring - Infrastructure monitoring (memory, disk usage, CPU performance etc) - requires [Capture](https://github.com/bluewave-labs/capture) @@ -65,18 +65,17 @@ If you have any questions, suggestions or comments, please use our [Discord chan - SSL monitoring - Port monitoring - Incidents at a glance -- E-mail notifications +- Status pages +- E-mail, Webhooks, Discord, Telegram, Slack notifications - Scheduled maintenance +- JSON query monitoring +- Support for multiple languages -**Short term roadmap:** +**Short term roadmap:** ([Milestone 2.2](https://github.com/bluewave-labs/Checkmate/milestone/8)) -- Status pages (**in progress**) https://github.com/bluewave-labs/Checkmate/issues/1131 -- Translations (i18n) (**in progress**) -- Better notification options (Webhooks, Discord, Telegram, Slack) (**in progress**) https://github.com/bluewave-labs/Checkmate/issues/1545 -- JSON query monitoring (**in progress**) https://github.com/bluewave-labs/Checkmate/issues/1573 -- Tagging/grouping monitors https://github.com/bluewave-labs/Checkmate/issues/1546 -- More configuration options -- DNS monitoring +- Better notifications +- Network monitoring +- ..and a few more features ## 🏗️ Screenshots @@ -108,9 +107,9 @@ If you have any questions, suggestions or comments, please use our [Discord chan ## 🤝 Contributing -We are [Alex](http://github.com/ajhollid) (team lead), [Vishnu](http://github.com/vishnusn77), [Mohadeseh](http://github.com/mohicody), [Gorkem](http://github.com/gorkem-bwl/), [Owaise](http://github.com/Owaiseimdad), [Aryaman](https://github.com/Br0wnHammer) and [Mert](https://github/com/mertssmnoglu) helping individuals and businesses monitor their infra and servers. +We are [Alex](http://github.com/ajhollid) (team lead), [Vishnu](http://github.com/vishnusn77), [Mohadeseh](http://github.com/mohicody), [Gorkem](http://github.com/gorkem-bwl/), [Owaise](http://github.com/Owaiseimdad), [Aryaman](https://github.com/Br0wnHammer) and [Mert](https://github.com/mertssmnoglu) helping individuals and businesses monitor their infra and servers. -We pride ourselves on building strong connections with contributors at every level. Despite being a young project, Checkmate has already earned 5000+ stars and attracted 60 contributors from around the globe. +We pride ourselves on building strong connections with contributors at every level. Despite being a young project, Checkmate has already earned 5800+ stars and attracted 70+ contributors from around the globe. Our repo is starred by employees from **Google, Microsoft, Intel, Cisco, Tencent, Electronic Arts, ByteDance, JP Morgan Chase, Deloitte, Accenture, Foxconn, Broadcom, China Telecom, Barclays, Capgemini, Wipro, Cloudflare, Dassault Systèmes and NEC**, so don’t hold back — jump in, contribute and learn with us! diff --git a/client/README.md b/client/README.md index ee3ed2de2..55bc1efe2 100644 --- a/client/README.md +++ b/client/README.md @@ -1,2 +1 @@ - This directory contains the client side (frontend) of Checkmate. diff --git a/client/index.html b/client/index.html index a667d1ecf..0b0f675b4 100644 --- a/client/index.html +++ b/client/index.html @@ -1,17 +1,24 @@ +
+ + + - - - - +