diff --git a/src/frontend/js/app/audit-log/list/main.ejs b/src/frontend/js/app/audit-log/list/main.ejs index 83afd4be..ce893413 100644 --- a/src/frontend/js/app/audit-log/list/main.ejs +++ b/src/frontend/js/app/audit-log/list/main.ejs @@ -1,10 +1,10 @@ -  -Name -Email -Roles -  +   + Name + Email + Roles +   - + diff --git a/src/frontend/js/app/audit-log/main.ejs b/src/frontend/js/app/audit-log/main.ejs index bb8b534d..b5440e61 100644 --- a/src/frontend/js/app/audit-log/main.ejs +++ b/src/frontend/js/app/audit-log/main.ejs @@ -1,6 +1,6 @@
-

Audit Log

+

<%- i18n('audit-log', 'title') %>

diff --git a/src/frontend/js/app/audit-log/main.js b/src/frontend/js/app/audit-log/main.js index 3ad81410..69a30a25 100644 --- a/src/frontend/js/app/audit-log/main.js +++ b/src/frontend/js/app/audit-log/main.js @@ -1,9 +1,8 @@ 'use strict'; const Mn = require('backbone.marionette'); +const App = require('../main'); const AuditLogModel = require('../../models/audit-log'); -const Api = require('../api'); -const Controller = require('../controller'); const ListView = require('./list/main'); const template = require('./main.ejs'); const ErrorView = require('../error/main'); @@ -25,7 +24,7 @@ module.exports = Mn.View.extend({ onRender: function () { let view = this; - Api.AuditLog.getAll() + App.Api.AuditLog.getAll() .then(response => { if (!view.isDestroyed() && response && response.length) { view.showChildView('list_region', new ListView({ @@ -33,8 +32,8 @@ module.exports = Mn.View.extend({ })); } else { view.showChildView('list_region', new EmptyView({ - title: 'There are no logs.', - subtitle: 'As soon as you or another user changes something, history of those events will show up here.' + title: App.i18n('audit-log', 'empty'), + subtitle: App.i18n('audit-log', 'empty-subtitle') })); } }) @@ -43,7 +42,7 @@ module.exports = Mn.View.extend({ code: err.code, message: err.message, retry: function () { - Controller.showAuditLog(); + App.Controller.showAuditLog(); } })); diff --git a/src/frontend/js/app/dashboard/main.ejs b/src/frontend/js/app/dashboard/main.ejs index 61bf7f5b..c00aa6d0 100644 --- a/src/frontend/js/app/dashboard/main.ejs +++ b/src/frontend/js/app/dashboard/main.ejs @@ -1,5 +1,5 @@ <% if (columns) { %> @@ -12,7 +12,7 @@
-

<%- getHostStat('proxy') %> Proxy Hosts

+

<%- getHostStat('proxy') %> <%- i18n('proxy-hosts', 'title') %>

@@ -27,7 +27,7 @@
-

<%- getHostStat('redirection') %> Redirection Hosts

+

<%- getHostStat('redirection') %> <%- i18n('redirection-hosts', 'title') %>

@@ -42,7 +42,7 @@
-

<%- getHostStat('stream') %> Streams

+

<%- getHostStat('stream') %> <%- i18n('streams', 'title') %>

@@ -57,7 +57,7 @@
-

<%- getHostStat('dead') %> 404 Hosts

+

<%- getHostStat('dead') %> <%- i18n('dead-hosts', 'title') %>

diff --git a/src/frontend/js/app/error/main.ejs b/src/frontend/js/app/error/main.ejs index 13e940fb..f7fd709b 100644 --- a/src/frontend/js/app/error/main.ejs +++ b/src/frontend/js/app/error/main.ejs @@ -3,5 +3,5 @@ <%- message %> <% if (retry) { %> -

Try again +

<%- i18n('str', 'try-again') %> <% } %> diff --git a/src/frontend/js/app/i18n.js b/src/frontend/js/app/i18n.js index f6ad7120..451f1968 100644 --- a/src/frontend/js/app/i18n.js +++ b/src/frontend/js/app/i18n.js @@ -21,5 +21,5 @@ module.exports = function (namespace, key, data) { return messages['en'][namespace][key](data); } - return 'INVALID I18N: ' + namespace + '/' + key; + return '(MISSING: ' + namespace + '/' + key + ')'; }; diff --git a/src/frontend/js/app/main.js b/src/frontend/js/app/main.js index 21cdbe34..85d69634 100644 --- a/src/frontend/js/app/main.js +++ b/src/frontend/js/app/main.js @@ -16,6 +16,7 @@ const App = Mn.Application.extend({ Cache: Cache, Api: Api, UI: null, + i18n: i18n, Controller: Controller, region: { diff --git a/src/frontend/js/app/nginx/proxy/form.ejs b/src/frontend/js/app/nginx/proxy/form.ejs index 59198adb..05a7fc25 100644 --- a/src/frontend/js/app/nginx/proxy/form.ejs +++ b/src/frontend/js/app/nginx/proxy/form.ejs @@ -1,13 +1,13 @@
- +
@@ -75,7 +75,7 @@
- +
@@ -84,7 +84,7 @@
@@ -92,19 +92,19 @@
-
Certificate
+
<%- i18n('all-hosts', 'other-certificate') %>
- +
-
Certificate Key
+
<%- i18n('all-hosts', 'other-certificate-key') %>
- +
@@ -116,7 +116,7 @@ diff --git a/src/frontend/js/app/nginx/proxy/form.js b/src/frontend/js/app/nginx/proxy/form.js index 92f56ea8..494caf9e 100644 --- a/src/frontend/js/app/nginx/proxy/form.js +++ b/src/frontend/js/app/nginx/proxy/form.js @@ -2,12 +2,9 @@ const _ = require('underscore'); const Mn = require('backbone.marionette'); -const template = require('./form.ejs'); -const Controller = require('../../controller'); -const Cache = require('../../cache'); -const Api = require('../../api'); const App = require('../../main'); const ProxyHostModel = require('../../../models/proxy-host'); +const template = require('./form.ejs'); require('jquery-serializejson'); require('jquery-mask-plugin'); @@ -80,11 +77,11 @@ module.exports = Mn.View.extend({ // Process this.ui.buttons.prop('disabled', true).addClass('btn-disabled'); - let method = Api.Nginx.ProxyHosts.create; + let method = App.Api.Nginx.ProxyHosts.create; if (this.model.get('id')) { // edit - method = Api.Nginx.ProxyHosts.update; + method = App.Api.Nginx.ProxyHosts.update; data.id = this.model.get('id'); } @@ -92,8 +89,8 @@ module.exports = Mn.View.extend({ .then(result => { view.model.set(result); App.UI.closeModal(function () { - if (method === Api.Nginx.ProxyHosts.create) { - Controller.showNginxProxy(); + if (method === App.Api.Nginx.ProxyHosts.create) { + App.Controller.showNginxProxy(); } }); }) @@ -106,7 +103,7 @@ module.exports = Mn.View.extend({ templateContext: { getLetsencryptEmail: function () { - return typeof this.meta.letsencrypt_email !== 'undefined' ? this.meta.letsencrypt_email : Cache.User.get('email'); + return typeof this.meta.letsencrypt_email !== 'undefined' ? this.meta.letsencrypt_email : App.Cache.User.get('email'); }, getLetsencryptAgree: function () { diff --git a/src/frontend/js/app/nginx/proxy/main.ejs b/src/frontend/js/app/nginx/proxy/main.ejs index 8b2ed9e7..999dc2d3 100644 --- a/src/frontend/js/app/nginx/proxy/main.ejs +++ b/src/frontend/js/app/nginx/proxy/main.ejs @@ -1,10 +1,10 @@
-

Proxy Hosts

+

<%- i18n('proxy-hosts', 'title') %>

<% if (showAddButton) { %> - Add Proxy Host + <%- i18n('proxy-hosts', 'add') %> <% } %>
diff --git a/src/frontend/js/app/nginx/proxy/main.js b/src/frontend/js/app/nginx/proxy/main.js index 1ba3c309..940b0ab4 100644 --- a/src/frontend/js/app/nginx/proxy/main.js +++ b/src/frontend/js/app/nginx/proxy/main.js @@ -1,14 +1,12 @@ 'use strict'; const Mn = require('backbone.marionette'); +const App = require('../../main'); const ProxyHostModel = require('../../../models/proxy-host'); -const Api = require('../../api'); -const Cache = require('../../cache'); -const Controller = require('../../controller'); const ListView = require('./list/main'); const ErrorView = require('../../error/main'); -const template = require('./main.ejs'); const EmptyView = require('../../empty/main'); +const template = require('./main.ejs'); module.exports = Mn.View.extend({ id: 'nginx-proxy', @@ -27,18 +25,18 @@ module.exports = Mn.View.extend({ events: { 'click @ui.add': function (e) { e.preventDefault(); - Controller.showNginxProxyForm(); + App.Controller.showNginxProxyForm(); } }, templateContext: { - showAddButton: Cache.User.canManage('proxy_hosts') + showAddButton: App.Cache.User.canManage('proxy_hosts') }, onRender: function () { let view = this; - Api.Nginx.ProxyHosts.getAll(['owner', 'access_list']) + App.Api.Nginx.ProxyHosts.getAll(['owner', 'access_list']) .then(response => { if (!view.isDestroyed()) { if (response && response.length) { @@ -46,16 +44,16 @@ module.exports = Mn.View.extend({ collection: new ProxyHostModel.Collection(response) })); } else { - let manage = Cache.User.canManage('proxy_hosts'); + let manage = App.Cache.User.canManage('proxy_hosts'); view.showChildView('list_region', new EmptyView({ - title: 'There are no Proxy Hosts', - subtitle: manage ? 'Why don\'t you create one?' : 'And you don\'t have permission to create one.', - link: manage ? 'Add Proxy Host' : null, + title: App.i18n('proxy-hosts', 'empty'), + subtitle: App.i18n('all-hosts', 'empty-subtitle', {manage: manage}), + link: manage ? App.i18n('proxy-hosts', 'add') : null, btn_color: 'success', permission: 'proxy_hosts', action: function () { - Controller.showNginxProxyForm(); + App.Controller.showNginxProxyForm(); } })); } @@ -66,7 +64,7 @@ module.exports = Mn.View.extend({ code: err.code, message: err.message, retry: function () { - Controller.showNginxProxy(); + App.Controller.showNginxProxy(); } })); diff --git a/src/frontend/js/app/ui/footer/main.ejs b/src/frontend/js/app/ui/footer/main.ejs index e7d0a28c..562e71c2 100644 --- a/src/frontend/js/app/ui/footer/main.ejs +++ b/src/frontend/js/app/ui/footer/main.ejs @@ -9,7 +9,7 @@
- <%- i18n('footer', 'version', {version: getVersion()}) %> + <%- i18n('main', 'version', {version: getVersion()}) %> <%= i18n('footer', 'copy', {url: 'https://jc21.com?utm_source=nginx-proxy-manager'}) %> <%= i18n('footer', 'theme', {url: 'https://tabler.github.io/?utm_source=nginx-proxy-manager'}) %>
diff --git a/src/frontend/js/app/ui/header/main.ejs b/src/frontend/js/app/ui/header/main.ejs index 28fa8dba..92eae4cd 100644 --- a/src/frontend/js/app/ui/header/main.ejs +++ b/src/frontend/js/app/ui/header/main.ejs @@ -15,10 +15,10 @@