-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add angular-translate as the Angular globalization framework
The angular-translate framework integrates with the Kibana i18n engine whereby it consumes translations from the i18n engine and not the translations directly. This is achieved by using a custom loader which calls the client side getTranslations() method. This method return the translations loaded by the i18n engine during instantation of Kibana server instance.
- Loading branch information
Showing
5 changed files
with
24 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"UI-WELCOME_MESSAGE": "Loading Kibana", | ||
"UI-WELCOME_ERROR": "Kibana did not load properly. Check the server output for more information." | ||
"UI-WELCOME_ERROR": "Kibana did not load properly. Check the server output for more information.", | ||
"KIBANA-H1_CONFIGURE_INDEX_PATTERN": "Configure an index pattern" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
require('jquery'); | ||
require('node_modules/angular/angular'); | ||
require('node_modules/angular-translate/dist/angular-translate.min'); | ||
module.exports = window.angular; | ||
|
||
require('node_modules/angular-elastic/elastic'); | ||
|
||
require('ui/modules').get('kibana', ['monospaced.elastic']); | ||
require('ui/modules').get('kibana', ['monospaced.elastic', 'pascalprecht.translate']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,27 @@ | ||
define(function (require) { | ||
require('angular'); | ||
require('ui/angular-bootstrap/index'); | ||
const chrome = require('../src/ui/public/chrome/chrome'); | ||
|
||
return require('ui/modules') | ||
.get('kibana', ['ui.bootstrap']) | ||
.get('kibana', ['ui.bootstrap', 'pascalprecht.translate']) | ||
.config(function ($tooltipProvider) { | ||
$tooltipProvider.setTriggers({ 'mouseenter': 'mouseleave click' }); | ||
}); | ||
}) | ||
.factory('translationsLoader', function ($q) { | ||
return function (options) { | ||
var deferred = $q.defer(); | ||
const translations = chrome.getTranslations(); | ||
deferred.resolve(translations); | ||
return deferred.promise; | ||
}; | ||
}) | ||
.config(['$translateProvider', function ($translateProvider) { | ||
$translateProvider.preferredLanguage('en'); | ||
$translateProvider.useLoader('translationsLoader'); | ||
// Enable escaping of HTML | ||
// issue in https://angular-translate.github.io/docs/#/guide/19_security | ||
$translateProvider.useSanitizeValueStrategy('escape'); | ||
}]); | ||
|
||
}); |