mirror of
https://github.com/pezkuwichain/pezkuwi-apps.git
synced 2026-04-22 04:17:58 +00:00
feat: initial Pezkuwi Apps rebrand from polkadot-apps
Rebranded terminology: - Polkadot → Pezkuwi - Kusama → Dicle - Westend → Zagros - Rococo → PezkuwiChain - Substrate → Bizinikiwi - parachain → teyrchain Custom logos with Kurdistan brand colors (#e6007a → #86e62a): - bizinikiwi-hexagon.svg - sora-bizinikiwi.svg - hezscanner.svg - heztreasury.svg - pezkuwiscan.svg - pezkuwistats.svg - pezkuwiassembly.svg - pezkuwiholic.svg
This commit is contained in:
Executable
+79
@@ -0,0 +1,79 @@
|
||||
// Copyright 2017-2025 @polkadot/apps authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
|
||||
const i18nRoot = path.join(__dirname, '../packages/apps/public/locales');
|
||||
|
||||
const SKIP_NS = ['translation'].map((f) => `${f}.json`);
|
||||
|
||||
/**
|
||||
* @param {string} langRoot
|
||||
* @returns {string[]}
|
||||
*/
|
||||
function getEntries (langRoot) {
|
||||
return fs
|
||||
.readdirSync(langRoot)
|
||||
.filter((entry) =>
|
||||
!['.', '..'].includes(entry) &&
|
||||
fs.lstatSync(path.join(langRoot, entry)).isFile() &&
|
||||
entry.endsWith('.json') &&
|
||||
!['index.json'].includes(entry)
|
||||
)
|
||||
.sort();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} lang
|
||||
*/
|
||||
function sortLanguage (lang) {
|
||||
const langRoot = path.join(i18nRoot, lang);
|
||||
const entries = getEntries(langRoot);
|
||||
/** @type {Record<String, boolean>} */
|
||||
const hasKeys = {};
|
||||
|
||||
entries.forEach((entry) => {
|
||||
const filename = path.join(langRoot, entry);
|
||||
const json = require(filename);
|
||||
const sorted = Object
|
||||
.keys(json)
|
||||
.sort()
|
||||
.reduce((/** @type {Record<String, string>} */ result, key) => {
|
||||
result[key] = json[key];
|
||||
|
||||
return result;
|
||||
}, {});
|
||||
|
||||
hasKeys[entry] = Object.keys(sorted).length !== 0;
|
||||
|
||||
fs.writeFileSync(filename, JSON.stringify(sorted, null, 2));
|
||||
});
|
||||
|
||||
if (lang === 'en') {
|
||||
const filtered = entries
|
||||
.filter((entry) => !SKIP_NS.includes(entry))
|
||||
.filter((entry) => hasKeys[entry]);
|
||||
|
||||
fs.writeFileSync(
|
||||
path.join(langRoot, 'index.json'),
|
||||
JSON.stringify(filtered, null, 2)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function checkLanguages () {
|
||||
const languages = fs
|
||||
.readdirSync(i18nRoot)
|
||||
.filter((entry) =>
|
||||
!['.', '..'].includes(entry) &&
|
||||
fs.lstatSync(path.join(i18nRoot, entry)).isDirectory()
|
||||
)
|
||||
.sort();
|
||||
|
||||
languages.forEach(sortLanguage);
|
||||
|
||||
fs.writeFileSync(path.join(i18nRoot, 'index.json'), JSON.stringify(languages, null, 2));
|
||||
}
|
||||
|
||||
checkLanguages();
|
||||
Reference in New Issue
Block a user