Localization in EJ2 JavaScript Kanban control
18 Apr 202310 minutes to read
The localization library allows you to localize the default text content of the Kanban to different cultures using the locale
property.
In Kanban, total count and min or max count text alone will be localized based on culture.
Locale key | en-US (default) |
---|---|
items | items |
min | Min |
max | Max |
cardsSelected | Cards Selected |
addTitle | Add New Card |
editTitle | Edit Card Details |
deleteTitle | Delete Card |
deleteContent | Are you sure you want to delete this card? |
save | Save |
delete | Delete |
cancel | Cancel |
yes | Yes |
no | No |
close | Close |
noCard | No cards to display |
unassigned | Unassigned |
Loading translations
To load translation object in an application, use load
function of L10n
class.
The following example demonstrates the Kanban in Deutsch
culture.
ej.base.L10n.load({
'de': {
'kanban': {
'items': 'Artikel',
'min': 'Min',
'max': 'Max'
}
}
});
var kanbanOptions = {
dataSource: kanbanData,
keyField: 'Status',
locale: 'de',
columns: [
{ headerText: 'Backlog', keyField: 'Open', showItemCount: true, minCount: 6 },
{ headerText: 'In Progress', keyField: 'InProgress', showItemCount: true, maxCount: 5 },
{ headerText: 'Done', keyField: 'Close', showItemCount: true }
],
swimlaneSettings: {
keyField: 'Assignee'
},
cardSettings: {
contentField: 'Summary',
headerField: 'Id'
}
};
var kanbanObj = new ej.kanban.Kanban(kanbanOptions);
kanbanObj.appendTo('#Kanban');
<!DOCTYPE html><html lang="en"><head>
<title>Kanban Localization</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Kanban localization">
<meta name="author" content="Syncfusion">
<link href="index.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-base/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-buttons/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-inputs/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-dropdowns/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-layouts/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-navigations/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-popups/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-kanban/styles/material.css" rel="stylesheet">
<script src="https://cdn.syncfusion.com/ej2/27.2.2/dist/ej2.min.js" type="text/javascript"></script>
<script src="es5-datasource.js" type="text/javascript"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div class="container-fluid" style="margin-top:15px;">
<div class="row">
<div class="col-md-9">
<div id="Kanban"></div>
</div>
</div>
</div>
<script>
var ele = document.getElementById('container');
if(ele) {
ele.style.visibility = "visible";
}
</script>
<script src="index.js" type="text/javascript"></script>
</body></html>
Right to left (RTL)
The Kanban provides an option to switch its text direction and layout from right to left. It improves the user experiences and accessibility for users who use right-to-left languages (Arabic, Farsi, Urdu, etc.). To enable right-to-left mode in Kanban, set the enableRtl
to true.
ej.base.L10n.load({
'ar': {
'kanban': {
'items': 'العناصر',
'min': 'أنا',
'max': 'ماكس'
}
}
});
var kanbanOptions = {
dataSource: kanbanData,
keyField: 'Status',
enableRtl: true,
locale: 'ar',
columns: [
{ headerText: 'Backlog', keyField: 'Open', showItemCount: true, minCount: 6 },
{ headerText: 'In Progress', keyField: 'InProgress', showItemCount: true, maxCount: 5 },
{ headerText: 'Done', keyField: 'Close', showItemCount: true }
],
swimlaneSettings: {
keyField: 'Assignee'
},
cardSettings: {
contentField: 'Summary',
headerField: 'Id'
}
};
var kanbanObj = new ej.kanban.Kanban(kanbanOptions);
kanbanObj.appendTo('#Kanban');
<!DOCTYPE html><html lang="en"><head>
<title>Kanban RTL</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Kanban RTL mode">
<meta name="author" content="Syncfusion">
<link href="index.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-base/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-buttons/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-inputs/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-dropdowns/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-layouts/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-navigations/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-popups/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-kanban/styles/material.css" rel="stylesheet">
<script src="https://cdn.syncfusion.com/ej2/27.2.2/dist/ej2.min.js" type="text/javascript"></script>
<script src="es5-datasource.js" type="text/javascript"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div class="container-fluid" style="margin-top:15px;">
<div class="row">
<div class="col-md-9">
<div id="Kanban"></div>
</div>
</div>
</div>
<script>
var ele = document.getElementById('container');
if(ele) {
ele.style.visibility = "visible";
}
</script>
<script src="index.js" type="text/javascript"></script>
</body></html>