Skip to content

Commit 2e2c6ea

Browse files
feat: initial version
1 parent 8bd2c75 commit 2e2c6ea

14 files changed

Lines changed: 1637 additions & 3 deletions

.github/workflows/_ci-node.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
# This workflow is centrally managed in https://github.com/LizardByte/.github/
3+
# Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in
4+
# the above-mentioned repo.
5+
6+
# To use, add the `npm-pkg` repository label to identify repositories that should trigger this workflow.
7+
8+
# This will run standard CI for Node.js/npm/TypeScript projects.
9+
10+
name: CI-Node
11+
permissions: {}
12+
13+
on:
14+
pull_request:
15+
push:
16+
branches:
17+
- master
18+
19+
concurrency:
20+
group: "${{ github.workflow }}-${{ github.ref }}"
21+
cancel-in-progress: true
22+
23+
jobs:
24+
call-ci-node:
25+
name: CI-Node
26+
uses: LizardByte/.github/.github/workflows/__call-ci-node.yml@master
27+
if: ${{ github.repository != 'LizardByte/.github' }}
28+
permissions:
29+
contents: write # required for release_setup action
30+
secrets:
31+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
32+
GH_TOKEN: ${{ secrets.GH_BOT_TOKEN }}
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
---
2+
# Syncs Crowdin distribution files from distributions.crowdin.net to a
3+
# dedicated git branch (dist) served via jsDelivr CDN.
4+
#
5+
# proxy-translator.js fetches manifest.json, languages.json and all translation
6+
# JSON files from https://distributions.crowdin.net. Those requests count
7+
# against the LizardByte Crowdin free-tier quota, so we mirror the content
8+
# here (refreshed daily) and redirect browser fetch() calls to jsDelivr via
9+
# the interceptor in src/js/crowdin.js.
10+
#
11+
# jsDelivr CDN URL pattern:
12+
# https://cdn.jsdelivr.net/gh/LizardByte/i18n@dist/<hash>/…
13+
#
14+
# jsDelivr guarantees Access-Control-Allow-Origin: * on all responses, which
15+
# means no CORS plugin is required in consumer pages.
16+
17+
name: Sync Crowdin Distribution
18+
permissions: {}
19+
20+
on:
21+
schedule:
22+
# Run daily at 02:00 UTC so translations are fresh at the start of each day.
23+
- cron: '0 2 * * *'
24+
workflow_dispatch: # Allow ad-hoc manual runs
25+
26+
# Only one deployment at a time; do not cancel an in-progress run.
27+
concurrency:
28+
group: crowdin-dist-sync
29+
cancel-in-progress: false
30+
31+
jobs:
32+
sync:
33+
name: Sync distributions to crowdin-dist branch
34+
runs-on: ubuntu-latest
35+
permissions:
36+
contents: write
37+
environment:
38+
name: crowdin-dist
39+
url: ${{ github.server_url }}/${{ github.repository }}/tree/dist
40+
if: github.repository_owner == 'LizardByte' # don't run for forks
41+
42+
steps:
43+
- name: Checkout
44+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
45+
with:
46+
token: ${{ secrets.GH_BOT_TOKEN }}
47+
48+
- name: Set up Node.js
49+
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
50+
with:
51+
node-version: 'node'
52+
53+
- name: Download Crowdin distribution files
54+
env:
55+
CROWDIN_DISTRIBUTION_IDS: ${{ vars.CROWDIN_DISTRIBUTION_IDS }}
56+
OUTPUT_DIR: /tmp/dist
57+
run: node src/sync-crowdin-distribution.cjs
58+
59+
- name: Commit and push to dist branch
60+
env:
61+
GH_BOT_NAME: ${{ vars.GH_BOT_NAME }}
62+
GH_BOT_EMAIL: ${{ secrets.GH_BOT_EMAIL }}
63+
run: |
64+
git config user.name "${GH_BOT_NAME}"
65+
git config user.email "${GH_BOT_EMAIL}"
66+
67+
# Create an orphan branch so the branch contains only distribution
68+
# files with no history from main (keeps the branch lean).
69+
git checkout --orphan dist
70+
71+
# Remove every file that was inherited from the main checkout.
72+
git rm -rf . --quiet
73+
74+
# Clean up any remaining untracked files / directories.
75+
git clean -fdx
76+
77+
# Populate the branch with the freshly downloaded distribution files.
78+
cp -r /tmp/dist/. .
79+
80+
git add .
81+
82+
# Only commit when there are actual changes.
83+
if git diff --staged --quiet; then
84+
echo "No changes – distribution files are already up to date."
85+
else
86+
git commit -m "chore: sync Crowdin distributions"
87+
git push origin dist --force
88+
fi
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
---
2+
# Syncs source-string issues from Crowdin to this repository's GitHub Issues.
3+
#
4+
# Each GitHub issue created by this workflow contains a hidden HTML comment
5+
# acting as a deduplication key:
6+
#
7+
# <!-- crowdin-issue-id:PROJECT_ID:ISSUE_ID -->
8+
#
9+
# On every run the script reads all GitHub issues carrying the "crowdin" label
10+
# and compares them against the live Crowdin data:
11+
#
12+
# • Creates a new GitHub issue for each open Crowdin issue with no matching
13+
# GitHub issue.
14+
# • Closes a GitHub issue when the corresponding Crowdin issue is resolved.
15+
# • Re-opens a GitHub issue when a resolved Crowdin issue is re-opened.
16+
#
17+
# Required GitHub repository configuration:
18+
# secrets.CROWDIN_TOKEN – Crowdin personal access token
19+
# secrets.GH_BOT_TOKEN – GitHub PAT with "issues: write" permission
20+
# vars.CROWDIN_PROJECT_IDS – Comma-separated list of Crowdin project IDs
21+
# (e.g. "123456" or "123456,789012")
22+
23+
name: Sync Crowdin Issues
24+
permissions: {}
25+
26+
on:
27+
schedule:
28+
# Run every 6 hours so issues stay reasonably fresh.
29+
- cron: '0 */6 * * *'
30+
workflow_dispatch: # Allow ad-hoc manual runs
31+
32+
# Only one sync at a time; never cancel an in-progress run.
33+
concurrency:
34+
group: crowdin-issues-sync
35+
cancel-in-progress: false
36+
37+
jobs:
38+
sync:
39+
name: Sync Crowdin issues to GitHub Issues
40+
runs-on: ubuntu-latest
41+
permissions:
42+
contents: read # needed by the checkout action
43+
if: github.repository_owner == 'LizardByte' # don't run for forks
44+
45+
steps:
46+
- name: Checkout
47+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
48+
49+
- name: Set up Node.js
50+
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
51+
with:
52+
node-version: 'node'
53+
54+
- name: Install dependencies
55+
run: npm install --ignore-scripts
56+
57+
- name: Sync Crowdin issues to GitHub Issues
58+
env:
59+
CROWDIN_TOKEN: ${{ secrets.CROWDIN_TOKEN }}
60+
CROWDIN_PROJECT_IDS: ${{ vars.CROWDIN_PROJECT_IDS }}
61+
GH_BOT_TOKEN: ${{ secrets.GH_BOT_TOKEN }}
62+
GITHUB_REPOSITORY: ${{ github.repository }}
63+
run: node src/sync-crowdin-issues.js

.gitignore

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,153 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
9+
# Diagnostic reports (https://nodejs.org/api/report.html)
10+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11+
12+
# Runtime data
13+
pids
14+
*.pid
15+
*.seed
16+
*.pid.lock
17+
18+
# Directory for instrumented libs generated by jscoverage/JSCover
19+
lib-cov
20+
21+
# Coverage directory used by tools like istanbul
22+
coverage
23+
*.lcov
24+
25+
# nyc test coverage
26+
.nyc_output
27+
28+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29+
.grunt
30+
31+
# Bower dependency directory (https://bower.io/)
32+
bower_components
33+
34+
# node-waf configuration
35+
.lock-wscript
36+
37+
# Compiled binary addons (https://nodejs.org/api/addons.html)
38+
build/Release
39+
40+
# Dependency directories
41+
node_modules/
42+
jspm_packages/
43+
44+
# Snowpack dependency directory (https://snowpack.dev/)
45+
web_modules/
46+
47+
# TypeScript cache
48+
*.tsbuildinfo
49+
50+
# Optional npm cache directory
51+
.npm
52+
53+
# Optional eslint cache
54+
.eslintcache
55+
56+
# Optional stylelint cache
57+
.stylelintcache
58+
59+
# Optional REPL history
60+
.node_repl_history
61+
62+
# Output of 'npm pack'
63+
*.tgz
64+
65+
# Yarn Integrity file
66+
.yarn-integrity
67+
68+
# dotenv environment variable files
69+
.env
70+
.env.*
71+
!.env.example
72+
73+
# parcel-bundler cache (https://parceljs.org/)
74+
.cache
75+
.parcel-cache
76+
77+
# Next.js build output
78+
.next
79+
out
80+
81+
# Nuxt.js build / generate output
82+
.nuxt
83+
dist
84+
.output
85+
86+
# Gatsby files
87+
.cache/
88+
# Comment in the public line in if your project uses Gatsby and not Next.js
89+
# https://nextjs.org/blog/next-9-1#public-directory-support
90+
# public
91+
92+
# vuepress build output
93+
.vuepress/dist
94+
95+
# vuepress v2.x temp and cache directory
96+
.temp
97+
.cache
98+
99+
# Sveltekit cache directory
100+
.svelte-kit/
101+
102+
# vitepress build output
103+
**/.vitepress/dist
104+
105+
# vitepress cache directory
106+
**/.vitepress/cache
107+
108+
# Docusaurus cache and generated files
109+
.docusaurus
110+
111+
# Serverless directories
112+
.serverless/
113+
114+
# FuseBox cache
115+
.fusebox/
116+
117+
# DynamoDB Local files
118+
.dynamodb/
119+
120+
# Firebase cache directory
121+
.firebase/
122+
123+
# TernJS port file
124+
.tern-port
125+
126+
# Stores VSCode versions used for testing VSCode extensions
127+
.vscode-test
128+
129+
# pnpm
130+
.pnpm-store
131+
132+
# yarn v3
133+
.pnp.*
134+
.yarn/*
135+
!.yarn/patches
136+
!.yarn/plugins
137+
!.yarn/releases
138+
!.yarn/sdks
139+
!.yarn/versions
140+
141+
# Vite files
142+
vite.config.js.timestamp-*
143+
vite.config.ts.timestamp-*
144+
.vite/
145+
1146
# JetBrains IDEs
2147
.idea/
148+
149+
# JUnit test reports
150+
junit.xml
151+
152+
# package lock
153+
package-lock.json

LICENSE

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,21 @@
1-
No license, replace this file after using the template.
1+
MIT License
2+
3+
Copyright (c) 2026 LizardByte
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1-
# template-base
2-
Base repository template for LizardByte.
1+
# i18n
2+
3+
Localization repo for LizardByte. This repo syncs translations from Crowdin on a schedule, and provides
4+
a CDN mirror via jsdelivr to avoid using Crowdin's CDN directly.

babel.config.cjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// this allows jest to use ES6 module imports
2+
module.exports = {
3+
presets: ['@babel/preset-env'],
4+
plugins: ['babel-plugin-transform-import-meta'],
5+
}

codecov.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
codecov:
3+
branch: master
4+
5+
coverage:
6+
status:
7+
project:
8+
default:
9+
target: auto
10+
threshold: 10%
11+
12+
comment:
13+
layout: "diff, flags, files"
14+
behavior: default
15+
require_changes: false # if true: only post the comment if coverage changes
16+
17+
ignore:
18+
- "tests"
19+
- "third-party"

0 commit comments

Comments
 (0)