Add translation key comments for unused-keys script

This commit is contained in:
yflory 2024-03-25 19:05:12 +01:00
parent 7afee532ff
commit ef82dc9bca
3 changed files with 72 additions and 21 deletions

View File

@ -17,7 +17,7 @@ var ignoreLines = function (source, pattern) {
}; };
var GENERATED_PATTERNS = [ var GENERATED_PATTERNS = [
/(team|admin|settings|support)_.*(Hint|Title|Button)/, /(team|admin|settings|support)_.*(Hint|Title|Button|Label)/,
/settings_colortheme/, /settings_colortheme/,
/loading_(state|drive|pad)_/, /loading_(state|drive|pad)_/,
/(admin|notifications|support|team|settings)_cat_/, /(admin|notifications|support|team|settings)_cat_/,
@ -53,6 +53,7 @@ var grep = function (pattern, cb) {
'*.svg', '*.svg',
'*.md', '*.md',
'./config/*', './config/*',
'www/oldadmin/*', // XXX
].map(function (patt) { ].map(function (patt) {
return "':(exclude)" + patt + "'"; return "':(exclude)" + patt + "'";
}).join(' '); }).join(' ');

View File

@ -54,8 +54,9 @@ define([
var andThen = function (common, $container) { var andThen = function (common, $container) {
const sidebar = Sidebar.create(common, 'admin', $container); const sidebar = Sidebar.create(common, 'admin', $container);
// UNUSED-TRANSLATIONS:START
var categories = { var categories = {
'general': { 'general': { // Msg.admin_cat_general
icon: 'fa fa-user-o', icon: 'fa fa-user-o',
content: [ content: [
'instance-info-notice', 'instance-info-notice',
@ -66,14 +67,14 @@ define([
'flush-cache' 'flush-cache'
] ]
}, },
'customize': { 'customize': { // Msg.admin_cat_customize
icon: 'fa fa-paint-brush', icon: 'fa fa-paint-brush',
content: [ content: [
'logo', 'logo',
'color', 'color',
] ]
}, },
'broadcast' : { 'broadcast' : { // Msg.admin_cat_broadcast
icon: 'fa fa-bullhorn', icon: 'fa fa-bullhorn',
content : [ content : [
'notice', 'notice',
@ -82,14 +83,14 @@ define([
'broadcast' 'broadcast'
] ]
}, },
'security': { 'security': { // Msg.admin_cat_security
icon: 'fa fa-lock', icon: 'fa fa-lock',
content: [ content: [
'enableembeds', 'enableembeds',
'forcemfa', 'forcemfa',
] ]
}, },
'users' : { 'users' : { // Msg.admin_cat_users
icon : 'fa fa-address-card-o', icon : 'fa fa-address-card-o',
content : [ content : [
'registration', 'registration',
@ -97,23 +98,22 @@ define([
'users' 'users'
] ]
}, },
'support' : { 'support' : { // Msg.admin_cat_support
icon : 'fa fa-ambulance', icon : 'fa fa-ambulance',
content : [ content : [
'support-setup', 'support-setup',
'support-team', 'support-team',
] ]
}, },
'quota': { 'quota': { // Msg.admin_cat_quota
icon: 'fa fa-hdd-o', icon: 'fa fa-hdd-o',
content: [ content: [
//'update-limit',
'defaultlimit', 'defaultlimit',
'setlimit', 'setlimit',
'getlimits', 'getlimits',
] ]
}, },
'database' : { 'database' : { // Msg.admin_cat_database
icon : 'fa fa-database', icon : 'fa fa-database',
content : [ content : [
'account-metadata', 'account-metadata',
@ -123,7 +123,7 @@ define([
] ]
}, },
'stats' : { 'stats' : { // Msg.admin_cat_stats
icon : 'fa fa-line-chart', icon : 'fa fa-line-chart',
content : [ content : [
'refresh-stats', 'refresh-stats',
@ -135,7 +135,7 @@ define([
'disk-usage', 'disk-usage',
] ]
}, },
'performance' : { 'performance' : { // Msg.admin_cat_performance
icon : 'fa fa-heartbeat', icon : 'fa fa-heartbeat',
content : [ content : [
'refresh-performance', 'refresh-performance',
@ -144,7 +144,7 @@ define([
'bytes-written', 'bytes-written',
] ]
}, },
'network' : { 'network' : { // Msg.admin_cat_network
icon : 'fa fa-sitemap', icon : 'fa fa-sitemap',
content : [ content : [
'update-available', 'update-available',
@ -187,6 +187,8 @@ define([
*/ */
//general blocks //general blocks
// Msg.admin_flushCacheHint, .admin_flushCacheTitle, .admin_flushCacheButton
sidebar.addItem('flush-cache', function (cb) { sidebar.addItem('flush-cache', function (cb) {
var button = blocks.activeButton('primary', '', var button = blocks.activeButton('primary', '',
Messages.admin_flushCacheButton, done => { Messages.admin_flushCacheButton, done => {
@ -507,6 +509,7 @@ define([
return tableObj.table; return tableObj.table;
}; };
// Msg.admin_updateLimitHint, .admin_updateLimitTitle, .admin_updateLimitButton
sidebar.addItem('update-limit', function (cb) { sidebar.addItem('update-limit', function (cb) {
var button = blocks.activeButton('primary', '', var button = blocks.activeButton('primary', '',
Messages.admin_updateLimitButton, done => { Messages.admin_updateLimitButton, done => {
@ -520,6 +523,7 @@ define([
cb(button); cb(button);
}); });
// Msg.admin_enableembedsHint, .admin_enableembedsTitle
sidebar.addCheckboxItem({ sidebar.addCheckboxItem({
key: 'enableembeds', key: 'enableembeds',
getState: function () { getState: function () {
@ -542,6 +546,7 @@ define([
}, },
}); });
// Msg.admin_forcemfaHint, .admin_forcemfaTitle
sidebar.addCheckboxItem({ sidebar.addCheckboxItem({
key: 'forcemfa', key: 'forcemfa',
getState: function () { getState: function () {
@ -578,6 +583,7 @@ define([
} }
}; };
// Msg.admin_emailHint, Msg.admin_emailTitle
sidebar.addItem('email', function (cb){ sidebar.addItem('email', function (cb){
var input = blocks.input({ var input = blocks.input({
type: 'email', type: 'email',
@ -624,6 +630,7 @@ define([
noHint: true noHint: true
}); });
// Msg.admin_nameHint, Msg.admin_nameTitle, Msg.admin_nameButton
sidebar.addItem('name', function (cb){ sidebar.addItem('name', function (cb){
var input = blocks.input({ var input = blocks.input({
type: 'text', type: 'text',
@ -661,6 +668,7 @@ define([
cb(form); cb(form);
}); });
// Msg.admin_descriptionHint, Msg.admin_descriptionTitle
sidebar.addItem('description', function (cb){ sidebar.addItem('description', function (cb){
var textarea = blocks.textarea({ var textarea = blocks.textarea({
placeholder: Messages.home_host || '', placeholder: Messages.home_host || '',
@ -695,6 +703,7 @@ define([
cb(form); cb(form);
}); });
// Msg.admin_jurisdictionHint, Msg.admin_jurisdictionTitle
sidebar.addItem('jurisdiction', function (cb){ sidebar.addItem('jurisdiction', function (cb){
var input = blocks.input({ var input = blocks.input({
type: 'text', type: 'text',
@ -732,6 +741,7 @@ define([
cb(form); cb(form);
}); });
// Messages.admin_noticeHint, Messages.admin_noticeTitle
sidebar.addItem('notice', function (cb){ sidebar.addItem('notice', function (cb){
var input = blocks.input({ var input = blocks.input({
type: 'text', type: 'text',
@ -769,8 +779,8 @@ define([
cb(form); cb(form);
}); });
// Msg.admin_logoHint, Msg.admin_logoTitle
sidebar.addItem('logo', (cb) => { sidebar.addItem('logo', (cb) => {
// Msg.admin_logoHint, Msg.admin_logoTitle
let input = blocks.input({ let input = blocks.input({
type: 'file', type: 'file',
@ -849,6 +859,7 @@ define([
cb(form); cb(form);
}); });
// Msg.admin_colorHint, Msg.admin_colorTitle
sidebar.addItem('color', cb => { sidebar.addItem('color', cb => {
let input = blocks.input({ let input = blocks.input({
type: 'color', type: 'color',
@ -932,6 +943,8 @@ define([
cb([form, labelPreview]); cb([form, labelPreview]);
}); });
// Msg.admin_registrationHint, .admin_registrationTitle
// Msg.admin_registrationSsoTitle
sidebar.addItem('registration', function(cb){ sidebar.addItem('registration', function(cb){
var refresh = function () {}; var refresh = function () {};
@ -996,6 +1009,7 @@ define([
cb(blocks.form([restrict, restrictSSO], [])); cb(blocks.form([restrict, restrictSSO], []));
}); });
// Msg.admin_invitationHint, admin_invitationTitle
sidebar.addItem('invitation', function(cb){ sidebar.addItem('invitation', function(cb){
var button = blocks.button('primary', '', Messages.admin_invitationCreate); var button = blocks.button('primary', '', Messages.admin_invitationCreate);
var $b = $(button); var $b = $(button);
@ -1257,6 +1271,9 @@ define([
}); });
}; };
// Msg.admin_usersHint, admin_usersTitle
// Msg.admin_storeInvitedLabel
// Msg.admin_storeSsoLabel
sidebar.addItem('users', function(cb){ sidebar.addItem('users', function(cb){
var invited = blocks.activeCheckbox({ var invited = blocks.activeCheckbox({
@ -1504,6 +1521,7 @@ define([
cb([form, list]); cb([form, list]);
}); });
// Msg.admin_defaultlimitHint, .admin_defaultlimitTitle
sidebar.addItem('defaultlimit', function (cb) { sidebar.addItem('defaultlimit', function (cb) {
var _limit = APP.instanceStatus.defaultStorageLimit; var _limit = APP.instanceStatus.defaultStorageLimit;
var _limitMB = Util.bytesToMegabytes(_limit); var _limitMB = Util.bytesToMegabytes(_limit);
@ -1552,6 +1570,7 @@ define([
cb(form); cb(form);
}); });
// Msg.admin_setlimitHint, .admin_setlimitTitle
sidebar.addItem('setlimit', function(cb){ sidebar.addItem('setlimit', function(cb){
var user = blocks.input({ type:'text', class: 'cp-setlimit-user'}); var user = blocks.input({ type:'text', class: 'cp-setlimit-user'});
var userBlock = blocks.labelledInput(Messages.admin_limitUser, user); var userBlock = blocks.labelledInput(Messages.admin_limitUser, user);
@ -1650,6 +1669,7 @@ define([
cb(form); cb(form);
}); });
// Msg.admin_getlimitsHint, .admin_getlimitsTitle
sidebar.addItem('getlimits', function(cb){ sidebar.addItem('getlimits', function(cb){
var header = [ var header = [
Messages.settings_publicSigningKey, Messages.settings_publicSigningKey,
@ -1718,6 +1738,7 @@ define([
cb(table); cb(table);
}); });
// Msg.admin_accountMetadataHint.admin_accountMetadataTitle
sidebar.addItem('account-metadata', function(cb) { sidebar.addItem('account-metadata', function(cb) {
var input = blocks.input({ var input = blocks.input({
type: 'text', type: 'text',
@ -2087,6 +2108,7 @@ define([
}; };
// Msg.admin_documentMetadataHint.admin_documentMetadataTitle
sidebar.addItem('document-metadata', function(cb){ sidebar.addItem('document-metadata', function(cb){
var input = blocks.input({ var input = blocks.input({
type: 'text', type: 'text',
@ -2326,6 +2348,7 @@ define([
return tableObj.table; return tableObj.table;
}; };
// Msg.admin_blockMetadataHint.admin_blockMetadataTitle
sidebar.addItem('block-metadata', function(cb){ sidebar.addItem('block-metadata', function(cb){
var input = blocks.input({ var input = blocks.input({
type: 'text', type: 'text',
@ -2453,6 +2476,7 @@ define([
return Nacl.sign.detached.verify(msg, sig, pub); return Nacl.sign.detached.verify(msg, sig, pub);
}; };
// Msg.admin_totpRecoveryHint.admin_totpRecoveryTitle
sidebar.addItem('totp-recovery', function(cb){ sidebar.addItem('totp-recovery', function(cb){
var textarea = blocks.textarea({ var textarea = blocks.textarea({
id: 'textarea-input', id: 'textarea-input',
@ -2540,6 +2564,7 @@ define([
noHint: true noHint: true
}); });
// Msg.admin_uptimeTitle, .admin_uptimeHint
sidebar.addItem('uptime', function(cb){ sidebar.addItem('uptime', function(cb){
var pre = blocks.pre(Messages.admin_uptimeTitle); var pre = blocks.pre(Messages.admin_uptimeTitle);
var set = function () { var set = function () {
@ -2557,6 +2582,7 @@ define([
cb(pre); cb(pre);
}); });
// Msg.admin_activeSessionsHint, .admin_activeSessionsTitle
sidebar.addItem('active-sessions', function(cb){ sidebar.addItem('active-sessions', function(cb){
var pre = blocks.pre(''); var pre = blocks.pre('');
var onRefresh = function () { var onRefresh = function () {
@ -2575,6 +2601,7 @@ define([
cb(pre); cb(pre);
}); });
// Msg.admin_activePadsHint, .admin_activePadsTitle
sidebar.addItem('active-pads', function(cb){ sidebar.addItem('active-pads', function(cb){
var pre = blocks.pre(''); var pre = blocks.pre('');
var onRefresh = function () { var onRefresh = function () {
@ -2591,6 +2618,7 @@ define([
cb(pre); cb(pre);
}); });
// Msg.admin_openFilesHint, .admin_openFilesTitle
sidebar.addItem('open-files', function(cb){ sidebar.addItem('open-files', function(cb){
var pre = blocks.pre(''); var pre = blocks.pre('');
var onRefresh = function () { var onRefresh = function () {
@ -2613,6 +2641,7 @@ define([
cb(pre); cb(pre);
}); });
// Msg.admin_registeredHint, .admin_registeredTitle
sidebar.addItem('registered', function(cb){ sidebar.addItem('registered', function(cb){
var pre = blocks.pre(''); var pre = blocks.pre('');
var onRefresh = function () { var onRefresh = function () {
@ -2629,6 +2658,7 @@ define([
cb(pre); cb(pre);
}); });
// Msg.admin_diskUsageHint, .admin_diskUsageTitle, .admin_diskUsageButton
sidebar.addItem('disk-usage', function(cb){ sidebar.addItem('disk-usage', function(cb){
var button = blocks.button('primary', '', Messages.admin_diskUsageButton); var button = blocks.button('primary', '', Messages.admin_diskUsageButton);
var $button = $(button); var $button = $(button);
@ -2761,6 +2791,7 @@ define([
refreshSupport(); refreshSupport();
}); });
}; };
// Msg.admin_supportSetupHint, .admin_supportSetupTitle
sidebar.addItem('support-setup', function (cb) { sidebar.addItem('support-setup', function (cb) {
let content = blocks.block(); let content = blocks.block();
const $div = $(content); const $div = $(content);
@ -2830,6 +2861,7 @@ define([
cb(content); cb(content);
}); });
// Msg.admin_supportTeamHint, .admin_supportTeamTitle
sidebar.addItem('support-team', function (cb) { sidebar.addItem('support-team', function (cb) {
let edPublic = common.getMetadataMgr().getPrivateData().edPublic; // My edPublic let edPublic = common.getMetadataMgr().getPrivateData().edPublic; // My edPublic
let content = blocks.block(); let content = blocks.block();
@ -3039,6 +3071,7 @@ define([
}); });
}; };
// Msg.admin_maintenanceHint, admin_maintenanceTitle
sidebar.addItem('maintenance', function(cb){ sidebar.addItem('maintenance', function(cb){
var button = blocks.button('primary', '', Messages.admin_maintenanceButton); var button = blocks.button('primary', '', Messages.admin_maintenanceButton);
var $button = $(button); var $button = $(button);
@ -3164,6 +3197,7 @@ define([
}); });
// Msg.admin_surveyHint, admin_surveyTitle
sidebar.addItem('survey', function(cb){ sidebar.addItem('survey', function(cb){
var button = blocks.button('primary', '', Messages.admin_surveyButton); var button = blocks.button('primary', '', Messages.admin_surveyButton);
var $button = $(button); var $button = $(button);
@ -3248,6 +3282,7 @@ define([
cb(form); cb(form);
}); });
// Msg.admin_broadcastHint, admin_broadcastTitle
sidebar.addItem('broadcast', function(cb) { sidebar.addItem('broadcast', function(cb) {
var form = blocks.block([], 'cp-admin-broadcast-form'); var form = blocks.block([], 'cp-admin-broadcast-form');
var $form = $(form); var $form = $(form);
@ -3490,6 +3525,7 @@ define([
noHint: true noHint: true
}); });
// Msg.admin_performanceProfilingHint, .admin_performanceProfilingTitle
sidebar.addItem('performance-profiling', function(cb){ sidebar.addItem('performance-profiling', function(cb){
var header = [ var header = [
Messages.admin_performanceKeyHeading, Messages.admin_performanceKeyHeading,
@ -3534,6 +3570,7 @@ define([
}); });
// Msg.admin_enableDiskMeasurementsTitle.admin_enableDiskMeasurementsHint
sidebar.addCheckboxItem({ sidebar.addCheckboxItem({
getState: function () { getState: function () {
return APP.instanceStatus.enableProfiling; return APP.instanceStatus.enableProfiling;
@ -3560,6 +3597,7 @@ define([
return n && typeof(n) === 'number' && n % 1 === 0 && n > 0; return n && typeof(n) === 'number' && n % 1 === 0 && n > 0;
}; };
// Msg.admin_bytesWrittenTitle.admin_bytesWrittenHint
sidebar.addItem('bytes-written', function(cb){ sidebar.addItem('bytes-written', function(cb){
var duration = APP.instanceStatus.profilingWindow; var duration = APP.instanceStatus.profilingWindow;
if (!isPositiveInteger(duration)) { duration = 10000; } if (!isPositiveInteger(duration)) { duration = 10000; }
@ -3601,6 +3639,7 @@ define([
cb(form); cb(form);
}); });
// Messages.admin_updateAvailableTitle.admin_updateAvailableHint.admin_updateAvailableLabel.admin_updateAvailableButton
sidebar.addItem('update-available', function(cb){ sidebar.addItem('update-available', function(cb){
if (!APP.instanceStatus.updateAvailable) { return; } if (!APP.instanceStatus.updateAvailable) { return; }
@ -3616,6 +3655,7 @@ define([
cb(button); cb(button);
}); });
// Messages.admin_checkupButton.admin_checkupHint.admin_checkupTitle
sidebar.addItem('checkup', function(cb){ sidebar.addItem('checkup', function(cb){
var button = blocks.button('primary', '', Messages.admin_checkupButton); var button = blocks.button('primary', '', Messages.admin_checkupButton);
Util.onClickEnter($(button), function () { Util.onClickEnter($(button), function () {
@ -3626,6 +3666,7 @@ define([
}); });
// Messages.admin_blockDailyCheckTitle.admin_blockDailyCheckHint.admin_blockDailyCheckLabel
sidebar.addCheckboxItem({ sidebar.addCheckboxItem({
key: 'block-daily-check', key: 'block-daily-check',
getState: function () { getState: function () {
@ -3647,6 +3688,7 @@ define([
} }
}); });
// Messages.admin_provideAggregateStatisticsTitle.admin_provideAggregateStatisticsHint.admin_provideAggregateStatisticsLabel
sidebar.addCheckboxItem({ sidebar.addCheckboxItem({
key: 'provide-aggregate-statistics', key: 'provide-aggregate-statistics',
getState: function () { getState: function () {
@ -3668,7 +3710,7 @@ define([
} }
}); });
// Messages.admin_listMyInstanceTitle.admin_listMyInstanceHint.admin_listMyInstanceLabel
sidebar.addCheckboxItem({ sidebar.addCheckboxItem({
key: 'list-my-instance', key: 'list-my-instance',
getState: function () { getState: function () {
@ -3690,6 +3732,7 @@ define([
} }
}); });
// Messages.admin_consentToContactTitle.admin_consentToContactHint.admin_consentToContactLabel
sidebar.addCheckboxItem({ sidebar.addCheckboxItem({
key: 'consent-to-contact', key: 'consent-to-contact',
getState: function () { getState: function () {
@ -3711,6 +3754,7 @@ define([
} }
}); });
// Messages.admin_removeDonateButtonTitle.admin_removeDonateButtonHint.admin_removeDonateButtonLabel
sidebar.addCheckboxItem({ sidebar.addCheckboxItem({
key: 'remove-donate-button', key: 'remove-donate-button',
getState: function () { getState: function () {
@ -3740,6 +3784,7 @@ define([
}, cb); }, cb);
}; };
// Messages.admin_instancePurposeTitle.admin_instancePurposeHint
sidebar.addItem('instance-purpose', function(cb){ sidebar.addItem('instance-purpose', function(cb){
var values = [ var values = [
'noanswer', // Messages.admin_purpose_noanswer 'noanswer', // Messages.admin_purpose_noanswer

View File

@ -338,7 +338,7 @@ define([
// Make sidebar layout // Make sidebar layout
const categories = { const categories = {
'open': { 'open': { // Msg.support_cat_open
icon: 'fa fa-inbox', icon: 'fa fa-inbox',
content: [ content: [
'refresh', 'refresh',
@ -347,7 +347,7 @@ define([
'pending-list', 'pending-list',
] ]
}, },
'closed': { 'closed': { // Msg.support_cat_closed
icon: 'fa fa-archive', icon: 'fa fa-archive',
content: [ content: [
'refresh', 'refresh',
@ -355,7 +355,7 @@ define([
'closed-list' 'closed-list'
] ]
}, },
'search': { 'search': { // Msg.support_cat_search
icon: 'fa fa-search', icon: 'fa fa-search',
content: [ content: [
'filter', 'filter',
@ -368,7 +368,7 @@ define([
}); });
} }
}, },
'new': { 'new': { // Msg.support_cat_new
icon: 'fa fa-envelope', icon: 'fa fa-envelope',
content: [ content: [
'open-ticket' 'open-ticket'
@ -380,13 +380,13 @@ define([
}); });
} }
}, },
'legacy': { 'legacy': { // Msg.support_cat_legacy
icon: 'fa fa-server', icon: 'fa fa-server',
content: [ content: [
'legacy' 'legacy'
] ]
}, },
'settings': { 'settings': { // Msg.support_cat_settings
icon: 'fa fa-cogs', icon: 'fa fa-cogs',
content: [ content: [
'privacy', 'privacy',
@ -412,6 +412,7 @@ define([
cb(content); cb(content);
}, { noTitle: true, noHint: true }); }, { noTitle: true, noHint: true });
// Msg.support_privacyHint.support_privacyTitle
sidebar.addCheckboxItem({ sidebar.addCheckboxItem({
key: 'privacy', key: 'privacy',
getState: () => false, getState: () => false,
@ -434,6 +435,7 @@ define([
}, { noTitle: true, noHint: true }); }, { noTitle: true, noHint: true });
refreshAll(); refreshAll();
// Msg.support_notificationsHint.support_notificationsTitle.support_notificationsLabel
sidebar.addCheckboxItem({ sidebar.addCheckboxItem({
key: 'notifications', key: 'notifications',
getState: () => APP.disableSupportNotif, getState: () => APP.disableSupportNotif,
@ -605,6 +607,7 @@ define([
cb(container); cb(container);
}, { noTitle: true, noHint: true }); }, { noTitle: true, noHint: true });
// Msg.support_recordedHint.support_recordedTitle
sidebar.addItem('recorded', cb => { sidebar.addItem('recorded', cb => {
let empty = blocks.inline(Messages.support_recordedEmpty); let empty = blocks.inline(Messages.support_recordedEmpty);
let list = blocks.block([], 'cp-moderation-recorded-list'); let list = blocks.block([], 'cp-moderation-recorded-list');
@ -689,6 +692,7 @@ define([
cb(form); cb(form);
}); });
// Msg.support_openTicketHint.support_openTicketTitle
sidebar.addItem('open-ticket', cb => { sidebar.addItem('open-ticket', cb => {
let form = APP.support.makeForm({}); let form = APP.support.makeForm({});
@ -784,6 +788,7 @@ define([
cb(div); cb(div);
}); });
// Msg.support_legacyHint.support_legacyTitle
sidebar.addItem('legacy', cb => { sidebar.addItem('legacy', cb => {
if (!APP.privateKey) { return void cb(false); } if (!APP.privateKey) { return void cb(false); }