i18ntk 2.3.8 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,858 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * Missing Key Validator
5
- * Validates presence of all required keys across all supported languages
6
- */
7
-
8
- const fs = require('fs');
9
- const path = require('path');
10
-
11
- class MissingKeyValidator {
12
- constructor(supportedLanguages = ['en', 'es', 'fr', 'de', 'ja', 'ru', 'zh']) {
13
- this.supportedLanguages = supportedLanguages;
14
- this.projectRoot = path.resolve(__dirname, '..');
15
- this.requiredKeys = this.loadRequiredKeys();
16
- }
17
-
18
- loadRequiredKeys() {
19
- // Define required keys for the toolkit
20
- return [
21
- // Core UI keys
22
- 'welcome',
23
- 'error',
24
- 'success',
25
- 'warning',
26
- 'info',
27
- 'loading',
28
- 'processing',
29
- 'completed',
30
- 'cancel',
31
- 'confirm',
32
- 'save',
33
- 'delete',
34
- 'edit',
35
- 'add',
36
- 'remove',
37
- 'update',
38
- 'create',
39
- 'close',
40
- 'open',
41
- 'search',
42
- 'filter',
43
- 'sort',
44
- 'export',
45
- 'import',
46
- 'backup',
47
- 'restore',
48
- 'settings',
49
- 'configuration',
50
- 'language',
51
- 'locale',
52
- 'translation',
53
- 'key',
54
- 'value',
55
- 'placeholder',
56
- 'validation',
57
- 'format',
58
- 'type',
59
- 'required',
60
- 'optional',
61
- 'default',
62
- 'description',
63
- 'help',
64
- 'documentation',
65
- 'support',
66
- 'contact',
67
- 'about',
68
- 'version',
69
- 'license',
70
- 'copyright',
71
- 'privacy',
72
- 'terms',
73
- 'security',
74
- 'authentication',
75
- 'authorization',
76
- 'login',
77
- 'logout',
78
- 'register',
79
- 'password',
80
- 'username',
81
- 'email',
82
- 'profile',
83
- 'account',
84
- 'dashboard',
85
- 'overview',
86
- 'summary',
87
- 'details',
88
- 'report',
89
- 'statistics',
90
- 'analytics',
91
- 'performance',
92
- 'metrics',
93
- 'logs',
94
- 'history',
95
- 'activity',
96
- 'notification',
97
- 'alert',
98
- 'message',
99
- 'feedback',
100
- 'review',
101
- 'rating',
102
- 'score',
103
- 'progress',
104
- 'status',
105
- 'state',
106
- 'mode',
107
- 'view',
108
- 'list',
109
- 'grid',
110
- 'table',
111
- 'card',
112
- 'tree',
113
- 'graph',
114
- 'chart',
115
- 'diagram',
116
- 'image',
117
- 'file',
118
- 'folder',
119
- 'directory',
120
- 'path',
121
- 'url',
122
- 'link',
123
- 'button',
124
- 'menu',
125
- 'tab',
126
- 'panel',
127
- 'window',
128
- 'dialog',
129
- 'modal',
130
- 'popup',
131
- 'tooltip',
132
- 'hint',
133
- 'guide',
134
- 'tutorial',
135
- 'walkthrough',
136
- 'demo',
137
- 'example',
138
- 'sample',
139
- 'template',
140
- 'theme',
141
- 'style',
142
- 'color',
143
- 'font',
144
- 'size',
145
- 'layout',
146
- 'responsive',
147
- 'mobile',
148
- 'tablet',
149
- 'desktop',
150
- 'browser',
151
- 'device',
152
- 'screen',
153
- 'resolution',
154
- 'orientation',
155
- 'accessibility',
156
- 'aria',
157
- 'keyboard',
158
- 'screen-reader',
159
- 'contrast',
160
- 'zoom',
161
- 'font-size',
162
- 'high-contrast',
163
- 'dark-mode',
164
- 'light-mode',
165
- 'auto-mode',
166
- 'sync',
167
- 'async',
168
- 'promise',
169
- 'callback',
170
- 'event',
171
- 'listener',
172
- 'handler',
173
- 'function',
174
- 'method',
175
- 'class',
176
- 'object',
177
- 'array',
178
- 'string',
179
- 'number',
180
- 'boolean',
181
- 'date',
182
- 'time',
183
- 'duration',
184
- 'interval',
185
- 'timeout',
186
- 'delay',
187
- 'throttle',
188
- 'debounce',
189
- 'cache',
190
- 'storage',
191
- 'memory',
192
- 'database',
193
- 'api',
194
- 'endpoint',
195
- 'request',
196
- 'response',
197
- 'status-code',
198
- 'header',
199
- 'body',
200
- 'payload',
201
- 'parameter',
202
- 'query',
203
- 'filter',
204
- 'pagination',
205
- 'limit',
206
- 'offset',
207
- 'cursor',
208
- 'sorting',
209
- 'ordering',
210
- 'direction',
211
- 'ascending',
212
- 'descending',
213
- 'grouping',
214
- 'aggregation',
215
- 'join',
216
- 'relation',
217
- 'association',
218
- 'foreign-key',
219
- 'primary-key',
220
- 'index',
221
- 'constraint',
222
- 'rule',
223
- 'trigger',
224
- 'procedure',
225
- 'function',
226
- 'view',
227
- 'materialized-view',
228
- 'sequence',
229
- 'schema',
230
- 'migration',
231
- 'seed',
232
- 'fixture',
233
- 'mock',
234
- 'stub',
235
- 'spy',
236
- 'test',
237
- 'spec',
238
- 'assertion',
239
- 'expectation',
240
- 'coverage',
241
- 'report',
242
- 'summary',
243
- 'detail',
244
- 'trace',
245
- 'debug',
246
- 'info',
247
- 'warn',
248
- 'error',
249
- 'fatal',
250
- 'critical',
251
- 'emergency',
252
- 'alert',
253
- 'notice',
254
- 'verbose',
255
- 'silent',
256
- 'quiet',
257
- 'normal',
258
- 'loud',
259
- 'minimal',
260
- 'full',
261
- 'complete',
262
- 'partial',
263
- 'incremental',
264
- 'delta',
265
- 'diff',
266
- 'patch',
267
- 'merge',
268
- 'conflict',
269
- 'resolution',
270
- 'strategy',
271
- 'algorithm',
272
- 'heuristic',
273
- 'optimization',
274
- 'efficiency',
275
- 'speed',
276
- 'performance',
277
- 'benchmark',
278
- 'profiling',
279
- 'monitoring',
280
- 'observability',
281
- 'telemetry',
282
- 'tracing',
283
- 'metrics',
284
- 'instrumentation',
285
- 'alerting',
286
- 'notification',
287
- 'escalation',
288
- 'incident',
289
- 'response',
290
- 'recovery',
291
- 'rollback',
292
- 'retry',
293
- 'circuit-breaker',
294
- 'timeout',
295
- 'deadline',
296
- 'graceful',
297
- 'degradation',
298
- 'fallback',
299
- 'backup',
300
- 'redundancy',
301
- 'replication',
302
- 'sharding',
303
- 'partitioning',
304
- 'distribution',
305
- 'load-balancing',
306
- 'scaling',
307
- 'horizontal',
308
- 'vertical',
309
- 'elastic',
310
- 'auto-scaling',
311
- 'burst',
312
- 'capacity',
313
- 'throughput',
314
- 'latency',
315
- 'bandwidth',
316
- 'utilization',
317
- 'saturation',
318
- 'bottleneck',
319
- 'contention',
320
- 'starvation',
321
- 'deadlock',
322
- 'livelock',
323
- 'race-condition',
324
- 'consistency',
325
- 'availability',
326
- 'partition-tolerance',
327
- 'cap-theorem',
328
- 'acid',
329
- 'base',
330
- 'transaction',
331
- 'isolation',
332
- 'serializable',
333
- 'repeatable-read',
334
- 'read-committed',
335
- 'read-uncommitted',
336
- 'durability',
337
- 'atomicity',
338
- 'rollback',
339
- 'commit',
340
- 'checkpoint',
341
- 'savepoint',
342
- 'compensation',
343
- 'saga',
344
- 'workflow',
345
- 'orchestration',
346
- 'choreography',
347
- 'state-machine',
348
- 'event-sourcing',
349
- 'cqrs',
350
- 'eventual-consistency',
351
- 'idempotency',
352
- 'deduplication',
353
- 'exactly-once',
354
- 'at-least-once',
355
- 'at-most-once',
356
- 'guaranteed-delivery',
357
- 'message-queue',
358
- 'pub-sub',
359
- 'topic',
360
- 'subscription',
361
- 'consumer',
362
- 'producer',
363
- 'broker',
364
- 'exchange',
365
- 'routing',
366
- 'binding',
367
- 'queue',
368
- 'dead-letter',
369
- 'retry-queue',
370
- 'backpressure',
371
- 'flow-control',
372
- 'throttling',
373
- 'rate-limiting',
374
- 'quota',
375
- 'fairness',
376
- 'priority',
377
- 'starvation',
378
- 'aging',
379
- 'token-bucket',
380
- 'leaky-bucket',
381
- 'sliding-window',
382
- 'fixed-window',
383
- 'adaptive',
384
- 'machine-learning',
385
- 'ai',
386
- 'ml',
387
- 'deep-learning',
388
- 'neural-network',
389
- 'model',
390
- 'training',
391
- 'inference',
392
- 'prediction',
393
- 'classification',
394
- 'regression',
395
- 'clustering',
396
- 'anomaly-detection',
397
- 'recommendation',
398
- 'personalization',
399
- 'optimization',
400
- 'genetic-algorithm',
401
- 'evolutionary',
402
- 'swarm-intelligence',
403
- 'reinforcement-learning',
404
- 'q-learning',
405
- 'policy',
406
- 'reward',
407
- 'penalty',
408
- 'exploration',
409
- 'exploitation',
410
- 'multi-armed-bandit',
411
- 'contextual',
412
- 'federated-learning',
413
- 'privacy-preserving',
414
- 'differential-privacy',
415
- 'homomorphic-encryption',
416
- 'zero-knowledge',
417
- 'secure-multi-party',
418
- 'threshold-cryptography',
419
- 'distributed-ledger',
420
- 'blockchain',
421
- 'consensus',
422
- 'proof-of-work',
423
- 'proof-of-stake',
424
- 'byzantine-fault-tolerance',
425
- 'smart-contract',
426
- 'oracle',
427
- 'decentralized',
428
- 'web3',
429
- 'nft',
430
- 'token',
431
- 'cryptocurrency',
432
- 'stable-coin',
433
- 'defi',
434
- 'dao',
435
- 'metaverse',
436
- 'ar',
437
- 'vr',
438
- 'xr',
439
- 'mixed-reality',
440
- 'spatial-computing',
441
- 'digital-twin',
442
- 'iot',
443
- 'edge-computing',
444
- 'fog-computing',
445
- 'cloud-native',
446
- 'microservices',
447
- 'service-mesh',
448
- 'api-gateway',
449
- 'service-discovery',
450
- 'circuit-breaker',
451
- 'rate-limiter',
452
- 'load-balancer',
453
- 'proxy',
454
- 'reverse-proxy',
455
- 'forward-proxy',
456
- 'cdn',
457
- 'cache',
458
- 'redis',
459
- 'memcached',
460
- 'elasticsearch',
461
- 'mongodb',
462
- 'postgresql',
463
- 'mysql',
464
- 'sqlite',
465
- 'cassandra',
466
- 'dynamodb',
467
- 'firestore',
468
- 'cosmosdb',
469
- 'neo4j',
470
- 'arangodb',
471
- 'couchbase',
472
- 'influxdb',
473
- 'prometheus',
474
- 'grafana',
475
- 'jaeger',
476
- 'zipkin',
477
- 'newrelic',
478
- 'datadog',
479
- 'splunk',
480
- 'elk-stack',
481
- 'fluentd',
482
- 'logstash',
483
- 'kibana',
484
- 'beats',
485
- 'filebeat',
486
- 'metricbeat',
487
- 'heartbeat',
488
- 'packetbeat',
489
- 'auditbeat',
490
- 'functionbeat',
491
- 'journalbeat',
492
- 'community',
493
- 'contribute',
494
- 'contribution',
495
- 'guidelines',
496
- 'code-of-conduct',
497
- 'license',
498
- 'copyright',
499
- 'attribution',
500
- 'acknowledgment',
501
- 'citation',
502
- 'reference',
503
- 'bibliography',
504
- 'changelog',
505
- 'release-notes',
506
- 'roadmap',
507
- 'milestone',
508
- 'backlog',
509
- 'issue',
510
- 'bug',
511
- 'feature',
512
- 'enhancement',
513
- 'improvement',
514
- 'optimization',
515
- 'refactor',
516
- 'cleanup',
517
- 'technical-debt',
518
- 'legacy',
519
- 'deprecated',
520
- 'obsolete',
521
- 'end-of-life',
522
- 'sunset',
523
- 'migration',
524
- 'upgrade',
525
- 'downgrade',
526
- 'rollback',
527
- 'compatibility',
528
- 'interoperability',
529
- 'standard',
530
- 'specification',
531
- 'rfc',
532
- 'draft',
533
- 'proposal',
534
- 'review',
535
- 'approval',
536
- 'rejection',
537
- 'feedback',
538
- 'iteration',
539
- 'incremental',
540
- 'agile',
541
- 'scrum',
542
- 'kanban',
543
- 'lean',
544
- 'devops',
545
- 'ci-cd',
546
- 'continuous-integration',
547
- 'continuous-deployment',
548
- 'continuous-delivery',
549
- 'git',
550
- 'github',
551
- 'gitlab',
552
- 'bitbucket',
553
- 'svn',
554
- 'mercurial',
555
- 'version-control',
556
- 'branch',
557
- 'merge',
558
- 'rebase',
559
- 'cherry-pick',
560
- 'stash',
561
- 'tag',
562
- 'release',
563
- 'hotfix',
564
- 'feature-branch',
565
- 'main-branch',
566
- 'develop-branch',
567
- 'staging',
568
- 'production',
569
- 'environment',
570
- 'configuration',
571
- 'parameter',
572
- 'variable',
573
- 'constant',
574
- 'macro',
575
- 'template',
576
- 'snippet',
577
- 'boilerplate',
578
- 'scaffold',
579
- 'generator',
580
- 'cli',
581
- 'command-line',
582
- 'terminal',
583
- 'shell',
584
- 'bash',
585
- 'zsh',
586
- 'fish',
587
- 'powershell',
588
- 'cmd',
589
- 'prompt',
590
- 'interactive',
591
- 'non-interactive',
592
- 'batch',
593
- 'script',
594
- 'automation',
595
- 'orchestration',
596
- 'workflow',
597
- 'pipeline',
598
- 'stage',
599
- 'step',
600
- 'task',
601
- 'job',
602
- 'build',
603
- 'test',
604
- 'deploy',
605
- 'monitor',
606
- 'alert',
607
- 'notify',
608
- 'report',
609
- 'dashboard',
610
- 'kpi',
611
- 'metric',
612
- 'sla',
613
- 'slo',
614
- 'slis',
615
- 'availability',
616
- 'reliability',
617
- 'scalability',
618
- 'performance',
619
- 'efficiency',
620
- 'effectiveness',
621
- 'quality',
622
- 'security',
623
- 'compliance',
624
- 'governance',
625
- 'audit',
626
- 'traceability',
627
- 'accountability',
628
- 'transparency',
629
- 'documentation',
630
- 'training',
631
- 'onboarding',
632
- 'support',
633
- 'maintenance',
634
- 'operations',
635
- 'runbook',
636
- 'playbook',
637
- 'procedure',
638
- 'process',
639
- 'policy',
640
- 'standard',
641
- 'best-practice',
642
- 'guideline',
643
- 'checklist',
644
- 'template',
645
- 'form',
646
- 'survey',
647
- 'questionnaire',
648
- 'feedback',
649
- 'rating',
650
- 'review',
651
- 'approval',
652
- 'sign-off',
653
- 'acceptance',
654
- 'criteria',
655
- 'definition-of-done',
656
- 'definition-of-ready',
657
- 'ready',
658
- 'done',
659
- 'blocked',
660
- 'impediment',
661
- 'risk',
662
- 'issue',
663
- 'dependency',
664
- 'constraint',
665
- 'assumption',
666
- 'prerequisite',
667
- 'requirement',
668
- 'specification',
669
- 'design',
670
- 'architecture',
671
- 'diagram',
672
- 'model',
673
- 'prototype',
674
- 'mockup',
675
- 'wireframe',
676
- 'storyboard',
677
- 'user-story',
678
- 'use-case',
679
- 'scenario',
680
- 'persona',
681
- 'journey',
682
- 'flow',
683
- 'process',
684
- 'workflow',
685
- 'state',
686
- 'transition',
687
- 'action',
688
- 'event',
689
- 'trigger',
690
- 'condition',
691
- 'rule',
692
- 'logic',
693
- 'algorithm',
694
- 'function',
695
- 'method',
696
- 'procedure',
697
- 'operation',
698
- 'calculation',
699
- 'computation',
700
- 'transformation',
701
- 'conversion',
702
- 'validation',
703
- 'verification',
704
- 'sanitization',
705
- 'normalization',
706
- 'standardization',
707
- 'optimization',
708
- 'compression',
709
- 'encryption',
710
- 'decryption',
711
- 'hashing',
712
- 'encoding',
713
- 'decoding',
714
- 'serialization',
715
- 'deserialization',
716
- 'parsing',
717
- 'formatting',
718
- 'rendering',
719
- 'display',
720
- 'presentation',
721
- 'visualization',
722
- 'interaction',
723
- 'navigation',
724
- 'usability',
725
- 'accessibility',
726
- 'responsiveness',
727
- 'performance',
728
- 'efficiency',
729
- 'quality',
730
- 'reliability',
731
- 'maintainability',
732
- 'scalability',
733
- 'security',
734
- 'privacy',
735
- 'compliance',
736
- 'governance',
737
- 'audit',
738
- 'monitoring',
739
- 'alerting',
740
- 'reporting',
741
- 'analytics',
742
- 'insights',
743
- 'intelligence',
744
- 'learning',
745
- 'improvement',
746
- 'evolution',
747
- 'adaptation',
748
- 'innovation',
749
- 'transformation',
750
- 'digitalization',
751
- 'automation',
752
- 'optimization',
753
- 'modernization',
754
- 'upgrade',
755
- 'migration',
756
- 'transition',
757
- 'change',
758
- 'management'
759
- ];
760
- }
761
-
762
- async validateAllKeys() {
763
- console.log('šŸ” Validating missing keys across all languages...');
764
-
765
- const missingKeys = {};
766
-
767
- for (const language of this.supportedLanguages) {
768
- const languageMissing = await this.validateLanguageKeys(language);
769
- if (languageMissing.length > 0) {
770
- missingKeys[language] = languageMissing;
771
- }
772
- }
773
-
774
- return missingKeys;
775
- }
776
-
777
- async validateLanguageKeys(language) {
778
- const localePath = path.join(this.projectRoot, 'resources', 'i18n', 'ui-locales', `${language}.json`);
779
-
780
- if (!SecurityUtils.safeExistsSync(localePath)) {
781
- return this.requiredKeys; // All keys missing if file doesn't exist
782
- }
783
-
784
- try {
785
- const localeData = JSON.parse(SecurityUtils.safeReadFileSync(localePath, 'utf8'));
786
- const existingKeys = Object.keys(localeData);
787
-
788
- return this.requiredKeys.filter(key => !existingKeys.includes(key));
789
- } catch (error) {
790
- console.error(`Error reading ${language}.json:`, error.message);
791
- return this.requiredKeys;
792
- }
793
- }
794
-
795
- async generateMissingKeysReport() {
796
- const missingKeys = await this.validateAllKeys();
797
-
798
- const report = {
799
- timestamp: new Date().toISOString(),
800
- summary: {
801
- totalLanguages: this.supportedLanguages.length,
802
- totalRequiredKeys: this.requiredKeys.length,
803
- languagesWithMissingKeys: Object.keys(missingKeys).length,
804
- totalMissingKeys: Object.values(missingKeys).reduce((sum, keys) => sum + keys.length, 0)
805
- },
806
- details: missingKeys
807
- };
808
-
809
- const reportPath = path.join(__dirname, 'missing-keys-report.json');
810
- SecurityUtils.safeWriteFileSync(reportPath, JSON.stringify(report, null, 2));
811
-
812
- console.log('\nšŸ“Š Missing Keys Report:');
813
- console.log(`Total Languages: ${report.summary.totalLanguages}`);
814
- console.log(`Total Required Keys: ${report.summary.totalRequiredKeys}`);
815
- console.log(`Languages with Missing Keys: ${report.summary.languagesWithMissingKeys}`);
816
- console.log(`Total Missing Keys: ${report.summary.totalMissingKeys}`);
817
-
818
- if (report.summary.totalMissingKeys > 0) {
819
- console.log('\nāŒ Missing keys by language:');
820
- Object.entries(missingKeys).forEach(([lang, keys]) => {
821
- console.log(`${lang}: ${keys.length} keys missing`);
822
- });
823
- } else {
824
- console.log('\nāœ… All keys present in all languages!');
825
- }
826
-
827
- console.log(`Report saved to: ${reportPath}`);
828
-
829
- return report;
830
- }
831
-
832
- async generateTranslationTemplate() {
833
- const template = {};
834
-
835
- this.requiredKeys.forEach(key => {
836
- template[key] = key.replace(/-/g, ' ').replace(/\b\w/g, l => l.toUpperCase());
837
- });
838
-
839
- const templatePath = path.join(__dirname, 'translation-template.json');
840
- SecurityUtils.safeWriteFileSync(templatePath, JSON.stringify(template, null, 2));
841
-
842
- console.log(`Translation template saved to: ${templatePath}`);
843
- return template;
844
- }
845
- }
846
-
847
- // CLI execution
848
- if (require.main === module) {
849
- const validator = new MissingKeyValidator();
850
-
851
- if (process.argv.includes('--template')) {
852
- validator.generateTranslationTemplate();
853
- } else {
854
- validator.generateMissingKeysReport();
855
- }
856
- }
857
-
858
- module.exports = MissingKeyValidator;