Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

Added script for checking language strings.

Mike Caob2a48b1c4c31
diff --git a/package.json b/package.json
index 0f8c79476..9ddd6abb5 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "umami",
- "version": "0.64.0",
+ "version": "0.65.0",
"description": "A simple, fast, website analytics alternative to Google Analytics. ",
"author": "Mike Cao <[email protected]>",
"license": "MIT",
@@ -29,7 +29,8 @@
"extract-lang": "formatjs extract {pages,components}/**/*.js --out-file build/messages.json",
"merge-lang": "node scripts/merge-lang.js",
"format-lang": "node scripts/format-lang.js",
- "compile-lang": "formatjs compile-folder --ast build lang-compiled"
+ "compile-lang": "formatjs compile-folder --ast build lang-compiled",
+ "check-lang": "node scripts/check-lang.js"
},
"lint-staged": {
"**/*.js": [
diff --git a/scripts/check-lang.js b/scripts/check-lang.js
new file mode 100644
index 000000000..96522879a
--- /dev/null
+++ b/scripts/check-lang.js
@@ -0,0 +1,24 @@
+const fs = require('fs');
+const path = require('path');
+const chalk = require('chalk');
+const messages = require('../lang/en-US.json');
+
+const dir = path.resolve(__dirname, '../lang');
+const files = fs.readdirSync(dir);
+const keys = Object.keys(messages).sort();
+
+files.forEach(file => {
+ if (file !== 'en-US.json') {
+ const lang = require(`../lang/${file}`);
+
+ console.log(chalk.yellowBright(`\n## ${file}`));
+ keys.forEach(key => {
+ const orig = messages[key];
+ const check = lang[key];
+
+ if (!check || check === orig) {
+ console.log(chalk.redBright('*'), chalk.greenBright(`${key}:`), orig);
+ }
+ });
+ }
+});