aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/components
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2016-01-06 16:14:25 +0100
committerStas Vilchik <vilchiks@gmail.com>2016-01-06 16:25:12 +0100
commitf4c7830570b522ad83ec9168cf12755e58192d26 (patch)
tree60cb773e73bd4cd17b5d83191897d439ea0bbad5 /server/sonar-web/src/main/js/components
parent14fde3c0c46e717ac44a0b482f21f82149e2e837 (diff)
downloadsonarqube-f4c7830570b522ad83ec9168cf12755e58192d26.tar.gz
sonarqube-f4c7830570b522ad83ec9168cf12755e58192d26.zip
rewrite translation module
Diffstat (limited to 'server/sonar-web/src/main/js/components')
-rw-r--r--server/sonar-web/src/main/js/components/charts/treemap.js3
-rw-r--r--server/sonar-web/src/main/js/components/common/select-list.js3
-rw-r--r--server/sonar-web/src/main/js/components/issue/views/assign-form-view.js3
-rw-r--r--server/sonar-web/src/main/js/components/issue/views/plan-form-view.js3
-rw-r--r--server/sonar-web/src/main/js/components/navigator/filters/choice-filters.js3
-rw-r--r--server/sonar-web/src/main/js/components/shared/assignee-helper.js3
-rw-r--r--server/sonar-web/src/main/js/components/shared/list-footer.js3
-rw-r--r--server/sonar-web/src/main/js/components/shared/severity-helper.js3
-rw-r--r--server/sonar-web/src/main/js/components/shared/status-helper.js5
-rw-r--r--server/sonar-web/src/main/js/components/source-viewer/main.js3
10 files changed, 21 insertions, 11 deletions
diff --git a/server/sonar-web/src/main/js/components/charts/treemap.js b/server/sonar-web/src/main/js/components/charts/treemap.js
index b1b316d86fa..09b95e1e151 100644
--- a/server/sonar-web/src/main/js/components/charts/treemap.js
+++ b/server/sonar-web/src/main/js/components/charts/treemap.js
@@ -24,6 +24,7 @@ import React from 'react';
import { TreemapBreadcrumbs } from './treemap-breadcrumbs';
import { ResizeMixin } from './../mixins/resize-mixin';
import { TooltipsMixin } from './../mixins/tooltips-mixin';
+import { translate } from '../../helpers/l10n';
const SIZE_SCALE = d3.scale.linear()
@@ -121,7 +122,7 @@ export const Treemap = React.createClass({
renderWhenNoData () {
return <div className="sonar-d3">
<div className="treemap-container" style={{ width: this.state.width, height: this.state.height }}>
- {window.t('no_data')}
+ {translate('no_data')}
</div>
<TreemapBreadcrumbs {...this.props}/>
</div>;
diff --git a/server/sonar-web/src/main/js/components/common/select-list.js b/server/sonar-web/src/main/js/components/common/select-list.js
index 39d3e68fac0..268910eb90e 100644
--- a/server/sonar-web/src/main/js/components/common/select-list.js
+++ b/server/sonar-web/src/main/js/components/common/select-list.js
@@ -20,6 +20,7 @@
import $ from 'jquery';
import _ from 'underscore';
import Backbone from 'backbone';
+import { translate } from '../../helpers/l10n';
var showError = null;
@@ -251,7 +252,7 @@ var SelectListView = Backbone.View.extend({
this.listItemViews = [];
showError = function (jqXHR) {
- var message = window.t('default_error_message');
+ var message = translate('default_error_message');
if (jqXHR != null && jqXHR.responseJSON != null && jqXHR.responseJSON.errors != null) {
message = _.pluck(jqXHR.responseJSON.errors, 'msg').join('. ');
}
diff --git a/server/sonar-web/src/main/js/components/issue/views/assign-form-view.js b/server/sonar-web/src/main/js/components/issue/views/assign-form-view.js
index a326d93734b..841f1124812 100644
--- a/server/sonar-web/src/main/js/components/issue/views/assign-form-view.js
+++ b/server/sonar-web/src/main/js/components/issue/views/assign-form-view.js
@@ -22,6 +22,7 @@ import _ from 'underscore';
import ActionOptionsView from '../../common/action-options-view';
import Template from '../templates/issue-assign-form.hbs';
import OptionTemplate from '../templates/issue-assign-form-option.hbs';
+import { translate } from '../../../helpers/l10n';
export default ActionOptionsView.extend({
template: Template,
@@ -141,7 +142,7 @@ export default ActionOptionsView.extend({
if (this.assignees) {
return this.assignees;
}
- var assignees = [{ id: '', text: window.t('unassigned') }],
+ var assignees = [{ id: '', text: translate('unassigned') }],
currentUser = window.SS.user,
currentUserName = window.SS.userName;
assignees.push({ id: currentUser, text: currentUserName });
diff --git a/server/sonar-web/src/main/js/components/issue/views/plan-form-view.js b/server/sonar-web/src/main/js/components/issue/views/plan-form-view.js
index d79be00fc0f..a2c46a9ab27 100644
--- a/server/sonar-web/src/main/js/components/issue/views/plan-form-view.js
+++ b/server/sonar-web/src/main/js/components/issue/views/plan-form-view.js
@@ -21,6 +21,7 @@ import $ from 'jquery';
import _ from 'underscore';
import ActionOptionsView from '../../common/action-options-view';
import Template from '../templates/issue-plan-form.hbs';
+import { translate } from '../../../helpers/l10n';
export default ActionOptionsView.extend({
template: Template,
@@ -45,7 +46,7 @@ export default ActionOptionsView.extend({
},
getActionPlans: function () {
- return [{ key: '', name: window.t('issue.unplanned') }].concat(this.collection.toJSON());
+ return [{ key: '', name: translate('issue.unplanned') }].concat(this.collection.toJSON());
},
serializeData: function () {
diff --git a/server/sonar-web/src/main/js/components/navigator/filters/choice-filters.js b/server/sonar-web/src/main/js/components/navigator/filters/choice-filters.js
index 57b6bed89f8..6dc53e04e51 100644
--- a/server/sonar-web/src/main/js/components/navigator/filters/choice-filters.js
+++ b/server/sonar-web/src/main/js/components/navigator/filters/choice-filters.js
@@ -23,6 +23,7 @@ import Backbone from 'backbone';
import BaseFilters from './base-filters';
import Template from '../templates/choice-filter.hbs';
import ItemTemplate from '../templates/choice-filter-item.hbs';
+import { translate } from '../../../helpers/l10n';
var DetailsChoiceFilterView = BaseFilters.DetailsFilterView.extend({
template: Template,
@@ -269,7 +270,7 @@ var ChoiceFilterView = BaseFilters.BaseFilterView.extend({
}),
defaultValue = this.model.has('defaultValue') ?
this.model.get('defaultValue') :
- this.model.get('multiple') ? window.t('all') : window.t('any');
+ this.model.get('multiple') ? translate('all') : translate('any');
return this.isDefaultValue() ? defaultValue : value.join(', ');
},
diff --git a/server/sonar-web/src/main/js/components/shared/assignee-helper.js b/server/sonar-web/src/main/js/components/shared/assignee-helper.js
index f6600091b07..31e3e42f393 100644
--- a/server/sonar-web/src/main/js/components/shared/assignee-helper.js
+++ b/server/sonar-web/src/main/js/components/shared/assignee-helper.js
@@ -19,12 +19,13 @@
*/
import React from 'react';
import Avatar from './avatar';
+import { translate } from '../../helpers/l10n';
export default class Assignee extends React.Component {
render () {
let avatar = this.props.user ?
<span className="spacer-right"><Avatar email={this.props.user.email} size={16}/></span> : null;
- let name = this.props.user ? this.props.user.name : window.t('unassigned');
+ let name = this.props.user ? this.props.user.name : translate('unassigned');
return <span>{avatar}{name}</span>;
}
}
diff --git a/server/sonar-web/src/main/js/components/shared/list-footer.js b/server/sonar-web/src/main/js/components/shared/list-footer.js
index ad50cd8e80d..fc05b14c52b 100644
--- a/server/sonar-web/src/main/js/components/shared/list-footer.js
+++ b/server/sonar-web/src/main/js/components/shared/list-footer.js
@@ -19,6 +19,7 @@
*/
import classNames from 'classnames';
import React from 'react';
+import { translate } from '../../helpers/l10n';
export default React.createClass({
@@ -46,7 +47,7 @@ export default React.createClass({
renderLoading() {
return <footer className="spacer-top note text-center">
- {window.t('loading')}
+ {translate('loading')}
</footer>;
},
diff --git a/server/sonar-web/src/main/js/components/shared/severity-helper.js b/server/sonar-web/src/main/js/components/shared/severity-helper.js
index 5e5da357613..6e3ed4de918 100644
--- a/server/sonar-web/src/main/js/components/shared/severity-helper.js
+++ b/server/sonar-web/src/main/js/components/shared/severity-helper.js
@@ -19,6 +19,7 @@
*/
import React from 'react';
import SeverityIcon from './severity-icon';
+import { translate } from '../../helpers/l10n';
export default React.createClass({
render() {
@@ -29,7 +30,7 @@ export default React.createClass({
<span className="spacer-right">
<SeverityIcon severity={this.props.severity}/>
</span>
- {window.t('severity', this.props.severity)}
+ {translate('severity', this.props.severity)}
</span>;
}
});
diff --git a/server/sonar-web/src/main/js/components/shared/status-helper.js b/server/sonar-web/src/main/js/components/shared/status-helper.js
index 17cf75ef4fa..42c2139238b 100644
--- a/server/sonar-web/src/main/js/components/shared/status-helper.js
+++ b/server/sonar-web/src/main/js/components/shared/status-helper.js
@@ -19,6 +19,7 @@
*/
import React from 'react';
import StatusIcon from './status-icon';
+import { translate } from '../../helpers/l10n';
export default React.createClass({
render: function () {
@@ -27,13 +28,13 @@ export default React.createClass({
}
var resolution;
if (this.props.resolution) {
- resolution = ' (' + window.t('issue.resolution', this.props.resolution) + ')';
+ resolution = ' (' + translate('issue.resolution', this.props.resolution) + ')';
}
return (
<span>
<StatusIcon status={this.props.status}/>
&nbsp;
- {window.t('issue.status', this.props.status)}
+ {translate('issue.status', this.props.status)}
{resolution}
</span>
);
diff --git a/server/sonar-web/src/main/js/components/source-viewer/main.js b/server/sonar-web/src/main/js/components/source-viewer/main.js
index a247f9a6715..738c3f4f58c 100644
--- a/server/sonar-web/src/main/js/components/source-viewer/main.js
+++ b/server/sonar-web/src/main/js/components/source-viewer/main.js
@@ -33,6 +33,7 @@ import LineActionsPopupView from './popups/line-actions-popup';
import highlightLocations from './helpers/code-with-issue-locations-helper';
import Template from './templates/source-viewer.hbs';
import IssueLocationTemplate from './templates/source-viewer-issue-location.hbs';
+import { translateWithParameters } from '../../helpers/l10n';
var HIGHLIGHTED_ROW_CLASS = 'source-line-highlighted';
@@ -730,7 +731,7 @@ export default Marionette.LayoutView.extend({
$(e.currentTarget).tooltip({
container: 'body',
placement: 'right',
- title: window.tp('source_viewer.tooltip.new_code', this.sinceLabel),
+ title: translateWithParameters('source_viewer.tooltip.new_code', this.sinceLabel),
trigger: 'manual'
}).tooltip('show');
},