Skip to content

New translations source.json (zh) #2695

New translations source.json (zh)

New translations source.json (zh) #2695

Workflow file for this run

name: ci
on:
push:
paths-ignore:
- '*.md'
- '*.json'
pull_request:
paths-ignore:
- '*.md'
- '*.json'
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: lts/*
- name: Install
run: |
npm install
- name: Check
run: |
npm run check:tsc
- name: Run linter
run: |
npm run lint
npm run csslint
- name: Check translation files
if: matrix.os == 'ubuntu-latest' && ${{ github.event_name == 'pull_request' }}
uses: actions/github-script@v7
id: check-translation-files
with:
result-encoding: string
script: |
var fs = require('fs');
var path = require('path');
var { addedDiff: diff } = require('deep-object-diff');
var { inspect } = require('util');
var source = JSON.parse(fs.readFileSync('./translations/source.json'));
var translations = fs.readdirSync('./translations')
.map(f => path.join('./translations', f))
.map(j => ({ path: j, json: JSON.parse(fs.readFileSync(j)) }));
for (var json of translations) {
const added = diff(source, json.json)
if (Object.keys(added).length) {
console.log(inspect(added, undefined, 100, true), json.path)
process.exitCode = 1
}
}