One Hat Cyber Team
Your IP :
216.73.216.14
Server IP :
194.44.31.54
Server :
Linux zen.imath.kiev.ua 4.18.0-553.77.1.el8_10.x86_64 #1 SMP Fri Oct 3 14:30:23 UTC 2025 x86_64
Server Software :
Apache/2.4.37 (Rocky Linux) OpenSSL/1.1.1k
PHP Version :
5.6.40
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
var
/
www
/
ojs-nosc
/
lib
/
pkp
/
tools
/
View File Name :
i18nExtractKeys.vite.js
import path from 'path'; import fs from 'fs'; const uniqueKeys = new Set(); function extractRegexPlugin({extraKeys} = {}) { const fileOutput = path.join('registry', 'uiLocaleKeysBackend.json'); /** * Supported variants: * this.t('key'); * {{ t('key') }} * this.t( * 'key' * ) * To identify the translation keys, without triggering translation * {'viewAction': tk('common.viewAction') } */ const regex = /(?:^|\W)tk?\([\s]*['"`](?<localeKey>[^'"`]+)['"`]/g; extraKeys ||= []; return { name: 'extract-keys', transform(code, id) { if ( !id.includes('node_modules') && (id.endsWith('.vue') || id.endsWith('.js')) ) { const matches = [...code.matchAll(regex)]; for (const match of matches) { uniqueKeys.add(match[1]); } } return null; }, buildEnd() { for (const key of extraKeys) { uniqueKeys.add(key); } // remove dummy key used in the comment examples uniqueKeys.delete('key'); if (uniqueKeys.size) { const dir = path.dirname(fileOutput); if (!fs.existsSync(dir)) { fs.mkdirSync(dir, {recursive: true}); } const outputArray = [...uniqueKeys].sort(); fs.writeFileSync( fileOutput, `${JSON.stringify(outputArray, null, 2)}\n`, ); console.log(`Written all existing locale keys to ${fileOutput}`); } }, }; } module.exports = extractRegexPlugin;