Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
692ddac
Translate default editor
maryia-lapata Oct 1, 2018
4c3277a
Merge branch 'master' into feature/translations/vis_metric_panel
maryia-lapata Oct 2, 2018
beb0a49
Translate aria-labels, update ids
maryia-lapata Oct 2, 2018
674a9ba
Merge branch 'master' into feature/translations/vis_metric_panel
maryia-lapata Oct 3, 2018
06612b0
Merge branch 'master' into feature/translations/vis_metric_panel
maryia-lapata Oct 5, 2018
6aebed2
Merge branch 'master' into feature/translations/vis_metric_panel
maryia-lapata Oct 8, 2018
e1cd183
Merge branch 'master' into feature/translations/vis_metric_panel
maryia-lapata Oct 9, 2018
7f73af8
Fix review comments
maryia-lapata Oct 9, 2018
cd83bfb
Revert deletion of NOT
maryia-lapata Oct 9, 2018
dfcc649
Merge branch 'master' into feature/translations/vis_metric_panel
maryia-lapata Oct 10, 2018
dfca524
Use one-time binding
maryia-lapata Oct 10, 2018
ef55807
Translations for ui/vis
maryia-lapata Oct 11, 2018
e81d903
Merge branch 'master' into feature/translations/vis_metric_panel
maryia-lapata Oct 16, 2018
9dd7151
Revert changes
maryia-lapata Oct 16, 2018
372ff76
Fix a typo
maryia-lapata Oct 16, 2018
3d54ab1
Merge pull request #4 from maryia-lapata/feature/translations/vis_ui
maryia-lapata Oct 16, 2018
0db8bd5
Merge branch 'master' into feature/translations/vis_metric_panel
maryia-lapata Oct 17, 2018
c7e5a90
Merge branch 'master' into feature/translations/vis_metric_panel
maryia-lapata Oct 19, 2018
13782d8
Refactoring
maryia-lapata Oct 19, 2018
de6a100
Revert translations since they aren't displayed on ui
maryia-lapata Oct 19, 2018
76fd1ef
Merge branch 'master' into feature/translations/vis_metric_panel
maryia-lapata Oct 23, 2018
6a8d5f6
Merge branch 'master' into feature/translations/vis_metric_panel
maryia-lapata Oct 25, 2018
e5c02b7
Merge branch 'master' into feature/translations/vis_metric_panel
pavel06081991 Nov 5, 2018
31d535b
resolve review comments
pavel06081991 Nov 5, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/ui/public/agg_types/metrics/count.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@

import { MetricAggType } from './metric_agg_type';
import { fieldFormats } from '../../registry/field_formats';
import { i18n } from '@kbn/i18n';

export const countMetricAgg = new MetricAggType({
name: 'count',
title: 'Count',
title: i18n.translate('common.ui.aggTypes.metrics.countLabel', { defaultMessage: 'Count' }),
hasNoDsl: true,
makeLabel: function () {
return 'Count';
return i18n.translate('common.ui.aggTypes.metrics.countText', { defaultMessage: 'Count' });
},
getFormat: function () {
return fieldFormats.getDefaultInstance('number');
Expand Down
8 changes: 6 additions & 2 deletions src/ui/public/fancy_forms/kbn_form_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

export function decorateFormController($delegate, $injector) {
export function decorateFormController($delegate, $injector, i18n) {
const [directive] = $delegate;
const FormController = directive.controller;

Expand Down Expand Up @@ -52,7 +52,11 @@ export function decorateFormController($delegate, $injector) {

describeErrors() {
const count = this.softErrorCount();
return `${count} Error${count === 1 ? '' : 's'}`;
return i18n('common.ui.fancyForm.errorMessage',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

=> errorDescription

{
defaultMessage: '{count, plural, one {# Error} other {# Errors}}',
values: { count }
});
}

$setTouched() {
Expand Down
6 changes: 5 additions & 1 deletion src/ui/public/vis/editors/default/advanced_toggle.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<div class="eui-textRight">
<a ng-click="advancedToggled = !advancedToggled">
<i aria-hidden="true" class="fa fa-caret-down" ng-class="{'fa-caret-down': advancedToggled, 'fa-caret-left': !advancedToggled}"></i>
Advanced
<span
i18n-id="common.ui.vis.editors.advancedToggle.advancedLinkLabel"
i18n-default-message="Advanced"
>
</span>
</a>
</div>
23 changes: 12 additions & 11 deletions src/ui/public/vis/editors/default/agg.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<!-- open/close editor -->
<button
aria-label="Toggle {{agg.schema.title}} editor"
aria-label="{{'common.ui.vis.editors.agg.toggleEditorAriaLabel' | i18n: { defaultMessage: 'Toggle {schema} editor', values: { schema: agg.schema.title } } }}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

toggleEditorAriaLabel => toggleEditorButtonAriaLabel

ng-click="editorOpen = !editorOpen"
aria-expanded="{{ !!editorOpen }}"
aria-controls="visAggEditorParams{{agg.id}}"
Expand Down Expand Up @@ -34,8 +34,8 @@
<button
ng-if="agg.enabled && canRemove(agg)"
ng-click="agg.enabled = false"
aria-label="Disable aggregation"
tooltip="Disable aggregation"
aria-label="{{'common.ui.vis.editors.agg.disableAggAriaLabel' | i18n: { defaultMessage: 'Disable aggregation' } }}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

disableAggAriaLabel => disableAggButtonAriaLabel

tooltip="{{'common.ui.vis.editors.agg.disableAggTooltip' | i18n: { defaultMessage: 'Disable aggregation' } }}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

disableAggTooltip => disableAggButtonTooltip

tooltip-append-to-body="true"
data-test-subj="disableAggregationBtn"
type="button"
Expand All @@ -47,8 +47,8 @@
<button
ng-if="!agg.enabled"
ng-click="agg.enabled = true"
aria-label="Enable aggregation"
tooltip="Enable aggregation"
aria-label="{{'common.ui.vis.editors.agg.anableAggAriaLabel' | i18n: { defaultMessage: 'Enable aggregation' } }}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

anableAggAriaLabel => enableAggButtonAriaLabel
typo anable => enable

tooltip="{{'common.ui.vis.editors.agg.anableAggTooltip' | i18n: { defaultMessage: 'Enable aggregation' } }}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

anableAggTooltip => enableAggButtonTooltip
typo anable => enable

tooltip-append-to-body="true"
data-test-subj="disableAggregationBtn"
type="button"
Expand All @@ -60,25 +60,26 @@
<button
draggable-handle
ng-if="stats.count > 1"
tooltip="Modify Priority by Dragging"
tooltip="{{'common.ui.vis.editors.agg.modifyPriorityTooltip' | i18n: { defaultMessage: 'Modify Priority by Dragging' } }}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

modifyPriorityTooltip => modifyPriorityButtonTooltip

tooltip-append-to-body="true"
type="button"
keyboard-move="onPriorityReorder(direction)"
class="kuiButton kuiButton--basic kuiButton--small">
<i aria-hidden="true" class="fa fa-arrows-v"></i>
<span class="kuiScreenReaderOnly">
Use up and down key on this button to move this aggregation up and down
in the priority order.
<span class="kuiScreenReaderOnly"
i18n-id="common.ui.vis.editors.modifyPriorityScreenReaderDescription"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

modifyPriorityScreenReaderDescription => howToModifyScreenReaderPriorityDescription

i18n-default-message="Use up and down key on this button to move this aggregation up and down in the priority order."
>
</span>
</button>

<!-- remove button -->
<button
ng-if="canRemove(agg)"
aria-label="Remove Dimension"
aria-label="{{'common.ui.vis.editors.agg.removeDimensionAriaLabel' | i18n: { defaultMessage: 'Remove Dimension' } }}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removeDimensionAriaLabel => removeDimensionButtonAriaLabel

ng-if="stats.count > stats.min"
ng-click="remove(agg)"
tooltip="Remove Dimension"
tooltip="{{'common.ui.vis.editors.agg.removeDimensionTooltip' | i18n: { defaultMessage: 'Remove Dimension' } }}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removeDimensionTooltip => removeDimensionButtonTooltip

tooltip-append-to-body="true"
type="button"
class="kuiButton kuiButton--danger kuiButton--small">
Expand Down
18 changes: 14 additions & 4 deletions src/ui/public/vis/editors/default/agg_add.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<div ng-show="add.form">
<label>Select {{ groupName }} type</label>
<label
i18n-id="common.ui.vis.editors.aggAdd.selectGroupTypeLabel"
i18n-default-message="Select {groupNameText} type"
i18n-values="{ groupNameText }"
>
</label>
<ul class="form-group list-group list-group-menu">
<li
tabindex="0"
Expand Down Expand Up @@ -28,23 +33,28 @@
data-test-subj="visualizeEditorAddAggregationButton"
class="kuiButton kuiButton--secondary kuiButton--small"
ng-if="groupName !== 'buckets' || !stats.count && !stats.deprecate"
i18n-id="common.ui.vis.editors.aggAdd.addGroupButtonLabel"
i18n-default-message="Add {groupNameText}"
i18n-values="{ groupNameText }"
>
Add {{ groupName }}
</button>

<button
data-test-subj="visualizeEditorAddAggregationButton"
class="kuiButton kuiButton--secondary kuiButton--small"
ng-if="groupName === 'buckets' && stats.count > 0 && !stats.deprecate"
i18n-id="common.ui.vis.editors.aggAdd.addSubGroupButtonLabel"
i18n-default-message="Add sub-{groupNameText}"
i18n-values="{ groupNameText }"
>
Add sub-{{ groupName }}
</button>
</div>

<button
class="kuiButton kuiButton--danger kuiButton--small"
ng-if="add.form"
i18n-id="common.ui.vis.editors.aggAdd.cancelButtonLabel"
i18n-default-message="Cancel"
>
Cancel
</button>
</div>
2 changes: 1 addition & 1 deletion src/ui/public/vis/editors/default/agg_group.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="sidebar-item visEditorAggGroup__wrapper">
<div class="sidebar-item-title visEditorAggGroup__title">
{{ groupName }}
{{ groupNameText }}
</div>

<div ng-class="groupName" draggable-container="group" class="visEditorAggGroup">
Expand Down
2 changes: 2 additions & 0 deletions src/ui/public/vis/editors/default/agg_group.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import './agg_add';
import { uiModules } from '../../../modules';
import aggGroupTemplate from './agg_group.html';
import { move } from '../../../utils/collection';
import { aggGroupNameMaps } from './agg_groups';

uiModules
.get('app/visualize')
Expand All @@ -35,6 +36,7 @@ uiModules
scope: true,
link: function ($scope, $el, attr) {
$scope.groupName = attr.groupName;
$scope.groupNameText = aggGroupNameMaps()[$scope.groupName];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe groupNameText => groupNameLabel?

$scope.$bind('group', 'state.aggs.bySchemaGroup["' + $scope.groupName + '"]');
$scope.$bind('schemas', 'vis.type.schemas["' + $scope.groupName + '"]');

Expand Down
25 changes: 25 additions & 0 deletions src/ui/public/vis/editors/default/agg_groups.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import { i18n } from '@kbn/i18n';

export const aggGroupNameMaps = () => ({
metrics: i18n.translate('common.ui.vis.editors.aggGroups.metricsText', { defaultMessage: 'metrics' }),
buckets: i18n.translate('common.ui.vis.editors.aggGroups.bucketsText', { defaultMessage: 'buckets' })
});
18 changes: 13 additions & 5 deletions src/ui/public/vis/editors/default/agg_params.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<div ng-if="aggIsTooLow" class="form-group">
<p class="visEditorAggParam__error">
"{{ agg.schema.title }}" aggs must run before all other buckets!
<p class="visEditorAggParam__error"
i18n-id="common.ui.vis.editors.aggParams.errors.aggIsTooLowErrorMessage"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aggWrongRunOrderErrorMessage

i18n-default-message="&quot;{schema}&quot; aggs must run before all other buckets!"
i18n-values="{ schema: agg.schema.title }"
>
</p>
<input
type="number"
Expand All @@ -16,12 +19,17 @@
</p>
</div>

<div ng-if="agg.schema.deprecate" class="form-group">
<div ng-if="!agg.schema.deprecate" class="form-group">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove ! to pass functional tests

<p ng-show="agg.schema.deprecateMessage" class="visEditorAggParam__error">
{{ agg.schema.deprecateMessage }}
</p>
<p ng-show="!agg.schema.deprecateMessage" class="visEditorAggParam__error">
"{{ agg.schema.title }}" has been deprecated.
<p
ng-show="agg.schema.deprecateMessage"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks like you do not need to remove ! here

class="visEditorAggParam__error"
i18n-id="common.ui.vis.editors.aggParams.errors.deprecateErrorMessage"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

schemaIsDeprecatedErrorMessage

i18n-default-message="&quot;{schema}&quot; has been deprecated."
i18n-values="{ schema: agg.schema.title }"
>
</p>
</div>

Expand Down
22 changes: 18 additions & 4 deletions src/ui/public/vis/editors/default/agg_select.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,29 @@
<div class="form-group">
<div>
<label ng-if="$index < 1 || groupName !== 'buckets'" class="eui-displayInline">Aggregation</label>
<label ng-if="$index >= 1 && groupName === 'buckets'" class="eui-displayInline">Sub Aggregation</label>
<label
ng-if="$index < 1 || groupName !== 'buckets'"
class="eui-displayInline"
i18n-id="common.ui.vis.editors.aggSelect.aggregationLabel"
i18n-default-message="Aggregation"
>
</label>
<label
ng-if="$index >= 1 && groupName === 'buckets'"
class="eui-displayInline"
i18n-id="common.ui.vis.editors.aggSelect.subAggregationLabel"
i18n-default-message="Sub Aggregation"
>
</label>
<a
ng-if="aggHelpLink"
href="{{aggHelpLink}}"
class="pull-right"
target="_blank"
rel="noopener noreferrer"
i18n-id="common.ui.vis.editors.aggSelect.helpLinkLabel"
i18n-default-message="{aggTitle} help"
i18n-values="{ aggTitle: agg.type.title }"
>
{{agg.type.title}} help
</a>
</div>
<div class="euiSpacer euiSpacer--s"></div>
Expand All @@ -20,7 +34,7 @@
data-test-subj="visEditorAggSelect"
ng-model="agg.type"
>
<ui-select-match placeholder="Select an aggregation">
<ui-select-match placeholder="{{ 'common.ui.vis.editors.aggSelect.selectAggPlaceholder' | i18n: { defaultMessage: 'Select an aggregation' } }}">
{{$select.selected.title}}
</ui-select-match>
<ui-select-choices
Expand Down
2 changes: 1 addition & 1 deletion src/ui/public/vis/editors/default/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<vis-editor-resizer
class="visEditor__resizer"
tabindex="0"
aria-label="Press left/right to resize the editor"
aria-label="{{'common.ui.vis.editors.resizePlaceholder' | i18n: { defaultMessage: 'Press left/right to resize the editor' } }}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resizePlaceholder => resizeAriaLabel

data-test-subj="visualizeEditorResizer"
>&#xFE19;</vis-editor-resizer>
</div>
Expand Down
6 changes: 4 additions & 2 deletions src/ui/public/vis/editors/default/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { getVisualizeLoader } from '../../../visualize/loader/visualize_loader';
import { updateEditorStateWithChanges } from './update_editor_state';


const defaultEditor = function ($rootScope, $compile) {
const defaultEditor = function ($rootScope, $compile, i18n) {
return class DefaultEditor {
static key = 'default';

Expand All @@ -45,7 +45,9 @@ const defaultEditor = function ($rootScope, $compile) {

if (!this.vis.type.editorConfig.optionTabs && this.vis.type.editorConfig.optionsTemplate) {
this.vis.type.editorConfig.optionTabs = [
{ name: 'options', title: 'Options', editor: this.vis.type.editorConfig.optionsTemplate }
{ name: 'options',
title: i18n('common.ui.vis.editors.sidebar.tabs.optionsLabel', { defaultMessage: 'Options' }),
editor: this.vis.type.editorConfig.optionsTemplate }
];
}
}
Expand Down
29 changes: 20 additions & 9 deletions src/ui/public/vis/editors/default/sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@

<div
css-truncate
aria-label="{{:: 'Index pattern: ' + vis.indexPattern.title}}"
aria-label="{{
'common.ui.vis.editors.sidebar.indexPatternAriaLabel' | i18n:
{
defaultMessage: 'Index pattern: {title}',
values: { title: vis.indexPattern.title }
}
}}"
ng-if="vis.type.requiresSearch && vis.type.options.showIndexSelection"
class="index-pattern visEditorSidebar__indexPattern"
tabindex="0"
Expand All @@ -35,8 +41,9 @@
ng-click="sidebar.section='data'"
kbn-accessible-click
data-test-subj="visualizeEditDataLink"
i18n-id="common.ui.vis.editors.sidebar.tabs.dataLabel"
i18n-default-message="Data"
>
Data
</a>
</li>

Expand Down Expand Up @@ -78,7 +85,7 @@
</li>

<li
tooltip="Auto apply changes"
tooltip="{{'common.ui.vis.editors.sidebar.autoApplyTooltip' | i18n: { defaultMessage: 'Auto apply changes' } }}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

autoApplyTooltip => autoApplyChangesTooltip

tooltip-placement="bottom"
tooltip-popup-delay="400"
tooltip-append-to-body="1"
Expand All @@ -87,7 +94,7 @@
<button
data-test-subj="visualizeEditorAutoButton"
class="kuiButton kuiButton--basic navbar-btn-link visEditorSidebar__navButtonLink"
aria-label="Auto update the visualization on every change"
aria-label="{{'common.ui.vis.editors.sidebar.autoApplyAriaLabel' | i18n: { defaultMessage: 'Auto update the visualization on every change' } }}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

autoApplyAriaLabel => autoApplyChangesAriaLabel

ng-click="toggleAutoApply()"
ng-class="{
'kuiButton--primary': autoApplyEnabled,
Expand All @@ -97,10 +104,14 @@
<icon aria-hidden="true" type="'refresh'"></icon>
</button>
</li>
<span ng-show="autoApplyEnabled">Auto Apply</span>
<span ng-show="autoApplyEnabled"
i18n-id="common.ui.vis.editors.sidebar.autoApplyLabel"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

autoApplyLabel => autoApplyChangesLabel

i18n-default-message="Auto Apply"
>
</span>

<li
tooltip="Apply changes"
tooltip="{{'common.ui.vis.editors.sidebar.applyChangesTooltip' | i18n: { defaultMessage: 'Apply changes' } }}"
tooltip-placement="bottom"
tooltip-popup-delay="400" tooltip-append-to-body="1"
ng-hide="autoApplyEnabled"
Expand All @@ -110,14 +121,14 @@
class="kuiButton kuiButton--primary navbar-btn-link visEditorSidebar__navButtonLink"
type="submit"
ng-disabled="!vis.dirty || visualizeEditor.errorCount() > 0 || autoApplyEnabled"
aria-label="Update the visualization with your changes"
aria-label="{{'common.ui.vis.editors.sidebar.applyChangesAriaLabel' | i18n: { defaultMessage: 'Update the visualization with your changes' } }}"
>
<icon aria-hidden="true" type="'play'"></icon>
</button>
</li>

<li
tooltip="Discard changes"
tooltip="{{'common.ui.vis.editors.sidebar.discardChangesTooltip' | i18n: { defaultMessage: 'Discard changes' } }}"
tooltip-placement="bottom"
tooltip-popup-delay="400"
tooltip-append-to-body="1"
Expand All @@ -128,7 +139,7 @@
class="kuiButton kuiButton--basic navbar-btn-link visEditorSidebar__navButtonLink"
ng-disabled="!vis.dirty"
ng-click="resetEditableVis()"
aria-label="Reset the visualization"
aria-label="{{'common.ui.vis.editors.sidebar.discardChangesAriaLabel' | i18n: { defaultMessage: 'Reset the visualization' } }}"
>
<icon type="'cross'"></icon>
</button>
Expand Down