How to internationalize title and description of an adf-widget?
See original GitHub issueHi, i’am trying to internationalize my adf-widget title and description, but it wont work… is there a way to change title and description in a controller? or is it possible to inject the $filterProvider to translate during the configphase?
tried this:
angular.module('adf.widget.myWidget', ['adf.provider'])
.config(function(dashboardProvider){
function getName($filter) { var dcName = $filter('translate')('MYWIDGET.NAME'); return dcName; };
dashboardProvider
.widget('myWidget', {
title: getName(),
description: 'test',
templateUrl: '{widgetsPath}/myWidget/src/view.html',
controller: 'myWidgetCtrl',
edit: {
templateUrl: '{widgetsPath}/myWidget/src/edit.html'
}
});
})
Issue Analytics
- State:
- Created 7 years ago
- Comments:13
Top Results From Across the Web
Internationalizing Flutter apps
More information about these app properties, the types they depend on, and how internationalized Flutter apps are typically structured, can be found below....
Read more >How to add widget in the existing page - ServiceNow
Type the name of the widget in "filter widget" and it will display your widget then drag it to the required area. Refer...
Read more >Widget inside another widget Qt - c++ - Stack Overflow
enter image description here. So, custom your own widget using QGridLayout and set the position of your widget inside it.
Read more >Widgets inside Graphics View - Game Programming Using Qt ...
First we create a QSpinBox and a QGraphicsProxyWidget element, which act as containers for widgets and indirectly inherit QGraphicsItem.
Read more >Widgets | Theme Developer Handbook
construct : Set up your widget with a description, name, and display width in your admin. widget : Process the widget options and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You can use addLocale, there are only 2 languages out of the box so you will have to translate the labels yourself and pass in the translation table, see https://github.com/angular-dashboard-framework/angular-dashboard-framework/wiki/Localization
You will also have to have the title label and description before you get this far since during the config phase it won’t be running any functions. You could include it in some dynamically created values. We are using a key value pair that is generated based on the user’s language. This get loaded in the module. You can use the values that are now in scope.
I believe the easiest was is to fork the Plugin and add some lines of Code. I change the addWidgetDialog function in the angular-dashboard-framework.js to:
` $scope.addWidgetDialog = function(){ var addScope = $scope.$new(); var widgets; if (angular.isFunction(widgetFilter)){ widgets = {}; angular.forEach(dashboard.widgets, function(widget, type){ if (widgetFilter(widget, type)){ widgets[type] = widget; } }); } else { angular.forEach(dashboard.widgets,function(widget){ widget.description = $translate.instant(widget.description ); widget.title = $translate.instant(widget.title); }); widgets = dashboard.widgets; } addScope.widgets = widgets; var opts = { scope: addScope, templateUrl: adfTemplatePath + ‘widget-add.html’ }; var instance = $uibModal.open(opts); addScope.addWidget = function(widget){ var w = { type: widget, config: createConfiguration(widget) }; addScope.model.rows[0].columns[0].widgets.unshift(w); instance.close();
Then Inject $translate in the Controller of angular.module(‘adf’).directive(‘adfDashboard’,…
now u can use translateStrings for title and description. I hope that will help u