From f4c7830570b522ad83ec9168cf12755e58192d26 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Wed, 6 Jan 2016 16:14:25 +0100 Subject: [PATCH] rewrite translation module --- .../js/apps/account/change-password-view.js | 3 +- .../main/js/apps/background-tasks/header.js | 5 +- .../main/js/apps/background-tasks/search.js | 21 ++-- .../main/js/apps/background-tasks/stats.js | 13 ++- .../main/js/apps/background-tasks/tasks.js | 21 ++-- .../src/main/js/apps/code/actions/index.js | 9 +- .../src/main/js/apps/code/components/Code.js | 3 +- .../apps/code/components/ComponentDetach.js | 3 +- .../js/apps/code/components/Components.js | 11 +- .../apps/code/components/ComponentsEmpty.js | 3 +- .../src/main/js/apps/coding-rules/app.js | 3 +- .../coding-rules/bulk-change-modal-view.js | 7 +- .../facets/active-severity-facet.js | 3 +- .../facets/custom-values-facet.js | 9 +- .../coding-rules/facets/inheritance-facet.js | 5 +- .../apps/coding-rules/facets/status-facet.js | 3 +- .../js/apps/coding-rules/rule-details-view.js | 5 +- .../rule/custom-rule-creation-view.js | 5 +- .../coding-rules/rule/custom-rule-view.js | 5 +- .../rule/manual-rule-creation-view.js | 3 +- .../rule/rule-description-view.js | 3 +- .../coding-rules/rule/rule-profile-view.js | 9 +- .../coding-rules/workspace-list-empty-view.js | 3 +- .../coding-rules/workspace-list-item-view.js | 5 +- .../main/js/apps/global-permissions/main.js | 5 +- .../js/apps/issues/facets/author-facet.js | 7 +- .../apps/issues/facets/custom-values-facet.js | 7 +- .../js/apps/issues/facets/language-facet.js | 7 +- .../js/apps/issues/facets/project-facet.js | 7 +- .../main/js/apps/issues/facets/rule-facet.js | 9 +- .../main/js/apps/issues/facets/tag-facet.js | 5 +- .../apps/issues/workspace-list-empty-view.js | 3 +- .../components/complexity-distribution.js | 3 +- .../overview/components/coverage-measures.js | 5 +- .../components/domain-bubble-chart.js | 8 +- .../overview/components/domain-timeline.js | 3 +- .../overview/components/domain-treemap.js | 7 +- .../main/js/apps/overview/components/event.js | 3 +- .../overview/components/events-list-filter.js | 3 +- .../apps/overview/components/events-list.js | 7 +- .../apps/overview/components/issue-measure.js | 11 +- .../components/language-distribution.js | 3 +- .../overview/components/ncloc-distribution.js | 5 +- .../apps/overview/domains/coverage-domain.js | 5 +- .../js/apps/overview/domains/debt-domain.js | 5 +- .../overview/domains/duplications-domain.js | 5 +- .../apps/overview/domains/structure-domain.js | 3 +- .../js/apps/overview/gate/gate-condition.js | 5 +- .../main/js/apps/overview/gate/gate-empty.js | 3 +- .../src/main/js/apps/overview/gate/gate.js | 11 +- .../main/js/apps/overview/helpers/metrics.js | 4 +- .../main/js/apps/overview/helpers/periods.js | 5 +- .../main/js/apps/overview/main/components.js | 17 ++- .../main/js/apps/overview/main/coverage.js | 3 +- .../src/main/js/apps/overview/main/debt.js | 3 +- .../js/apps/overview/main/duplications.js | 3 +- .../main/js/apps/overview/main/structure.js | 3 +- .../src/main/js/apps/overview/meta.js | 5 +- .../src/main/js/apps/overview/overview.js | 3 +- .../js/apps/permission-templates/header.js | 5 +- .../permission-template-defaults.js | 3 +- .../permission-template-set-defaults.js | 3 +- .../main/js/apps/project-permissions/main.js | 5 +- .../project-permissions/qualifier-filter.js | 3 +- .../src/main/js/apps/projects/search.js | 5 +- .../apps/quality-gates/gate-condition-view.js | 3 +- .../quality-gates/gate-conditions-view.js | 3 +- .../apps/quality-gates/gate-projects-view.js | 13 ++- .../quality-profiles/profile-details-view.js | 13 ++- .../src/main/js/apps/system/item-log-level.js | 3 +- .../sonar-web/src/main/js/apps/system/main.js | 3 +- .../src/main/js/components/charts/treemap.js | 3 +- .../main/js/components/common/select-list.js | 3 +- .../issue/views/assign-form-view.js | 3 +- .../components/issue/views/plan-form-view.js | 3 +- .../navigator/filters/choice-filters.js | 3 +- .../js/components/shared/assignee-helper.js | 3 +- .../main/js/components/shared/list-footer.js | 3 +- .../js/components/shared/severity-helper.js | 3 +- .../js/components/shared/status-helper.js | 5 +- .../main/js/components/source-viewer/main.js | 3 +- .../main/js/helpers/handlebars/changelog.js | 10 +- .../js/helpers/handlebars/dashboardL10n.js | 4 +- .../helpers/handlebars/parameterChangelog.js | 5 +- .../helpers/handlebars/severityChangelog.js | 5 +- .../js/helpers/handlebars/severityHelper.js | 3 +- .../js/helpers/handlebars/statusHelper.js | 5 +- server/sonar-web/src/main/js/helpers/l10n.js | 71 +++++++++++- .../sonar-web/src/main/js/helpers/measures.js | 21 ++-- server/sonar-web/src/main/js/libs/sonar.js | 1 - .../sonar-web/src/main/js/libs/translate.js | 106 ------------------ server/sonar-web/src/main/js/main/app.js | 4 +- .../main/nav/component/component-nav-menu.js | 38 +++---- .../main/nav/component/component-nav-meta.js | 19 ++-- .../main/js/main/nav/dashboard-name-mixin.js | 4 +- .../js/main/nav/global/global-nav-branding.js | 3 +- .../js/main/nav/global/global-nav-menu.js | 21 ++-- .../js/main/nav/global/global-nav-user.js | 7 +- .../main/js/main/nav/global/search-view.js | 27 ++--- .../main/js/main/nav/settings/settings-nav.js | 31 ++--- .../sonar-web/src/main/js/main/processes.js | 3 +- .../src/main/js/widgets/old/tag-cloud.js | 4 +- .../src/main/js/widgets/old/treemap.js | 3 +- 103 files changed, 458 insertions(+), 382 deletions(-) delete mode 100644 server/sonar-web/src/main/js/libs/translate.js diff --git a/server/sonar-web/src/main/js/apps/account/change-password-view.js b/server/sonar-web/src/main/js/apps/account/change-password-view.js index f2cca1e60da..289c9e7ac7c 100644 --- a/server/sonar-web/src/main/js/apps/account/change-password-view.js +++ b/server/sonar-web/src/main/js/apps/account/change-password-view.js @@ -20,6 +20,7 @@ import $ from 'jquery'; import ModalForm from '../../components/common/modal-form'; import Template from './templates/account-change-password.hbs'; +import { translate } from '../../helpers/l10n'; export default ModalForm.extend({ template: Template, @@ -29,7 +30,7 @@ export default ModalForm.extend({ if (this.checkPasswords()) { this.sendRequest(); } else { - this.showErrors([{ msg: window.t('user.password_doesnt_match_confirmation') }]); + this.showErrors([{ msg: translate('user.password_doesnt_match_confirmation') }]); } }, diff --git a/server/sonar-web/src/main/js/apps/background-tasks/header.js b/server/sonar-web/src/main/js/apps/background-tasks/header.js index 2884f9e75fe..ebba7aa2dcf 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/header.js +++ b/server/sonar-web/src/main/js/apps/background-tasks/header.js @@ -18,13 +18,14 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import React from 'react'; +import { translate } from '../../helpers/l10n'; export default React.createClass({ render() { return (
-

{window.t('background_tasks.page')}

-

{window.t('background_tasks.page.description')}

+

{translate('background_tasks.page')}

+

{translate('background_tasks.page.description')}

); } diff --git a/server/sonar-web/src/main/js/apps/background-tasks/search.js b/server/sonar-web/src/main/js/apps/background-tasks/search.js index 1c2c3b50147..30cea9ad1e2 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/search.js +++ b/server/sonar-web/src/main/js/apps/background-tasks/search.js @@ -22,6 +22,7 @@ import moment from 'moment'; import React from 'react'; import RadioToggle from '../../components/shared/radio-toggle'; import { STATUSES, CURRENTS, DATE, DATE_FORMAT } from './constants'; +import { translate } from '../../helpers/l10n'; export default React.createClass({ componentDidMount() { @@ -34,25 +35,25 @@ export default React.createClass({ getCurrentsOptions() { return [ - { value: CURRENTS.ALL, label: window.t('background_tasks.currents_filter.ALL') }, - { value: CURRENTS.ONLY_CURRENTS, label: window.t('background_tasks.currents_filter.ONLY_CURRENTS') } + { value: CURRENTS.ALL, label: translate('background_tasks.currents_filter.ALL') }, + { value: CURRENTS.ONLY_CURRENTS, label: translate('background_tasks.currents_filter.ONLY_CURRENTS') } ]; }, getStatusOptions() { return [ - { value: STATUSES.ALL, label: window.t('background_task.status.ALL') }, - { value: STATUSES.SUCCESS, label: window.t('background_task.status.SUCCESS') }, - { value: STATUSES.FAILED, label: window.t('background_task.status.FAILED') }, - { value: STATUSES.CANCELED, label: window.t('background_task.status.CANCELED') } + { value: STATUSES.ALL, label: translate('background_task.status.ALL') }, + { value: STATUSES.SUCCESS, label: translate('background_task.status.SUCCESS') }, + { value: STATUSES.FAILED, label: translate('background_task.status.FAILED') }, + { value: STATUSES.CANCELED, label: translate('background_task.status.CANCELED') } ]; }, getDateOptions() { return [ - { value: DATE.ANY, label: window.t('background_tasks.date_filter.ALL') }, - { value: DATE.TODAY, label: window.t('background_tasks.date_filter.TODAY') }, - { value: DATE.CUSTOM, label: window.t('background_tasks.date_filter.CUSTOM') } + { value: DATE.ANY, label: translate('background_tasks.date_filter.ALL') }, + { value: DATE.TODAY, label: translate('background_tasks.date_filter.TODAY') }, + { value: DATE.CUSTOM, label: translate('background_tasks.date_filter.CUSTOM') } ]; }, @@ -158,7 +159,7 @@ export default React.createClass({
  • {this.renderSearchBox()}
  • - +
  • diff --git a/server/sonar-web/src/main/js/apps/background-tasks/stats.js b/server/sonar-web/src/main/js/apps/background-tasks/stats.js index 51410d559af..dc5b447f291 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/stats.js +++ b/server/sonar-web/src/main/js/apps/background-tasks/stats.js @@ -21,6 +21,7 @@ import React from 'react'; import { formatDuration } from './helpers'; import { TooltipsMixin } from '../../components/mixins/tooltips-mixin'; +import { translate } from '../../helpers/l10n'; export default React.createClass({ @@ -41,7 +42,7 @@ export default React.createClass({ return null; } return ( - @@ -60,9 +61,9 @@ export default React.createClass({ {this.props.pendingCount}   - {window.t('background_tasks.pending')} + {translate('background_tasks.pending')} + title={translate('background_tasks.cancel_all_tasks')} data-toggle="tooltip" href="#"> ); } else { @@ -70,7 +71,7 @@ export default React.createClass({ {this.props.pendingCount}   - {window.t('background_tasks.pending')} + {translate('background_tasks.pending')} ); } @@ -95,7 +96,7 @@ export default React.createClass({ title="Count of projects where processing of most recent analysis report failed" href="#">{this.props.failuresCount}   - {window.t('background_tasks.failures')} + {translate('background_tasks.failures')} ); } else { @@ -106,7 +107,7 @@ export default React.createClass({ {this.props.failuresCount}   - {window.t('background_tasks.failures')} + {translate('background_tasks.failures')} ); } diff --git a/server/sonar-web/src/main/js/apps/background-tasks/tasks.js b/server/sonar-web/src/main/js/apps/background-tasks/tasks.js index 064b0a92d23..f93c7f0033c 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/tasks.js +++ b/server/sonar-web/src/main/js/apps/background-tasks/tasks.js @@ -26,6 +26,7 @@ import PendingIcon from '../../components/shared/pending-icon'; import { STATUSES } from './constants'; import { formatDuration } from './helpers'; import { TooltipsMixin } from '../../components/mixins/tooltips-mixin'; +import { translate } from '../../helpers/l10n'; export default React.createClass({ @@ -55,18 +56,18 @@ export default React.createClass({ inner = ; break; case STATUSES.SUCCESS: - inner = {window.t('background_task.status.SUCCESS')}; + inner = {translate('background_task.status.SUCCESS')}; break; case STATUSES.FAILED: - inner = {window.t('background_task.status.FAILED')}; + inner = {translate('background_task.status.FAILED')}; break; case STATUSES.CANCELED: - inner = {window.t('background_task.status.CANCELED')}; + inner = {translate('background_task.status.CANCELED')}; break; default: inner = ''; } - return {inner}; }, @@ -125,7 +126,7 @@ export default React.createClass({ if (task.status === STATUSES.PENDING) { return ( + title={translate('background_tasks.cancel_task')} data-toggle="tooltip" href="#"> ); } else { return null; @@ -135,7 +136,7 @@ export default React.createClass({ renderLogsLink(task) { if (task.logs) { let url = `${window.baseUrl}/api/ce/logs?taskId=${task.id}`; - return {window.t('background_tasks.logs')}; + return {translate('background_tasks.logs')}; } else { return null; } @@ -173,10 +174,10 @@ export default React.createClass({       - {window.t('background_tasks.table.submitted')} - {window.t('background_tasks.table.started')} - {window.t('background_tasks.table.finished')} - {window.t('background_tasks.table.duration')} + {translate('background_tasks.table.submitted')} + {translate('background_tasks.table.started')} + {translate('background_tasks.table.finished')} + {translate('background_tasks.table.duration')}   diff --git a/server/sonar-web/src/main/js/apps/code/actions/index.js b/server/sonar-web/src/main/js/apps/code/actions/index.js index bfd5216f91b..d9edf8eca7b 100644 --- a/server/sonar-web/src/main/js/apps/code/actions/index.js +++ b/server/sonar-web/src/main/js/apps/code/actions/index.js @@ -22,6 +22,7 @@ import { pushPath } from 'redux-simple-router'; import { getChildren, getComponent, getTree } from '../../../api/components'; import { getComponentNavigation } from '../../../api/nav'; +import { translate } from '../../../helpers/l10n'; const METRICS = [ @@ -137,15 +138,15 @@ requestTree = _.debounce(requestTree, 250); async function getErrorMessage (response) { switch (response.status) { case 401: - return window.t('not_authorized'); + return translate('not_authorized'); default: try { let json = await response.json(); return json['err_msg'] || (json.errors && _.pluck(json.errors, 'msg').join('. ')) || - window.t('default_error_message'); + translate('default_error_message'); } catch (e) { - return window.t('default_error_message'); + return translate('default_error_message'); } } } @@ -186,5 +187,3 @@ export function search (query, baseComponent) { } }; } - - diff --git a/server/sonar-web/src/main/js/apps/code/components/Code.js b/server/sonar-web/src/main/js/apps/code/components/Code.js index 81f63740de2..9a2dc252558 100644 --- a/server/sonar-web/src/main/js/apps/code/components/Code.js +++ b/server/sonar-web/src/main/js/apps/code/components/Code.js @@ -26,6 +26,7 @@ import Breadcrumbs from './Breadcrumbs'; import SourceViewer from './SourceViewer'; import Search from './Search'; import { initComponent, browse } from '../actions'; +import { translate } from '../../../helpers/l10n'; class Code extends Component { @@ -71,7 +72,7 @@ class Code extends Component { return (
    -

    {window.t('code.page')}

    +

    {translate('code.page')}

    ( ); diff --git a/server/sonar-web/src/main/js/apps/code/components/Components.js b/server/sonar-web/src/main/js/apps/code/components/Components.js index 2ed8fb607e6..e86d1bf4b8b 100644 --- a/server/sonar-web/src/main/js/apps/code/components/Components.js +++ b/server/sonar-web/src/main/js/apps/code/components/Components.js @@ -21,6 +21,7 @@ import React from 'react'; import Component from './Component'; import ComponentsEmpty from './ComponentsEmpty'; +import { translate } from '../../../helpers/l10n'; const Components = ({ baseComponent, components, coverageMetric, onBrowse }) => ( @@ -29,11 +30,11 @@ const Components = ({ baseComponent, components, coverageMetric, onBrowse }) =>     - {window.t('metric.ncloc.name')} - {window.t('metric.sqale_index.short_name')} - {window.t('metric.violations.name')} - {window.t('metric.coverage.name')} - {window.t('metric.duplicated_lines_density.short_name')} + {translate('metric.ncloc.name')} + {translate('metric.sqale_index.short_name')} + {translate('metric.violations.name')} + {translate('metric.coverage.name')} + {translate('metric.duplicated_lines_density.short_name')} {baseComponent && ( diff --git a/server/sonar-web/src/main/js/apps/code/components/ComponentsEmpty.js b/server/sonar-web/src/main/js/apps/code/components/ComponentsEmpty.js index f792add07ec..f6a5aa577a2 100644 --- a/server/sonar-web/src/main/js/apps/code/components/ComponentsEmpty.js +++ b/server/sonar-web/src/main/js/apps/code/components/ComponentsEmpty.js @@ -18,12 +18,13 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import React from 'react'; +import { translate } from '../../../helpers/l10n'; const ComponentsEmpty = () => ( - {window.t('no_results')} + {translate('no_results')}   diff --git a/server/sonar-web/src/main/js/apps/coding-rules/app.js b/server/sonar-web/src/main/js/apps/coding-rules/app.js index 80fe331f8d0..6e94452f88e 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/app.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/app.js @@ -31,6 +31,7 @@ import WorkspaceListView from './workspace-list-view'; import WorkspaceHeaderView from './workspace-header-view'; import FacetsView from './facets-view'; import FiltersView from './filters-view'; +import { translate } from '../../helpers/l10n'; var App = new Marionette.Application(), init = function () { @@ -80,7 +81,7 @@ var App = new Marionette.Application(), App.manualRepository = function () { return { key: 'manual', - name: window.t('coding_rules.manual_rule'), + name: translate('coding_rules.manual_rule'), language: 'none' }; }; diff --git a/server/sonar-web/src/main/js/apps/coding-rules/bulk-change-modal-view.js b/server/sonar-web/src/main/js/apps/coding-rules/bulk-change-modal-view.js index 68f32a1d2e1..893e7d44561 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/bulk-change-modal-view.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/bulk-change-modal-view.js @@ -21,6 +21,7 @@ import $ from 'jquery'; import _ from 'underscore'; import ModalFormView from '../../components/common/modal-form'; import Template from './templates/coding-rules-bulk-change-modal.hbs'; +import { translateWithParameters } from '../../helpers/l10n'; export default ModalFormView.extend({ template: Template, @@ -34,14 +35,16 @@ export default ModalFormView.extend({ showSuccessMessage: function (profile, succeeded) { var profileBase = _.findWhere(this.options.app.qualityProfiles, { key: profile }), profileName = profileBase != null ? profileBase.name : profile, - message = window.tp('coding_rules.bulk_change.success', profileName, profileBase.language, succeeded); + message = translateWithParameters('coding_rules.bulk_change.success', + profileName, profileBase.language, succeeded); this.ui.messagesContainer.append('
    ' + message + '
    '); }, showWarnMessage: function (profile, succeeded, failed) { var profileBase = _.findWhere(this.options.app.qualityProfiles, { key: profile }), profileName = profileBase != null ? profileBase.name : profile, - message = window.tp('coding_rules.bulk_change.warning', profileName, profileBase.language, succeeded, failed); + message = translateWithParameters('coding_rules.bulk_change.warning', + profileName, profileBase.language, succeeded, failed); this.ui.messagesContainer.append('
    ' + message + '
    '); }, diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/active-severity-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/active-severity-facet.js index 855b1004c6d..99957a26d38 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/facets/active-severity-facet.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/active-severity-facet.js @@ -20,6 +20,7 @@ import _ from 'underscore'; import BaseFacet from './base-facet'; import Template from '../templates/facets/coding-rules-severity-facet.hbs'; +import { translate } from '../../../helpers/l10n'; export default BaseFacet.extend({ template: Template, @@ -45,7 +46,7 @@ export default BaseFacet.extend({ forbid: function () { BaseFacet.prototype.forbid.apply(this, arguments); - this.$el.prop('title', window.t('coding_rules.filters.active_severity.inactive')); + this.$el.prop('title', translate('coding_rules.filters.active_severity.inactive')); }, allow: function () { diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/custom-values-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/custom-values-facet.js index 56ff71d1154..4ddbf74a624 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/facets/custom-values-facet.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/custom-values-facet.js @@ -20,6 +20,7 @@ import _ from 'underscore'; import BaseFacet from './base-facet'; import Template from '../templates/facets/coding-rules-custom-values-facet.hbs'; +import { translate, translateWithParameters } from '../../../helpers/l10n'; export default BaseFacet.extend({ template: Template, @@ -41,17 +42,17 @@ export default BaseFacet.extend({ prepareSearch: function () { this.$('.js-custom-value').select2({ - placeholder: window.t('search_verb'), + placeholder: translate('search_verb'), minimumInputLength: 1, allowClear: false, formatNoMatches: function () { - return window.t('select2.noMatches'); + return translate('select2.noMatches'); }, formatSearching: function () { - return window.t('select2.searching'); + return translate('select2.searching'); }, formatInputTooShort: function () { - return window.tp('select2.tooShort', 1); + return translateWithParameters('select2.tooShort', 1); }, width: '100%', ajax: this.prepareAjaxSearch() diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/inheritance-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/inheritance-facet.js index 51926808077..ba48902164b 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/facets/inheritance-facet.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/inheritance-facet.js @@ -21,6 +21,7 @@ import $ from 'jquery'; import _ from 'underscore'; import BaseFacet from './base-facet'; import Template from '../templates/facets/coding-rules-inheritance-facet.hbs'; +import { translate } from '../../../helpers/l10n'; export default BaseFacet.extend({ template: Template, @@ -49,7 +50,7 @@ export default BaseFacet.extend({ forbid: function () { BaseFacet.prototype.forbid.apply(this, arguments); - this.$el.prop('title', window.t('coding_rules.filters.inheritance.inactive')); + this.$el.prop('title', translate('coding_rules.filters.inheritance.inactive')); }, allow: function () { @@ -61,7 +62,7 @@ export default BaseFacet.extend({ var values = ['NONE', 'INHERITED', 'OVERRIDES']; return values.map(function (key) { return { - label: window.t('coding_rules.filters.inheritance', key.toLowerCase()), + label: translate('coding_rules.filters.inheritance', key.toLowerCase()), val: key }; }); diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/status-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/status-facet.js index 03f833d2a51..43895033e86 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/facets/status-facet.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/status-facet.js @@ -19,6 +19,7 @@ */ import _ from 'underscore'; import BaseFacet from './base-facet'; +import { translate } from '../../../helpers/l10n'; export default BaseFacet.extend({ statuses: ['READY', 'DEPRECATED', 'BETA'], @@ -26,7 +27,7 @@ export default BaseFacet.extend({ getValues: function () { var values = this.model.getValues(); var x = values.map(function (value) { - return _.extend(value, { label: window.t('rules.status', value.val.toLowerCase()) }); + return _.extend(value, { label: translate('rules.status', value.val.toLowerCase()) }); }); return x; }, diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule-details-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule-details-view.js index c44456d9c13..8cff115d460 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/rule-details-view.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/rule-details-view.js @@ -32,6 +32,7 @@ import CustomRuleCreationView from './rule/custom-rule-creation-view'; import IssuesView from './rule/rule-issues-view'; import Template from './templates/coding-rules-rule-details.hbs'; import confirmDialog from './confirm-dialog'; +import { translate, translateWithParameters } from '../../helpers/l10n'; export default Marionette.LayoutView.extend({ className: 'coding-rule-details', @@ -149,8 +150,8 @@ export default Marionette.LayoutView.extend({ var that = this, ruleType = this.model.has('templateKey') ? 'custom' : 'manual'; confirmDialog({ - title: window.t('delete'), - html: window.tp('coding_rules.delete.' + ruleType + '.confirm', this.model.get('name')), + title: translate('delete'), + html: translateWithParameters('coding_rules.delete.' + ruleType + '.confirm', this.model.get('name')), yesHandler: function () { var url = baseUrl + '/api/rules/delete', options = { key: that.model.id }; diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-creation-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-creation-view.js index 5f4cbc72378..2d89ec9d009 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-creation-view.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-creation-view.js @@ -23,6 +23,7 @@ import ModalFormView from '../../../components/common/modal-form'; import Template from '../templates/rule/coding-rules-custom-rule-creation.hbs'; import { csvEscape } from '../../../helpers/csv'; import latinize from '../../../helpers/latinize'; +import { translate } from '../../../helpers/l10n'; export default ModalFormView.extend({ template: Template, @@ -172,7 +173,7 @@ export default ModalFormView.extend({ }).fail(function (jqXHR) { if (jqXHR.status === 409) { that.existingRule = jqXHR.responseJSON.rule; - that.showErrors([], [{ msg: window.t('coding_rules.reactivate.help') }]); + that.showErrors([], [{ msg: translate('coding_rules.reactivate.help') }]); that.ui.customRuleCreationCreate.addClass('hidden'); that.ui.customRuleCreationReactivate.removeClass('hidden'); } else { @@ -194,7 +195,7 @@ export default ModalFormView.extend({ var statuses = ['READY', 'BETA', 'DEPRECATED'].map(function (status) { return { id: status, - text: window.t('rules.status', status.toLowerCase()) + text: translate('rules.status', status.toLowerCase()) }; }); diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-view.js index 6a0875adee6..f254c02c1b9 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-view.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-view.js @@ -22,6 +22,7 @@ import _ from 'underscore'; import Marionette from 'backbone.marionette'; import Template from '../templates/rule/coding-rules-custom-rule.hbs'; import confirmDialog from '../confirm-dialog'; +import { translate } from '../../../helpers/l10n'; export default Marionette.ItemView.extend({ tagName: 'tr', @@ -38,8 +39,8 @@ export default Marionette.ItemView.extend({ deleteRule: function () { var that = this; confirmDialog({ - title: window.t('delete'), - html: window.t('are_you_sure'), + title: translate('delete'), + html: translate('are_you_sure'), yesHandler: function () { var url = baseUrl + '/api/rules/delete', options = { key: that.model.id }; diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/manual-rule-creation-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/manual-rule-creation-view.js index 3459339051f..8f177728063 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/rule/manual-rule-creation-view.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/manual-rule-creation-view.js @@ -22,6 +22,7 @@ import _ from 'underscore'; import ModalFormView from '../../../components/common/modal-form'; import Template from '../templates/rule/coding-rules-manual-rule-creation.hbs'; import latinize from '../../../helpers/latinize'; +import { translate } from '../../../helpers/l10n'; export default ModalFormView.extend({ template: Template, @@ -118,7 +119,7 @@ export default ModalFormView.extend({ }).fail(function (jqXHR) { if (jqXHR.status === 409) { that.existingRule = jqXHR.responseJSON.rule; - that.showErrors([], [{ msg: window.t('coding_rules.reactivate.help') }]); + that.showErrors([], [{ msg: translate('coding_rules.reactivate.help') }]); that.ui.manualRuleCreationCreate.addClass('hidden'); that.ui.manualRuleCreationReactivate.removeClass('hidden'); } else { diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-description-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-description-view.js index 0d6570dd997..91f93acb4e5 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-description-view.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-description-view.js @@ -22,6 +22,7 @@ import _ from 'underscore'; import Marionette from 'backbone.marionette'; import Template from '../templates/rule/coding-rules-rule-description.hbs'; import confirmDialog from '../confirm-dialog'; +import { translate } from '../../../helpers/l10n'; export default Marionette.ItemView.extend({ template: Template, @@ -83,7 +84,7 @@ export default Marionette.ItemView.extend({ removeExtendedDescription: function () { var that = this; confirmDialog({ - html: window.t('coding_rules.remove_extended_description.confirm'), + html: translate('coding_rules.remove_extended_description.confirm'), yesHandler: function () { that.ui.extendDescriptionText.val(''); that.submitExtendDescription(); diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profile-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profile-view.js index 262569496a0..98fabf7f8d4 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profile-view.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profile-view.js @@ -24,6 +24,7 @@ import Marionette from 'backbone.marionette'; import ProfileActivationView from './profile-activation-view'; import Template from '../templates/rule/coding-rules-rule-profile.hbs'; import confirmDialog from '../confirm-dialog'; +import { translate, translateWithParameters } from '../../../helpers/l10n'; export default Marionette.ItemView.extend({ tagName: 'tr', @@ -69,8 +70,8 @@ export default Marionette.ItemView.extend({ var that = this, ruleKey = this.options.rule.get('key'); confirmDialog({ - title: window.t('coding_rules.revert_to_parent_definition'), - html: window.tp('coding_rules.revert_to_parent_definition.confirm', this.getParent().name), + title: translate('coding_rules.revert_to_parent_definition'), + html: translateWithParameters('coding_rules.revert_to_parent_definition.confirm', this.getParent().name), yesHandler: function () { return $.ajax({ type: 'POST', @@ -91,8 +92,8 @@ export default Marionette.ItemView.extend({ var that = this, ruleKey = this.options.rule.get('key'); confirmDialog({ - title: window.t('coding_rules.deactivate'), - html: window.tp('coding_rules.deactivate.confirm'), + title: translate('coding_rules.deactivate'), + html: translateWithParameters('coding_rules.deactivate.confirm'), yesHandler: function () { return $.ajax({ type: 'POST', diff --git a/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-empty-view.js b/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-empty-view.js index 20bcfea8d78..f9c33a1ae3b 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-empty-view.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-empty-view.js @@ -18,11 +18,12 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import Marionette from 'backbone.marionette'; +import { translate } from '../../helpers/l10n'; export default Marionette.ItemView.extend({ className: 'search-navigator-no-results', template: function () { - return window.t('coding_rules.no_results'); + return translate('coding_rules.no_results'); } }); diff --git a/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-item-view.js b/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-item-view.js index e866ee50cf5..3d9d7b6f08b 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-item-view.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-item-view.js @@ -25,6 +25,7 @@ import ProfileActivationView from './rule/profile-activation-view'; import RuleFilterMixin from './rule/rule-filter-mixin'; import Template from './templates/coding-rules-workspace-list-item.hbs'; import confirmDialog from './confirm-dialog'; +import { translate, translateWithParameters } from '../../helpers/l10n'; export default WorkspaceListItemView.extend(RuleFilterMixin).extend({ className: 'coding-rule', @@ -81,8 +82,8 @@ export default WorkspaceListItemView.extend(RuleFilterMixin).extend({ ruleKey = this.model.get('key'), activation = this.model.get('activation'); confirmDialog({ - title: window.t('coding_rules.deactivate'), - html: window.tp('coding_rules.deactivate.confirm'), + title: translate('coding_rules.deactivate'), + html: translateWithParameters('coding_rules.deactivate.confirm'), yesHandler: function () { return $.ajax({ type: 'POST', diff --git a/server/sonar-web/src/main/js/apps/global-permissions/main.js b/server/sonar-web/src/main/js/apps/global-permissions/main.js index 361a3aab7e4..ea6fdb805c6 100644 --- a/server/sonar-web/src/main/js/apps/global-permissions/main.js +++ b/server/sonar-web/src/main/js/apps/global-permissions/main.js @@ -20,6 +20,7 @@ import $ from 'jquery'; import React from 'react'; import PermissionsList from './permissions-list'; +import { translate } from '../../helpers/l10n'; export default React.createClass({ getInitialState() { @@ -48,9 +49,9 @@ export default React.createClass({ return (
    -

    {window.t('global_permissions.page')}

    +

    {translate('global_permissions.page')}

    {this.renderSpinner()} -

    {window.t('global_permissions.page.description')}

    +

    {translate('global_permissions.page.description')}

    diff --git a/server/sonar-web/src/main/js/apps/issues/facets/author-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/author-facet.js index fc4c2f182ae..4d72395a6d2 100644 --- a/server/sonar-web/src/main/js/apps/issues/facets/author-facet.js +++ b/server/sonar-web/src/main/js/apps/issues/facets/author-facet.js @@ -18,6 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import CustomValuesFacet from './custom-values-facet'; +import { translate, translateWithParameters } from '../../../helpers/l10n'; export default CustomValuesFacet.extend({ getUrl: function () { @@ -30,13 +31,13 @@ export default CustomValuesFacet.extend({ minimumInputLength: 2, allowClear: false, formatNoMatches: function () { - return window.t('select2.noMatches'); + return translate('select2.noMatches'); }, formatSearching: function () { - return window.t('select2.searching'); + return translate('select2.searching'); }, formatInputTooShort: function () { - return window.tp('select2.tooShort', 2); + return translateWithParameters('select2.tooShort', 2); }, width: '100%', ajax: { diff --git a/server/sonar-web/src/main/js/apps/issues/facets/custom-values-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/custom-values-facet.js index 11d7336b17c..ccf6ce0f8c4 100644 --- a/server/sonar-web/src/main/js/apps/issues/facets/custom-values-facet.js +++ b/server/sonar-web/src/main/js/apps/issues/facets/custom-values-facet.js @@ -20,6 +20,7 @@ import _ from 'underscore'; import BaseFacet from './base-facet'; import Template from '../templates/facets/issues-custom-values-facet.hbs'; +import { translate, translateWithParameters } from '../../../helpers/l10n'; export default BaseFacet.extend({ template: Template, @@ -45,13 +46,13 @@ export default BaseFacet.extend({ minimumInputLength: 2, allowClear: false, formatNoMatches: function () { - return window.t('select2.noMatches'); + return translate('select2.noMatches'); }, formatSearching: function () { - return window.t('select2.searching'); + return translate('select2.searching'); }, formatInputTooShort: function () { - return window.tp('select2.tooShort', 2); + return translateWithParameters('select2.tooShort', 2); }, width: '100%', ajax: this.prepareAjaxSearch() diff --git a/server/sonar-web/src/main/js/apps/issues/facets/language-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/language-facet.js index 2343860a363..e1c997ff298 100644 --- a/server/sonar-web/src/main/js/apps/issues/facets/language-facet.js +++ b/server/sonar-web/src/main/js/apps/issues/facets/language-facet.js @@ -19,6 +19,7 @@ */ import _ from 'underscore'; import CustomValuesFacet from './custom-values-facet'; +import { translate, translateWithParameters } from '../../../helpers/l10n'; export default CustomValuesFacet.extend({ getUrl: function () { @@ -31,13 +32,13 @@ export default CustomValuesFacet.extend({ minimumInputLength: 2, allowClear: false, formatNoMatches: function () { - return window.t('select2.noMatches'); + return translate('select2.noMatches'); }, formatSearching: function () { - return window.t('select2.searching'); + return translate('select2.searching'); }, formatInputTooShort: function () { - return window.tp('select2.tooShort', 2); + return translateWithParameters('select2.tooShort', 2); }, width: '100%', ajax: { diff --git a/server/sonar-web/src/main/js/apps/issues/facets/project-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/project-facet.js index a1a462a0f14..cf274a18c5a 100644 --- a/server/sonar-web/src/main/js/apps/issues/facets/project-facet.js +++ b/server/sonar-web/src/main/js/apps/issues/facets/project-facet.js @@ -19,6 +19,7 @@ */ import _ from 'underscore'; import CustomValuesFacet from './custom-values-facet'; +import { translate, translateWithParameters } from '../../../helpers/l10n'; export default CustomValuesFacet.extend({ @@ -47,13 +48,13 @@ export default CustomValuesFacet.extend({ minimumInputLength: 2, allowClear: false, formatNoMatches: function () { - return window.t('select2.noMatches'); + return translate('select2.noMatches'); }, formatSearching: function () { - return window.t('select2.searching'); + return translate('select2.searching'); }, formatInputTooShort: function () { - return window.tp('select2.tooShort', 2); + return translateWithParameters('select2.tooShort', 2); }, width: '100%', ajax: { diff --git a/server/sonar-web/src/main/js/apps/issues/facets/rule-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/rule-facet.js index 24f0494b60b..19458e42da5 100644 --- a/server/sonar-web/src/main/js/apps/issues/facets/rule-facet.js +++ b/server/sonar-web/src/main/js/apps/issues/facets/rule-facet.js @@ -19,6 +19,7 @@ */ import _ from 'underscore'; import CustomValuesFacet from './custom-values-facet'; +import { translate, translateWithParameters } from '../../../helpers/l10n'; export default CustomValuesFacet.extend({ prepareSearch: function () { @@ -32,13 +33,13 @@ export default CustomValuesFacet.extend({ minimumInputLength: 2, allowClear: false, formatNoMatches: function () { - return window.t('select2.noMatches'); + return translate('select2.noMatches'); }, formatSearching: function () { - return window.t('select2.searching'); + return translate('select2.searching'); }, formatInputTooShort: function () { - return window.tp('select2.tooShort', 2); + return translateWithParameters('select2.tooShort', 2); }, width: '100%', ajax: { @@ -50,7 +51,7 @@ export default CustomValuesFacet.extend({ results: function (data) { var results; results = data.rules.map(function (rule) { - var lang = rule.langName || window.t('manual'); + var lang = rule.langName || translate('manual'); return { id: rule.key, text: '(' + lang + ') ' + rule.name diff --git a/server/sonar-web/src/main/js/apps/issues/facets/tag-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/tag-facet.js index 788b885cbf4..1b965c202a8 100644 --- a/server/sonar-web/src/main/js/apps/issues/facets/tag-facet.js +++ b/server/sonar-web/src/main/js/apps/issues/facets/tag-facet.js @@ -19,6 +19,7 @@ */ import _ from 'underscore'; import CustomValuesFacet from './custom-values-facet'; +import { translate } from '../../../helpers/l10n'; export default CustomValuesFacet.extend({ prepareSearch: function () { @@ -32,10 +33,10 @@ export default CustomValuesFacet.extend({ minimumInputLength: 0, allowClear: false, formatNoMatches: function () { - return window.t('select2.noMatches'); + return translate('select2.noMatches'); }, formatSearching: function () { - return window.t('select2.searching'); + return translate('select2.searching'); }, width: '100%', ajax: { diff --git a/server/sonar-web/src/main/js/apps/issues/workspace-list-empty-view.js b/server/sonar-web/src/main/js/apps/issues/workspace-list-empty-view.js index 66023267694..edbb3750e25 100644 --- a/server/sonar-web/src/main/js/apps/issues/workspace-list-empty-view.js +++ b/server/sonar-web/src/main/js/apps/issues/workspace-list-empty-view.js @@ -18,11 +18,12 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import Marionette from 'backbone.marionette'; +import { translate } from '../../helpers/l10n'; export default Marionette.ItemView.extend({ className: 'search-navigator-no-results', template: function () { - return window.t('issue_filter.no_issues'); + return translate('issue_filter.no_issues'); } }); diff --git a/server/sonar-web/src/main/js/apps/overview/components/complexity-distribution.js b/server/sonar-web/src/main/js/apps/overview/components/complexity-distribution.js index 17f375ae0e7..30a02c32db1 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/complexity-distribution.js +++ b/server/sonar-web/src/main/js/apps/overview/components/complexity-distribution.js @@ -21,6 +21,7 @@ import React from 'react'; import { BarChart } from '../../../components/charts/bar-chart'; import { formatMeasure } from '../../../helpers/measures'; +import { translateWithParameters } from '../../../helpers/l10n'; const HEIGHT = 80; @@ -41,7 +42,7 @@ export const ComplexityDistribution = React.createClass({ x: index, y: y, value: value, - tooltip: window.tp(`overview.complexity_tooltip.${this.props.of}`, y, value) + tooltip: translateWithParameters(`overview.complexity_tooltip.${this.props.of}`, y, value) }; }); diff --git a/server/sonar-web/src/main/js/apps/overview/components/coverage-measures.js b/server/sonar-web/src/main/js/apps/overview/components/coverage-measures.js index e557d5cf727..3e50df5ac79 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/coverage-measures.js +++ b/server/sonar-web/src/main/js/apps/overview/components/coverage-measures.js @@ -23,6 +23,7 @@ import { DetailedMeasure } from './detailed-measure'; import { DonutChart } from '../../../components/charts/donut-chart'; import { DrilldownLink } from '../../../components/shared/drilldown-link'; import { formatMeasure, formatMeasureVariation } from '../../../helpers/measures'; +import { translate } from '../../../helpers/l10n'; export const CoverageMeasures = React.createClass({ @@ -84,7 +85,7 @@ export const CoverageMeasures = React.createClass({ return
    - {window.t('metric', newCoverageMetricName, 'name')} + {translate('metric', newCoverageMetricName, 'name')}
    @@ -127,7 +128,7 @@ export const CoverageMeasures = React.createClass({
    - {window.t('metric', coverageMetricName, 'name')} + {translate('metric', coverageMetricName, 'name')} {this.renderDonut()} diff --git a/server/sonar-web/src/main/js/apps/overview/components/domain-bubble-chart.js b/server/sonar-web/src/main/js/apps/overview/components/domain-bubble-chart.js index 557103f9a74..62859068807 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/domain-bubble-chart.js +++ b/server/sonar-web/src/main/js/apps/overview/components/domain-bubble-chart.js @@ -21,7 +21,7 @@ import _ from 'underscore'; import React from 'react'; import { BubbleChart } from '../../../components/charts/bubble-chart'; -import { getComponentUrl } from '../../../helpers/urls'; +import { translate, translateWithParameters } from '../../../helpers/l10n'; import { getFiles } from '../../../api/components'; import { formatMeasure } from '../../../helpers/measures'; import Workspace from '../../../components/workspace/main'; @@ -144,10 +144,10 @@ export class DomainBubbleChart extends React.Component { return
    -

    {window.t('overview.chart.files')}

    +

    {translate('overview.chart.files')}

    • - {window.tp('overview.chart.legend.size_x', this.getSizeMetricsTitle())} + {translateWithParameters('overview.chart.legend.size_x', this.getSizeMetricsTitle())}
    @@ -160,7 +160,7 @@ export class DomainBubbleChart extends React.Component { {this.state.xMetric.name}
    {this.state.total > BUBBLES_LIMIT && -
    {window.tp('overview.chart.files.limit_message', BUBBLES_LIMIT)}
    } +
    {translateWithParameters('overview.chart.files.limit_message', BUBBLES_LIMIT)}
    }
    ; } diff --git a/server/sonar-web/src/main/js/apps/overview/components/domain-timeline.js b/server/sonar-web/src/main/js/apps/overview/components/domain-timeline.js index ad3898d5e17..40e50720eba 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/domain-timeline.js +++ b/server/sonar-web/src/main/js/apps/overview/components/domain-timeline.js @@ -27,6 +27,7 @@ import { getEvents } from '../../../api/events'; import { formatMeasure, groupByDomain } from '../../../helpers/measures'; import { getShortType } from '../helpers/metrics'; import { Timeline } from './timeline-chart'; +import { translate } from '../../../helpers/l10n'; const HEIGHT = 280; @@ -244,7 +245,7 @@ export const DomainTimeline = React.createClass({ return
    -

    {window.t('overview.chart.history')}

    +

    {translate('overview.chart.history')}

    {this.renderTimelineMetricSelect()}
    {this.renderComparisonMetricSelect()} diff --git a/server/sonar-web/src/main/js/apps/overview/components/domain-treemap.js b/server/sonar-web/src/main/js/apps/overview/components/domain-treemap.js index ef4eb2f3823..1c39fae9b66 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/domain-treemap.js +++ b/server/sonar-web/src/main/js/apps/overview/components/domain-treemap.js @@ -24,6 +24,7 @@ import { Treemap } from '../../../components/charts/treemap'; import { getChildren } from '../../../api/components'; import { formatMeasure } from '../../../helpers/measures'; import { getComponentUrl } from '../../../helpers/urls'; +import { translate, translateWithParameters } from '../../../helpers/l10n'; const HEIGHT = 302; @@ -143,13 +144,13 @@ export class DomainTreemap extends React.Component { render () { let color = this.props.colorMetric ? -
  • {window.tp('overview.chart.legend.color_x', this.state.colorMetric.name)}
  • : null; +
  • {translateWithParameters('overview.chart.legend.color_x', this.state.colorMetric.name)}
  • : null; return
    -

    {window.t('overview.chart.components')}

    +

    {translate('overview.chart.components')}

    • - {window.tp('overview.chart.legend.size_x', this.state.sizeMetric.name)} + {translateWithParameters('overview.chart.legend.size_x', this.state.sizeMetric.name)}
    • {color}
    diff --git a/server/sonar-web/src/main/js/apps/overview/components/event.js b/server/sonar-web/src/main/js/apps/overview/components/event.js index 26835342ae6..f333643b774 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/event.js +++ b/server/sonar-web/src/main/js/apps/overview/components/event.js @@ -21,6 +21,7 @@ import React from 'react'; import moment from 'moment'; import { TooltipsMixin } from '../../../components/mixins/tooltips-mixin'; +import { translate } from '../../../helpers/l10n'; export const Event = React.createClass({ @@ -40,7 +41,7 @@ export const Event = React.createClass({ const { event } = this.props; return
  • - {window.t('event.category', event.type)} + {translate('event.category', event.type)}{event.name} { event.text && } diff --git a/server/sonar-web/src/main/js/apps/overview/components/events-list-filter.js b/server/sonar-web/src/main/js/apps/overview/components/events-list-filter.js index 9e13efd0c74..71b5e927b02 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/events-list-filter.js +++ b/server/sonar-web/src/main/js/apps/overview/components/events-list-filter.js @@ -19,6 +19,7 @@ */ import React from 'react'; import Select from 'react-select'; +import { translate } from '../../../helpers/l10n'; const TYPES = ['All', 'Version', 'Alert', 'Profile', 'Other']; @@ -38,7 +39,7 @@ export const EventsListFilter = React.createClass({ const options = TYPES.map(type => { return { value: type, - label: window.t('event.category', type) + label: translate('event.category', type) }; }); return