Skip to content

Commit

Permalink
Localisation of app name
Browse files Browse the repository at this point in the history
  • Loading branch information
alansemenov committed Feb 21, 2022
1 parent 1978735 commit 8cc7bc2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 7 additions & 2 deletions modules/app/src/main/resources/admin/tools/main/main.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
const admin = require('/lib/xp/admin');
const mustache = require('/lib/mustache');
const portal = require('/lib/xp/portal');
const i18n = require('/lib/xp/i18n');

exports.renderTemplate = function (path, params) {
const view = resolve('./main.html');
const toolUri = admin.getToolUrl(app.name,'main');
const toolUri = admin.getToolUrl(app.name, 'main');
const isBrowseMode = path === toolUri;
const baseSecurityPolicy = 'default-src \'self\'; script-src \'self\' \'unsafe-eval\'{0}; object-src \'none\'; style-src \'self\' \'unsafe-inline\'; img-src \'self\' data:';
const securityPolicy = baseSecurityPolicy.replace('{0}', isBrowseMode ? '' : ' \'unsafe-inline\'');
Expand All @@ -21,7 +22,11 @@ exports.renderTemplate = function (path, params) {
exports.getParams = function () {
return {
assetsUri: portal.assetUrl({path: ''}),
appName: 'Content Studio',
appName: i18n.localize({
key: 'admin.tool.displayName',
bundles: ['i18n/phrases'],
locale: admin.getLocales()
}),
launcherPath: admin.getLauncherPath(),
configServiceUrl: portal.serviceUrl({service: 'config'})
}
Expand Down
3 changes: 1 addition & 2 deletions modules/app/src/main/resources/assets/js/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import {AppHelper} from 'lib-admin-ui/util/AppHelper';
import {WindowDOM} from 'lib-admin-ui/dom/WindowDOM';
import {DefaultErrorHandler} from 'lib-admin-ui/DefaultErrorHandler';
import {PropertyChangedEvent} from 'lib-admin-ui/PropertyChangedEvent';
import {UriHelper} from 'lib-admin-ui/util/UriHelper';
import {ContentAppHelper} from 'lib-contentstudio/app/wizard/ContentAppHelper';
import {ProjectContext} from 'lib-contentstudio/app/project/ProjectContext';
import {AggregatedServerEventsListener} from 'lib-contentstudio/app/event/AggregatedServerEventsListener';
Expand Down Expand Up @@ -68,7 +67,7 @@ const body = Body.get();
function getApplication(): Application {
const application = new Application(
CONFIG.getString('appId'),
i18n('app.name'),
i18n('admin.tool.displayName'),
i18n('app.abbr')
);
application.setPath(processApplicationPath());
Expand Down

0 comments on commit 8cc7bc2

Please sign in to comment.