Skip to content

Commit 3ec9cd2

Browse files
committed
Merge remote-tracking branch 'upstream/master' into feature/translations/timelion
2 parents d393989 + ec2f025 commit 3ec9cd2

File tree

71 files changed

+1329
-446
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+1329
-446
lines changed

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"private": true,
1414
"version": "7.0.0-alpha1",
1515
"branch": "master",
16+
"types": "./target/types/type_exports.d.ts",
1617
"build": {
1718
"number": 8467,
1819
"sha": "6cb7fec4e154faa0a4a3fee4b33dfef91b9870d9"
@@ -52,7 +53,9 @@
5253
"uiFramework:build": "cd packages/kbn-ui-framework && yarn docSiteBuild",
5354
"uiFramework:createComponent": "cd packages/kbn-ui-framework && yarn createComponent",
5455
"uiFramework:documentComponent": "cd packages/kbn-ui-framework && yarn documentComponent",
55-
"kbn:watch": "node scripts/kibana --dev --logging.json=false"
56+
"kbn:watch": "node scripts/kibana --dev --logging.json=false",
57+
"build:types": "tsc --p tsconfig.types.json",
58+
"kbn:bootstrap": "yarn build:types"
5659
},
5760
"repository": {
5861
"type": "git",

packages/kbn-config-schema/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"declaration": true,
55
"declarationDir": "./target/types",
66
"outDir": "./target/out",
7-
"stripInternal": true
7+
"stripInternal": true,
8+
"declarationMap": true
89
},
910
"include": [
1011
"./types/joi.d.ts",

packages/kbn-i18n/GUIDELINE.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The following types are supported:
1818
- ToggleSwitch
1919
- LinkLabel and etc.
2020

21-
There is one more complex case, when we have to divide a single expression into different labels.
21+
There is one more complex case, when we have to divide a single expression into different labels.
2222

2323
For example the message before translation looks like:
2424

@@ -221,8 +221,8 @@ For example:
221221

222222
```js
223223
<button
224-
aria-label="{{'kbn.management.editIndexPattern.removeAriaLabel' | i18n: {defaultMessage: 'Remove index pattern'} }}"
225-
tooltip="{{'kbn.management.editIndexPattern.removeTooltip' | i18n: {defaultMessage: 'Remove index pattern'} }}"
224+
aria-label="{{ ::'kbn.management.editIndexPattern.removeAriaLabel' | i18n: {defaultMessage: 'Remove index pattern'} }}"
225+
tooltip="{{ ::'kbn.management.editIndexPattern.removeTooltip' | i18n: {defaultMessage: 'Remove index pattern'} }}"
226226
>
227227
</button>
228228
```
@@ -333,4 +333,3 @@ it('should render normally', async () => {
333333
});
334334
// ...
335335
```
336-

packages/kbn-i18n/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ import { i18n } from '@kbn/i18n';
188188
i18n.init(messages);
189189
```
190190

191-
One common use-case is that of internationalizing a string constant. Here's an
191+
One common use-case is that of internationalizing a string constant. Here's an
192192
example of how we'd do that:
193193

194194
```js
@@ -399,7 +399,7 @@ In order to translate attributes in Angular we should use `i18nFilter`:
399399
```html
400400
<input
401401
type="text"
402-
placeholder="{{'KIBANA-MANAGEMENT-OBJECTS-SEARCH_PLACEHOLDER' | i18n: {
402+
placeholder="{{ ::'KIBANA-MANAGEMENT-OBJECTS-SEARCH_PLACEHOLDER' | i18n: {
403403
defaultMessage: 'Search'
404404
} }}"
405405
>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`i18nDirective inserts correct translation html content with values 1`] = `"default-message word"`;
4+
5+
exports[`i18nDirective inserts correct translation html content with values 2`] = `"default-message anotherWord"`;

packages/kbn-i18n/src/angular/directive.test.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,15 @@ angular
3030

3131
describe('i18nDirective', () => {
3232
let compile: angular.ICompileService;
33-
let scope: angular.IRootScopeService;
33+
let scope: angular.IRootScopeService & { word?: string };
3434

3535
beforeEach(angular.mock.module('app'));
3636
beforeEach(
3737
angular.mock.inject(
3838
($compile: angular.ICompileService, $rootScope: angular.IRootScopeService) => {
3939
compile = $compile;
4040
scope = $rootScope.$new();
41+
scope.word = 'word';
4142
}
4243
)
4344
);
@@ -62,19 +63,23 @@ describe('i18nDirective', () => {
6263
test('inserts correct translation html content with values', () => {
6364
const id = 'id';
6465
const defaultMessage = 'default-message {word}';
65-
const compiledContent = 'default-message word';
6666

6767
const element = angular.element(
6868
`<div
6969
i18n-id="${id}"
7070
i18n-default-message="${defaultMessage}"
71-
i18n-values="{ word: 'word' }"
71+
i18n-values="{ word }"
7272
/>`
7373
);
7474

7575
compile(element)(scope);
7676
scope.$digest();
7777

78-
expect(element.html()).toEqual(compiledContent);
78+
expect(element.html()).toMatchSnapshot();
79+
80+
scope.word = 'anotherWord';
81+
scope.$digest();
82+
83+
expect(element.html()).toMatchSnapshot();
7984
});
8085
});

packages/kbn-i18n/src/angular/directive.ts

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,37 @@ import { IDirective, IRootElementService, IScope } from 'angular';
2121

2222
import { I18nServiceType } from './provider';
2323

24-
export function i18nDirective(i18n: I18nServiceType): IDirective {
24+
interface I18nScope extends IScope {
25+
values?: Record<string, any>;
26+
defaultMessage: string;
27+
id: string;
28+
}
29+
30+
export function i18nDirective(i18n: I18nServiceType): IDirective<I18nScope> {
2531
return {
2632
restrict: 'A',
2733
scope: {
2834
id: '@i18nId',
2935
defaultMessage: '@i18nDefaultMessage',
30-
values: '=i18nValues',
36+
values: '<?i18nValues',
3137
},
32-
link($scope: IScope, $element: IRootElementService) {
33-
$scope.$watchGroup(
34-
['id', 'defaultMessage', 'values'],
35-
([id, defaultMessage = '', values = {}]) => {
36-
$element.html(
37-
i18n(id, {
38-
values,
39-
defaultMessage,
40-
})
41-
);
42-
}
43-
);
38+
link($scope, $element) {
39+
if ($scope.values) {
40+
$scope.$watchCollection('values', () => {
41+
setHtmlContent($element, $scope, i18n);
42+
});
43+
} else {
44+
setHtmlContent($element, $scope, i18n);
45+
}
4446
},
4547
};
4648
}
49+
50+
function setHtmlContent($element: IRootElementService, $scope: I18nScope, i18n: I18nServiceType) {
51+
$element.html(
52+
i18n($scope.id, {
53+
values: $scope.values,
54+
defaultMessage: $scope.defaultMessage,
55+
})
56+
);
57+
}

src/core/server/logging/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,7 @@
1919

2020
export { Logger } from './logger';
2121
export { LoggerFactory } from './logger_factory';
22+
/** @internal */
2223
export { LoggingConfig } from './logging_config';
24+
/** @internal */
2325
export { LoggingService } from './logging_service';

src/core/server/logging/logging_service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import { LoggerConfigType, LoggingConfig } from './logging_config';
2626

2727
/**
2828
* Service that is responsible for maintaining loggers and logger appenders.
29+
* @internal
2930
*/
3031
export class LoggingService implements LoggerFactory {
3132
private config?: LoggingConfig;

src/core_plugins/kibana/public/discover/components/field_chooser/lib/field_calculator.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ function getFieldValueCounts(params) {
5959

6060
if (params.hits.length - missing === 0) {
6161
return {
62-
error: 'This field is present in your elasticsearch mapping' +
63-
' but not in any documents in the search results.' +
62+
error: 'This field is present in your Elasticsearch mapping' +
63+
' but not in the ' + params.hits.length + ' documents shown in the doc table.' +
6464
' You may still be able to visualize or search on it.'
6565
};
6666
}

0 commit comments

Comments
 (0)