Skip to content

Commit b6cff5a

Browse files
author
Jamie Curnow
committed
i18n and improvements
1 parent d49c3ba commit b6cff5a

34 files changed

+314
-412
lines changed
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<thead>
2-
<th width="30">&nbsp;</th>
3-
<th>Name</th>
4-
<th>Email</th>
5-
<th>Roles</th>
6-
<th>&nbsp;</th>
2+
<th width="30">&nbsp;</th>
3+
<th>Name</th>
4+
<th>Email</th>
5+
<th>Roles</th>
6+
<th>&nbsp;</th>
77
</thead>
88
<tbody>
9-
<!-- items -->
9+
<!-- items -->
1010
</tbody>

src/frontend/js/app/audit-log/main.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div class="card">
22
<div class="card-header">
3-
<h3 class="card-title">Audit Log</h3>
3+
<h3 class="card-title"><%- i18n('audit-log', 'title') %></h3>
44
</div>
55
<div class="card-body no-padding min-100">
66
<div class="dimmer active">

src/frontend/js/app/audit-log/main.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
'use strict';
22

33
const Mn = require('backbone.marionette');
4+
const App = require('../main');
45
const AuditLogModel = require('../../models/audit-log');
5-
const Api = require('../api');
6-
const Controller = require('../controller');
76
const ListView = require('./list/main');
87
const template = require('./main.ejs');
98
const ErrorView = require('../error/main');
@@ -25,16 +24,16 @@ module.exports = Mn.View.extend({
2524
onRender: function () {
2625
let view = this;
2726

28-
Api.AuditLog.getAll()
27+
App.Api.AuditLog.getAll()
2928
.then(response => {
3029
if (!view.isDestroyed() && response && response.length) {
3130
view.showChildView('list_region', new ListView({
3231
collection: new AuditLogModel.Collection(response)
3332
}));
3433
} else {
3534
view.showChildView('list_region', new EmptyView({
36-
title: 'There are no logs.',
37-
subtitle: 'As soon as you or another user changes something, history of those events will show up here.'
35+
title: App.i18n('audit-log', 'empty'),
36+
subtitle: App.i18n('audit-log', 'empty-subtitle')
3837
}));
3938
}
4039
})
@@ -43,7 +42,7 @@ module.exports = Mn.View.extend({
4342
code: err.code,
4443
message: err.message,
4544
retry: function () {
46-
Controller.showAuditLog();
45+
App.Controller.showAuditLog();
4746
}
4847
}));
4948

src/frontend/js/app/dashboard/main.ejs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div class="page-header">
2-
<h1 class="page-title">Hi <%- getUserName() %></h1>
2+
<h1 class="page-title"><%- i18n('dashboard', 'title', {name: getUserName()}) %></h1>
33
</div>
44

55
<% if (columns) { %>
@@ -12,7 +12,7 @@
1212
<i class="fe fe-zap"></i>
1313
</span>
1414
<div>
15-
<h4 class="m-0"><a href="/nginx/proxy"><%- getHostStat('proxy') %> <small>Proxy Hosts</small></a></h4>
15+
<h4 class="m-0"><a href="/nginx/proxy"><%- getHostStat('proxy') %> <small><%- i18n('proxy-hosts', 'title') %></small></a></h4>
1616
</div>
1717
</div>
1818
</div>
@@ -27,7 +27,7 @@
2727
<i class="fe fe-shuffle"></i>
2828
</span>
2929
<div>
30-
<h4 class="m-0"><a href="/nginx/redirection"><%- getHostStat('redirection') %> <small>Redirection Hosts</small></a></h4>
30+
<h4 class="m-0"><a href="/nginx/redirection"><%- getHostStat('redirection') %> <small><%- i18n('redirection-hosts', 'title') %></small></a></h4>
3131
</div>
3232
</div>
3333
</div>
@@ -42,7 +42,7 @@
4242
<i class="fe fe-radio"></i>
4343
</span>
4444
<div>
45-
<h4 class="m-0"><a href="/nginx/stream"><%- getHostStat('stream') %> <small> Streams</small></a></h4>
45+
<h4 class="m-0"><a href="/nginx/stream"><%- getHostStat('stream') %> <small> <%- i18n('streams', 'title') %></small></a></h4>
4646
</div>
4747
</div>
4848
</div>
@@ -57,7 +57,7 @@
5757
<i class="fe fe-zap-off"></i>
5858
</span>
5959
<div>
60-
<h4 class="m-0"><a href="/nginx/404"><%- getHostStat('dead') %> <small>404 Hosts</small></a></h4>
60+
<h4 class="m-0"><a href="/nginx/404"><%- getHostStat('dead') %> <small><%- i18n('dead-hosts', 'title') %></small></a></h4>
6161
</div>
6262
</div>
6363
</div>

src/frontend/js/app/error/main.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
<%- message %>
44

55
<% if (retry) { %>
6-
<br><br><a href="#" class="btn btn-sm btn-warning retry">Try again</a>
6+
<br><br><a href="#" class="btn btn-sm btn-warning retry"><%- i18n('str', 'try-again') %></a>
77
<% } %>

src/frontend/js/app/i18n.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ module.exports = function (namespace, key, data) {
2121
return messages['en'][namespace][key](data);
2222
}
2323

24-
return 'INVALID I18N: ' + namespace + '/' + key;
24+
return '(MISSING: ' + namespace + '/' + key + ')';
2525
};

src/frontend/js/app/main.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const App = Mn.Application.extend({
1616
Cache: Cache,
1717
Api: Api,
1818
UI: null,
19+
i18n: i18n,
1920
Controller: Controller,
2021

2122
region: {
Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<div class="modal-content">
22
<div class="modal-header">
3-
<h5 class="modal-title"><% if (typeof id !== 'undefined') { %>Edit<% } else { %>New<% } %> Proxy Host</h5>
3+
<h5 class="modal-title"><%- i18n('proxy-hosts', 'form-title', {id: id}) %></h5>
44
<button type="button" class="close cancel" aria-label="Close" data-dismiss="modal">&nbsp;</button>
55
</div>
66
<div class="modal-body has-tabs">
77
<form>
88
<ul class="nav nav-tabs" role="tablist">
9-
<li role="presentation" class="nav-item"><a href="#details" aria-controls="tab1" role="tab" data-toggle="tab" class="nav-link active"><i class="fe fe-zap"></i> Details</a></li>
10-
<li role="presentation" class="nav-item"><a href="#ssl-options" aria-controls="tab2" role="tab" data-toggle="tab" class="nav-link"><i class="fe fe-shield"></i> SSL</a></li>
9+
<li role="presentation" class="nav-item"><a href="#details" aria-controls="tab1" role="tab" data-toggle="tab" class="nav-link active"><i class="fe fe-zap"></i> <%- i18n('all-hosts', 'details') %></a></li>
10+
<li role="presentation" class="nav-item"><a href="#ssl-options" aria-controls="tab2" role="tab" data-toggle="tab" class="nav-link"><i class="fe fe-shield"></i> <%- i18n('all-hosts', 'SSL') %></a></li>
1111
</ul>
1212
<div class="tab-content">
1313
<!-- Details -->
@@ -16,19 +16,19 @@
1616

1717
<div class="col-sm-12 col-md-12">
1818
<div class="form-group">
19-
<label class="form-label">Domain Names <span class="form-required">*</span></label>
19+
<label class="form-label"><%- i18n('all-hosts', '___domain-names') %> <span class="form-required">*</span></label>
2020
<input type="text" name="domain_names" class="form-control" id="input-domains" value="<%- domain_names.join(',') %>" required>
2121
</div>
2222
</div>
2323
<div class="col-sm-8 col-md-8">
2424
<div class="form-group">
25-
<label class="form-label">Forward IP <span class="form-required">*</span></label>
25+
<label class="form-label"><%- i18n('proxy-hosts', 'forward-ip') %><span class="form-required">*</span></label>
2626
<input type="text" name="forward_ip" class="form-control text-monospace" placeholder="000.000.000.000" value="<%- forward_ip %>" autocomplete="off" maxlength="15" required>
2727
</div>
2828
</div>
2929
<div class="col-sm-4 col-md-4">
3030
<div class="form-group">
31-
<label class="form-label">Forward Port <span class="form-required">*</span></label>
31+
<label class="form-label"><%- i18n('proxy-hosts', 'forward-port') %> <span class="form-required">*</span></label>
3232
<input name="forward_port" type="number" class="form-control text-monospace" placeholder="80" value="<%- forward_port %>" required>
3333
</div>
3434
</div>
@@ -43,7 +43,7 @@
4343
<label class="custom-switch">
4444
<input type="checkbox" class="custom-switch-input" name="ssl_enabled" value="1"<%- ssl_enabled ? ' checked' : '' %>>
4545
<span class="custom-switch-indicator"></span>
46-
<span class="custom-switch-description">Enable SSL</span>
46+
<span class="custom-switch-description"><%- i18n('all-hosts', 'enable-ssl') %></span>
4747
</label>
4848
</div>
4949
</div>
@@ -52,21 +52,21 @@
5252
<label class="custom-switch">
5353
<input type="checkbox" class="custom-switch-input" name="ssl_forced" value="1"<%- ssl_forced ? ' checked' : '' %><%- ssl_enabled ? '' : ' disabled' %>>
5454
<span class="custom-switch-indicator"></span>
55-
<span class="custom-switch-description">Force SSL</span>
55+
<span class="custom-switch-description"><%- i18n('all-hosts', 'force-ssl') %></span>
5656
</label>
5757
</div>
5858
</div>
5959
<div class="col-sm-12 col-md-12">
6060
<div class="form-group">
61-
<label class="form-label">Certificate Provider</label>
61+
<label class="form-label"><%- i18n('all-hosts', 'cert-provider') %></label>
6262
<div class="selectgroup w-100">
6363
<label class="selectgroup-item">
6464
<input type="radio" name="ssl_provider" value="letsencrypt" class="selectgroup-input"<%- ssl_provider !== 'other' ? ' checked' : '' %>>
65-
<span class="selectgroup-button">Let's Encrypt</span>
65+
<span class="selectgroup-button"><%- i18n('all-hosts', 'letsencrypt') %></span>
6666
</label>
6767
<label class="selectgroup-item">
6868
<input type="radio" name="ssl_provider" value="other" class="selectgroup-input"<%- ssl_provider === 'other' ? ' checked' : '' %>>
69-
<span class="selectgroup-button">Other</span>
69+
<span class="selectgroup-button"><%- i18n('all-hosts', 'other-ssl') %></span>
7070
</label>
7171
</div>
7272
</div>
@@ -75,7 +75,7 @@
7575
<!-- Lets encrypt -->
7676
<div class="col-sm-12 col-md-12 letsencrypt-ssl">
7777
<div class="form-group">
78-
<label class="form-label">Email Address for Let's Encrypt <span class="form-required">*</span></label>
78+
<label class="form-label"><%- i18n('all-hosts', 'letsencrypt-email') %> <span class="form-required">*</span></label>
7979
<input name="meta[letsencrypt_email]" type="email" class="form-control" placeholder="" value="<%- getLetsencryptEmail() %>" required>
8080
</div>
8181
</div>
@@ -84,27 +84,27 @@
8484
<label class="custom-switch">
8585
<input type="checkbox" class="custom-switch-input" name="meta[letsencrypt_agree]" value="1" required<%- getLetsencryptAgree() ? ' checked' : '' %>>
8686
<span class="custom-switch-indicator"></span>
87-
<span class="custom-switch-description">I Agree to the <a href="https://letsencrypt.org/repository/" target="_blank">Let's Encrypt Terms of Service</a> <span class="form-required">*</span></span>
87+
<span class="custom-switch-description"><%= i18n('all-hosts', 'letsencrypt-agree', {url: 'https://letsencrypt.org/repository/'}) %> <span class="form-required">*</span></span>
8888
</label>
8989
</div>
9090
</div>
9191

9292
<!-- Other -->
9393
<div class="col-sm-12 col-md-12 other-ssl">
9494
<div class="form-group">
95-
<div class="form-label">Certificate</div>
95+
<div class="form-label"><%- i18n('all-hosts', 'other-certificate') %></div>
9696
<div class="custom-file">
9797
<input type="file" class="custom-file-input" name="meta[other_ssl_certificate]">
98-
<label class="custom-file-label">Choose file</label>
98+
<label class="custom-file-label"><%- i18n('str', 'choose-file') %></label>
9999
</div>
100100
</div>
101101
</div>
102102
<div class="col-sm-12 col-md-12 other-ssl">
103103
<div class="form-group">
104-
<div class="form-label">Certificate Key</div>
104+
<div class="form-label"><%- i18n('all-hosts', 'other-certificate-key') %></div>
105105
<div class="custom-file">
106106
<input type="file" class="custom-file-input" name="meta[other_ssl_certificate_key]">
107-
<label class="custom-file-label">Choose file</label>
107+
<label class="custom-file-label"><%- i18n('str', 'choose-file') %></label>
108108
</div>
109109
</div>
110110
</div>
@@ -116,7 +116,7 @@
116116
</form>
117117
</div>
118118
<div class="modal-footer">
119-
<button type="button" class="btn btn-secondary cancel" data-dismiss="modal">Cancel</button>
120-
<button type="button" class="btn btn-teal save">Save</button>
119+
<button type="button" class="btn btn-secondary cancel" data-dismiss="modal"><%- i18n('str', 'cancel') %></button>
120+
<button type="button" class="btn btn-teal save"><%- i18n('str', 'save') %></button>
121121
</div>
122122
</div>

src/frontend/js/app/nginx/proxy/form.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,9 @@
22

33
const _ = require('underscore');
44
const Mn = require('backbone.marionette');
5-
const template = require('./form.ejs');
6-
const Controller = require('../../controller');
7-
const Cache = require('../../cache');
8-
const Api = require('../../api');
95
const App = require('../../main');
106
const ProxyHostModel = require('../../../models/proxy-host');
7+
const template = require('./form.ejs');
118

129
require('jquery-serializejson');
1310
require('jquery-mask-plugin');
@@ -80,20 +77,20 @@ module.exports = Mn.View.extend({
8077

8178
// Process
8279
this.ui.buttons.prop('disabled', true).addClass('btn-disabled');
83-
let method = Api.Nginx.ProxyHosts.create;
80+
let method = App.Api.Nginx.ProxyHosts.create;
8481

8582
if (this.model.get('id')) {
8683
// edit
87-
method = Api.Nginx.ProxyHosts.update;
84+
method = App.Api.Nginx.ProxyHosts.update;
8885
data.id = this.model.get('id');
8986
}
9087

9188
method(data)
9289
.then(result => {
9390
view.model.set(result);
9491
App.UI.closeModal(function () {
95-
if (method === Api.Nginx.ProxyHosts.create) {
96-
Controller.showNginxProxy();
92+
if (method === App.Api.Nginx.ProxyHosts.create) {
93+
App.Controller.showNginxProxy();
9794
}
9895
});
9996
})
@@ -106,7 +103,7 @@ module.exports = Mn.View.extend({
106103

107104
templateContext: {
108105
getLetsencryptEmail: function () {
109-
return typeof this.meta.letsencrypt_email !== 'undefined' ? this.meta.letsencrypt_email : Cache.User.get('email');
106+
return typeof this.meta.letsencrypt_email !== 'undefined' ? this.meta.letsencrypt_email : App.Cache.User.get('email');
110107
},
111108

112109
getLetsencryptAgree: function () {

src/frontend/js/app/nginx/proxy/main.ejs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<div class="card">
22
<div class="card-status bg-success"></div>
33
<div class="card-header">
4-
<h3 class="card-title">Proxy Hosts</h3>
4+
<h3 class="card-title"><%- i18n('proxy-hosts', 'title') %></h3>
55
<div class="card-options">
66
<% if (showAddButton) { %>
7-
<a href="#" class="btn btn-outline-success btn-sm ml-2 add-item">Add Proxy Host</a>
7+
<a href="#" class="btn btn-outline-success btn-sm ml-2 add-item"><%- i18n('proxy-hosts', 'add') %></a>
88
<% } %>
99
</div>
1010
</div>

0 commit comments

Comments
 (0)