This repository contains the source code for the TeleCloud web interface.
templates/: Go HTML templates.static/: Frontend assets (CSS, JS, Fonts).static/locales/: JSON translation files.tailwind.config.js: Tailwind CSS configuration.package.json: Dependencies and build scripts.build.js: Unified build engine (Tailwind, esbuild, sync/minify locales, download static libs).sync_locales.js: Utility script to sync missing translation keys fromen.jsoninto all other locale files (run viabun run sync-locales).
If you would like to contribute a new language or improve an existing translation, please follow these steps:
- Locate translation files: Language files are located in the
static/locales/directory in JSON format (e.g.,en.json,vi.json). - Add a new language:
- Create a new JSON file with the ISO language code (e.g.,
fr.jsonfor French). - Copy the content from
en.jsonand translate the values into your language. - Open
static/js/common.jsand make the following changes:- Add the new language to the
availableLangsarray:{ code: 'fr', name: 'Français', flag: '🇫🇷' }
- Add the language code to the
supportedarray (used for browser language auto-detection):const supported = ['vi', 'en', ..., 'fr'];
- Add a locale mapping to the
localeMapobject (used for date formatting):'fr': 'fr-FR'
- Add the new language to the
- Create a new JSON file with the ISO language code (e.g.,
- Submit a Pull Request: Once finished, submit a Pull Request (PR) to this repository.
The main TeleCloud repository integrates this as a git submodule. During the build process (Docker or GitHub Actions), the following steps are performed:
- Fetch this submodule into the
web/directory. - Run
build-frontend.sh(Linux/macOS) orbuild-frontend.ps1(Windows) to generate minified assets (*.min.js,*.min.css,*.min.json). - Compile the Go binary with embedded assets.
- Cleans up old minified files (
*.min.css,*.min.js,*.min.json). - Optionally pulls latest changes from
origin/main(pass1as first argument to enable). - Verifies bun is installed — installs it automatically if not.
- Runs
bun installto install dependencies. - Executes
build.jswhich handles (all in parallel):- Building Tailwind CSS via
@tailwindcss/cli. - Bundling and minifying JS and CSS files via
esbuild. - Minifying theme CSS files.
- Syncing and minifying JSON locale files.
- Downloading static libraries from CDN:
pdf.min.jsandpdf.worker.min.js(PDF.js v3.11.174 from cdnjs)
- Building Tailwind CSS via
To manually build the frontend assets:
- Ensure you have bun installed.
- Run the build command:
Alternatively, you can use the wrapper scripts:
cd web bun install bun run build.js# Linux/macOS ./build-frontend.sh # Windows (PowerShell) .\build-frontend.ps1 # Windows (CMD) build-frontend.bat
Minified files are ignored by git to keep the repository clean. They are generated only during the build process.
Developed by @dabeecao