aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/code
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/apps/code
parent14fde3c0c46e717ac44a0b482f21f82149e2e837 (diff)
downloadsonarqube-f4c7830570b522ad83ec9168cf12755e58192d26.tar.gz
sonarqube-f4c7830570b522ad83ec9168cf12755e58192d26.zip
rewrite translation module
Diffstat (limited to 'server/sonar-web/src/main/js/apps/code')
-rw-r--r--server/sonar-web/src/main/js/apps/code/actions/index.js9
-rw-r--r--server/sonar-web/src/main/js/apps/code/components/Code.js3
-rw-r--r--server/sonar-web/src/main/js/apps/code/components/ComponentDetach.js3
-rw-r--r--server/sonar-web/src/main/js/apps/code/components/Components.js11
-rw-r--r--server/sonar-web/src/main/js/apps/code/components/ComponentsEmpty.js3
5 files changed, 16 insertions, 13 deletions
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 (
<div className="page">
<header className="page-header">
- <h1 className="page-title">{window.t('code.page')}</h1>
+ <h1 className="page-title">{translate('code.page')}</h1>
<div
className="pull-left"
diff --git a/server/sonar-web/src/main/js/apps/code/components/ComponentDetach.js b/server/sonar-web/src/main/js/apps/code/components/ComponentDetach.js
index 4d996238c35..37d6f62dc4e 100644
--- a/server/sonar-web/src/main/js/apps/code/components/ComponentDetach.js
+++ b/server/sonar-web/src/main/js/apps/code/components/ComponentDetach.js
@@ -20,13 +20,14 @@
import React from 'react';
import { getComponentUrl } from '../../../helpers/urls';
+import { translate } from '../../../helpers/l10n';
const ComponentDetach = ({ component }) => (
<a
className="icon-detach"
target="_blank"
- title={window.t('code.open_in_new_tab')}
+ title={translate('code.open_in_new_tab')}
href={getComponentUrl(component.key)}/>
);
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 }) =>
<tr>
<th className="thin nowrap">&nbsp;</th>
<th>&nbsp;</th>
- <th className="thin nowrap text-right">{window.t('metric.ncloc.name')}</th>
- <th className="thin nowrap text-right">{window.t('metric.sqale_index.short_name')}</th>
- <th className="thin nowrap text-right">{window.t('metric.violations.name')}</th>
- <th className="thin nowrap text-right">{window.t('metric.coverage.name')}</th>
- <th className="thin nowrap text-right">{window.t('metric.duplicated_lines_density.short_name')}</th>
+ <th className="thin nowrap text-right">{translate('metric.ncloc.name')}</th>
+ <th className="thin nowrap text-right">{translate('metric.sqale_index.short_name')}</th>
+ <th className="thin nowrap text-right">{translate('metric.violations.name')}</th>
+ <th className="thin nowrap text-right">{translate('metric.coverage.name')}</th>
+ <th className="thin nowrap text-right">{translate('metric.duplicated_lines_density.short_name')}</th>
</tr>
</thead>
{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 = () => (
<tr>
<td colSpan="2">
- {window.t('no_results')}
+ {translate('no_results')}
</td>
<td colSpan="5">
&nbsp;