annotate generated translation keys to suppress warnings

This commit is contained in:
ansuz 2021-03-01 10:15:47 +05:30
parent 3457ae31cd
commit 6dcc471c81
7 changed files with 101 additions and 73 deletions

View File

@ -44,26 +44,26 @@ define([
var SPECIAL_GROUP_ITEMS = {};
SPECIAL_GROUP_ITEMS.storage0 = function (f) {
return groupItemTemplate(
Msg['features_f_' + f],
Msg._getKey('features_f_' + f + '_note', [Config.inactiveTime])
Msg['features_f_' + f], // .features_f_storage0
Msg._getKey('features_f_' + f + '_note', [Config.inactiveTime]) // .features_f_storage0_note
);
};
SPECIAL_GROUP_ITEMS.file1 = function (f) {
return groupItemTemplate(
Msg['features_f_' + f],
Msg._getKey('features_f_' + f + '_note', [Config.maxUploadSize / 1024 / 1024])
Msg['features_f_' + f], // .features_f_file1
Msg._getKey('features_f_' + f + '_note', [Config.maxUploadSize / 1024 / 1024]) // .features_f_file1_note
);
};
SPECIAL_GROUP_ITEMS.storage1 = function (f) {
return groupItemTemplate(
Msg._getKey('features_f_' + f, [Util.getPrettySize(Config.defaultStorageLimit, Msg)]),
Msg['features_f_' + f + '_note']
Msg._getKey('features_f_' + f, [Util.getPrettySize(Config.defaultStorageLimit, Msg)]), // .features_f_storage1
Msg['features_f_' + f + '_note'] // .features_f_storage1_note
);
};
SPECIAL_GROUP_ITEMS.storage2 = function (f) {
return groupItemTemplate(
Msg['features_f_' + f],
Msg._getKey('features_f_' + f + '_note', [Config.premiumUploadSize / 1024 / 1024])
Msg['features_f_' + f], // .features_f_storage2
Msg._getKey('features_f_' + f + '_note', [Config.premiumUploadSize / 1024 / 1024]) // .features_f_storage2_note
);
};
@ -81,7 +81,13 @@ define([
h('div.text-center', '0€'),
h('div.text-center', Msg.features_noData),
]),
h('ul.list-group.list-group-flush', ['apps', 'file0', 'core', 'cryptdrive0', 'storage0'].map(groupItem)),
h('ul.list-group.list-group-flush', [
'apps',
'file0', // Msg.features_f_file0, .features_f_file0_note
'core', // Msg.features_f_core, Msg.features_f_core_note
'cryptdrive0', // Msg.features_f_cryptdrive0, .features_f_cryptdrive0_note
'storage0'
].map(groupItem)),
]),
]);
@ -95,7 +101,14 @@ define([
h('div.text-center', '0€'),
h('div.text-center', Msg.features_noData),
]),
h('ul.list-group.list-group-flush', ['anon', 'social', 'file1', 'cryptdrive1', 'devices', 'storage1'].map(groupItem)),
h('ul.list-group.list-group-flush', [
'anon', // Msg.features_f_anon, .features_f_anon_note
'social', // Msg.features_f_social, .features_f_social_note
'file1',
'cryptdrive1', // Msg.features_f_cryptdrive1, .features_f_cryptdrive1_note
'devices', // Msg.features_f_devices, .features_f_devices_note
'storage1' // Msg.features_f_storage1, .features_f_storage1_note
].map(groupItem)),
h('div.card-body',[
h('div.cp-features-register#cp-features-register', [
h('a', {
@ -118,7 +131,12 @@ define([
}, Msg._getKey('features_pricing', ['5', '10', '15']))),
h('div.text-center', Msg.features_emailRequired),
]),
h('ul.list-group.list-group-flush', ['reg', 'storage2', 'support', 'supporter'].map(groupItem)),
h('ul.list-group.list-group-flush', [
'reg', // Msg.features_f_reg, .features_f_reg_note
'storage2',
'support', // Msg.features_f_support, .features_f_support_note
'supporter' // Msg.features_f_supporter, .features_f_supporter_note
].map(groupItem)),
h('div.card-body',[
h('div.cp-features-register#cp-features-subscribe', [
premiumButton

View File

@ -40,20 +40,20 @@ define([
var sFrameChan;
var categories = {
'general': [
'general': [ // Msg.admin_cat_general
'cp-admin-flush-cache',
'cp-admin-update-limit',
'cp-admin-archive',
'cp-admin-unarchive',
// 'cp-admin-registration',
],
'quota': [
'quota': [ // Msg.admin_cat_quota
'cp-admin-defaultlimit',
'cp-admin-setlimit',
'cp-admin-getquota',
'cp-admin-getlimits',
],
'stats': [
'stats': [ // Msg.admin_cat_stats
'cp-admin-refresh-stats',
'cp-admin-active-sessions',
'cp-admin-active-pads',
@ -61,11 +61,11 @@ define([
'cp-admin-registered',
'cp-admin-disk-usage',
],
'support': [
'support': [ // Msg.admin_cat_support
'cp-admin-support-list',
'cp-admin-support-init'
],
'performance': [
'performance': [ // Msg.admin_cat_performance
'cp-admin-refresh-performance',
'cp-admin-performance-profiling',
]
@ -73,7 +73,7 @@ define([
var create = {};
var makeBlock = function (key, addButton) {
var makeBlock = function (key, addButton) { // Title, Hint, maybeButton
// Convert to camlCase for translation keys
var safeKey = key.replace(/-([a-z])/g, function (g) { return g[1].toUpperCase(); });
@ -90,7 +90,7 @@ define([
};
create['update-limit'] = function () {
var key = 'update-limit';
var $div = makeBlock(key, true);
var $div = makeBlock(key, true); // Msg.admin_updateLimitHint, .admin_updateLimitTitle, .admin_updateLimitButton
$div.find('button').click(function () {
sFrameChan.query('Q_UPDATE_LIMIT', null, function (e, res) {
if (e || (res && res.error)) { return void console.error(e || res.error); }
@ -101,7 +101,7 @@ define([
};
create['flush-cache'] = function () {
var key = 'flush-cache';
var $div = makeBlock(key, true);
var $div = makeBlock(key, true); // Msg.admin_flushCacheHint, .admin_flushCacheTitle, .admin_flushCacheButton
var called = false;
$div.find('button').click(function () {
if (called) { return; }
@ -225,14 +225,14 @@ define([
create['archive'] = function () {
var key = 'archive';
var $div = makeBlock(key, true);
var $div = makeBlock(key, true); // Msg.admin_archiveHint, .admin_archiveTitle, .admin_archiveButton
var $button = $div.find('button');
archiveForm(true, $div, $button);
return $div;
};
create['unarchive'] = function () {
var key = 'unarchive';
var $div = makeBlock(key, true);
var $div = makeBlock(key, true); // Msg.admin_unarchiveHint, .admin_unarchiveTitle, .admin_unarchiveButton
var $button = $div.find('button');
archiveForm(false, $div, $button);
return $div;
@ -240,7 +240,7 @@ define([
create['registration'] = function () {
var key = 'registration';
var $div = makeBlock(key, true);
var $div = makeBlock(key, true); // Msg.admin_registrationHint, .admin_registrationTitle, .admin_registrationButton
var $button = $div.find('button');
var state = APP.instanceStatus.restrictRegistration;
if (state) {
@ -282,7 +282,7 @@ define([
create['defaultlimit'] = function () {
var key = 'defaultlimit';
var $div = makeBlock(key);
var $div = makeBlock(key); // Msg.admin_defaultlimitHint, .admin_defaultlimitTitle
var _limit = APP.instanceStatus.defaultStorageLimit;
var _limitMB = Util.bytesToMegabytes(_limit);
var limit = getPrettySize(_limit);
@ -322,7 +322,7 @@ define([
};
create['getlimits'] = function () {
var key = 'getlimits';
var $div = makeBlock(key);
var $div = makeBlock(key); // Msg.admin_getlimitsHint, .admin_getlimitsTitle
APP.refreshLimits = function () {
sFrameChan.query('Q_ADMIN_RPC', {
cmd: 'GET_LIMITS',
@ -385,7 +385,7 @@ define([
create['setlimit'] = function () {
var key = 'setlimit';
var $div = makeBlock(key);
var $div = makeBlock(key); // Msg.admin_setlimitHint, .admin_setlimitTitle
var user = h('input.cp-setlimit-key');
var $key = $(user);
@ -471,7 +471,7 @@ define([
create['getquota'] = function () {
var key = 'getquota';
var $div = makeBlock(key, true);
var $div = makeBlock(key, true); // Msg.admin_getquotaHint, .admin_getquotaTitle, .admin_getquotaButton
var input = h('input#cp-admin-getquota', {
type: 'text'
@ -521,7 +521,7 @@ define([
create['active-sessions'] = function () {
var key = 'active-sessions';
var $div = makeBlock(key);
var $div = makeBlock(key); // Msg.admin_activeSessionsHint, .admin_activeSessionsTitle
var onRefresh = function () {
$div.find('pre').remove();
sFrameChan.query('Q_ADMIN_RPC', {
@ -539,7 +539,7 @@ define([
};
create['active-pads'] = function () {
var key = 'active-pads';
var $div = makeBlock(key);
var $div = makeBlock(key); // Msg.admin_activePadsHint, .admin_activePadsTitle
var onRefresh = function () {
$div.find('pre').remove();
sFrameChan.query('Q_ADMIN_RPC', {
@ -556,7 +556,7 @@ define([
};
create['open-files'] = function () {
var key = 'open-files';
var $div = makeBlock(key);
var $div = makeBlock(key); // Msg.admin_openFilesHint, .admin_openFilesTitle
var onRefresh = function () {
$div.find('pre').remove();
sFrameChan.query('Q_ADMIN_RPC', {
@ -573,7 +573,7 @@ define([
};
create['registered'] = function () {
var key = 'registered';
var $div = makeBlock(key);
var $div = makeBlock(key); // Msg.admin_registeredHint, .admin_registeredTitle
var onRefresh = function () {
$div.find('pre').remove();
sFrameChan.query('Q_ADMIN_RPC', {
@ -590,7 +590,7 @@ define([
};
create['disk-usage'] = function () {
var key = 'disk-usage';
var $div = makeBlock(key, true);
var $div = makeBlock(key, true); // Msg.admin_diskUsageHint, .admin_diskUsageTitle, .admin_diskUsageButton
var called = false;
$div.find('button').click(function () {
$div.find('button').hide();
@ -628,7 +628,7 @@ define([
var supportKey = ApiConfig.supportMailbox;
create['support-list'] = function () {
if (!supportKey || !APP.privateKey) { return; }
var $container = makeBlock('support-list');
var $container = makeBlock('support-list'); // Msg.admin_supportListHint, .admin_supportListTitle
var $div = $(h('div.cp-support-container')).appendTo($container);
var catContainer = h('div.cp-dropdown-container');
@ -893,7 +893,7 @@ define([
};
create['support-init'] = function () {
var $div = makeBlock('support-init');
var $div = makeBlock('support-init'); // Msg.admin_supportInitHint, .admin_supportInitTitle
if (!supportKey) {
$div.append(h('p', Messages.admin_supportInitHelp));
return $div;
@ -945,7 +945,7 @@ define([
};
create['performance-profiling'] = function () {
var $div = makeBlock('performance-profiling');
var $div = makeBlock('performance-profiling'); // Msg.admin_performanceProfilingHint, .admin_performanceProfilingTitle
var onRefresh = function () {
var body = h('tbody');

View File

@ -32,16 +32,16 @@ define([
var sFrameChan;
var categories = {
'all': [
'all': [ // Msg.notifications_cat_all
'cp-notifications-all',
],
'friends': [
'friends': [ // Msg.notifications_cat_friends
'cp-notifications-friends',
],
'pads': [
'pads': [ // Msg.notifications_cat_pads
'cp-notifications-pads',
],
'archived': [
'archived': [ // Msg.notifications_cat_archived
'cp-notifications-archived',
],
};

View File

@ -46,7 +46,7 @@ define([
var sframeChan;
var categories = {
'account': [
'account': [ // Msg.settings_cat_account
'cp-settings-own-drive',
'cp-settings-info-block',
'cp-settings-displayname',
@ -55,14 +55,14 @@ define([
'cp-settings-change-password',
'cp-settings-delete'
],
'security': [
'security': [ // Msg.settings_cat_security
'cp-settings-logout-everywhere',
'cp-settings-autostore',
'cp-settings-safe-links',
'cp-settings-userfeedback',
'cp-settings-cache',
],
'style': [
'style': [ // Msg.settings_cat_style
'cp-settings-colortheme',
'cp-settings-custom-theme',
],
@ -75,24 +75,24 @@ define([
'cp-settings-trim-history'
//'cp-settings-drive-reset'
],
'cursor': [
'cursor': [ // Msg.settings_cat_cursor
'cp-settings-cursor-color',
'cp-settings-cursor-share',
'cp-settings-cursor-show',
],
'pad': [
'pad': [ // Msg.settings_cat_pad
'cp-settings-pad-width',
'cp-settings-pad-spellcheck',
'cp-settings-pad-notif',
],
'code': [
'code': [ // Msg.settings_cat_code
'cp-settings-code-indent-unit',
'cp-settings-code-indent-type',
'cp-settings-code-brackets',
'cp-settings-code-font-size',
'cp-settings-code-spellcheck',
],
'kanban': [
'kanban': [ // Msg.settings_cat_kanban
'cp-settings-kanban-tags',
],
'subscription': {
@ -364,7 +364,7 @@ define([
return $div;
};
makeBlock('cache', function (cb) {
makeBlock('cache', function (cb) { // Msg.settings_cacheHint, .settings_cacheTitle
var store = window.cryptpadStore;
var $cbox = $(UI.createCheckbox('cp-settings-cache',
@ -412,10 +412,15 @@ define([
]);
}, true);
makeBlock('colortheme', function (cb) {
makeBlock('colortheme', function (cb) { // Msg.settings_colorthemeHint .settings_colorthemeTitle
var theme = window.cryptpadStore.store['colortheme'] || 'default';
var os = window.cryptpadStore.store['colortheme_default'] || 'light';
var values = ['default', 'light', 'dark'/*, 'custom'*/];
var values = [
'default', // Msg.settings_colortheme_default
'light', // Msg.settings_colortheme_light
'dark', // Msg.settings_colortheme_dark
/* 'custom'*/ // Msg.settings_colortheme_custom
];
var defaultTheme = Messages['settings_colortheme_'+os];
var opts = h('div.cp-settings-radio-container', [
@ -626,7 +631,7 @@ define([
return $div;
};
makeBlock('own-drive', function(cb, $div) {
makeBlock('own-drive', function(cb, $div) { // Msg.settings_ownDriveHint, .settings_ownDriveTitle
if (privateData.isDriveOwned || !common.isLoggedIn()) {
return void cb(false);
}
@ -681,7 +686,7 @@ define([
cb(form);
}, true);
makeBlock('mediatag-size', function(cb) {
makeBlock('mediatag-size', function(cb) { // Msg.settings_mediatagSizeHint, .settings_mediatagSizeTitle
var $inputBlock = $('<div>', {
'class': 'cp-sidebarlayout-input-block',
});
@ -735,7 +740,7 @@ define([
// Security
makeBlock('safe-links', function(cb) {
makeBlock('safe-links', function(cb) { // Msg.settings_safeLinksTitle
var $cbox = $(UI.createCheckbox('cp-settings-safe-links',
Messages.settings_safeLinksCheckbox,
@ -1059,7 +1064,7 @@ define([
$div.find('#cp-settings-trim-container').remove();
cb(content);
};
makeBlock('trim-history', function(cb, $div) {
makeBlock('trim-history', function(cb, $div) { // Msg.settings_trimHistoryHint, .settings_trimHistoryTitle
if (!common.isLoggedIn()) { return void cb(false); }
redrawTrimHistory(cb, $div);
}, true);
@ -1295,7 +1300,7 @@ define([
return $div;
};
makeBlock('pad-notif', function(cb) {
makeBlock('pad-notif', function(cb) { // Msg.settings_padNotifHint, .settings_padNotifTitle
var $cbox = $(UI.createCheckbox('cp-settings-pad-notif',
Messages.settings_padNotifCheckbox,
false, { label: { class: 'noTitle' } }));
@ -1487,7 +1492,7 @@ define([
};
makeBlock('kanban-tags', function(cb) {
makeBlock('kanban-tags', function(cb) { // Msg.settings_kanbanTagsHint, .settings_kanbanTagsTitle
var opt1 = UI.createRadio('cp-settings-kanban-tags', 'cp-settings-kanban-tags-and',
Messages.settings_kanbanTagsAnd, false, {

View File

@ -39,10 +39,10 @@ define([
var privateData;
var categories = {
'tickets': [
'tickets': [ // Msg.support_cat_tickets
'cp-support-list',
],
'new': [
'new': [ // Msg.support_cat_new
'cp-support-language',
'cp-support-form',
],
@ -86,7 +86,7 @@ define([
// List existing (open?) tickets
create['list'] = function () {
var key = 'list';
var $div = makeBlock(key);
var $div = makeBlock(key); // Msg.support_listHint, .support_listTitle
$div.addClass('cp-support-container');
var hashesById = {};
@ -166,7 +166,7 @@ define([
// Create a new tickets
create['form'] = function () {
var key = 'form';
var $div = makeBlock(key, true);
var $div = makeBlock(key, true); // Msg.support_formHint, .support_formTitle, .support_formButton
var form = APP.support.makeForm();
@ -192,7 +192,7 @@ define([
// Support is disabled...
create['disabled'] = function () {
var key = 'disabled';
var $div = makeBlock(key);
var $div = makeBlock(key); // Msg.support_disabledHint, .support_disabledTitle
return $div;
};

View File

@ -124,8 +124,13 @@ define([
};
var makeCategoryDropdown = function (ctx, container, onChange, all) {
var categories = ['account', 'data', 'bug', 'other'];
if (all) { categories.push('all'); }
var categories = [
'account', // Msg.support_cat_account
'data', // Msg.support_cat_data
'bug', // Msg.support_cat_bug
'other' // Msg.support_cat_other
];
if (all) { categories.push('all'); } // Msg.support_cat_all
categories = categories.map(function (key) {
return {
tag: 'a',

View File

@ -148,37 +148,37 @@ define([
};
var mainCategories = {
'list': [
'list': [ // Msg.team_cat_list
'cp-team-list',
],
'create': [
'cp-team-create',
],
'general': [
'general': [ // Msg.team_cat_general
'cp-team-info',
],
'link': [
'link': [ // Msg.team_cat_link
'cp-team-link',
],
};
var teamCategories = {
'back': {
'back': { // Msg.team_cat_back
onClick: function (common) {
closeTeam(common);
}
},
'drive': [
'drive': [ // Msg.team_cat_drive
'cp-team-drive'
],
'members': [
'members': [ // Msg.team_cat_members
'cp-team-offline',
'cp-team-roster'
],
'chat': [
'chat': [ // Msg.team_cat_chat
'cp-team-offline',
'cp-team-chat'
],
'admin': [
'admin': [ // Msg.team_cat_admin
'cp-team-offline',
'cp-team-edpublic',
'cp-team-name',
@ -996,7 +996,7 @@ define([
cb(content);
});
makeBlock('name', function (common, cb) {
makeBlock('name', function (common, cb) { // Msg.team_nameHint, .team_nameTitle
var $inputBlock = $('<div>', {'class': 'cp-sidebarlayout-input-block'});
var $input = $('<input>', {
'type': 'text',
@ -1055,7 +1055,7 @@ define([
});
}, true);
makeBlock('avatar', function (common, cb) {
makeBlock('avatar', function (common, cb) { // Msg.team_avatarHint, .team_avatarTitle
// Upload
var avatar = h('div.cp-team-avatar.cp-avatar');
var $avatar = $(avatar);
@ -1110,7 +1110,7 @@ define([
});
}, true);
makeBlock('export', function (common, cb) {
makeBlock('export', function (common, cb) { // Msg.team_exportHint, .team_exportTitle
// Backup all the pads
var sframeChan = common.getSframeChannel();
var privateData = common.getMetadataMgr().getPrivateData();
@ -1152,7 +1152,7 @@ define([
cb(button);
}, true);
makeBlock('delete', function (common, cb, $div) {
makeBlock('delete', function (common, cb, $div) { // Msg.team_deleteHint, .team_deleteTitle
$div.addClass('cp-online');
var deleteTeam = h('button.btn.btn-danger', Messages.team_deleteButton);
var $ok = $('<span>', {'class': 'fa fa-check', title: Messages.saved}).hide();