@@ -14,6 +14,7 @@ import {
1414} from '../select' ;
1515import { Button } from '../button' ;
1616import { Confirm } from '../confirm' ;
17+ import { useTranslation } from 'react-i18next' ;
1718
1819interface DataTablePaginationProps < TData > {
1920 table : Table < TData > ;
@@ -26,29 +27,35 @@ export function DataTablePagination<TData>({
2627 onDelete,
2728 isLoadingDelete,
2829} : DataTablePaginationProps < TData > ) {
30+ const { t } = useTranslation ( 'dataTable' ) ;
2931 return (
3032 < div className = "flex items-center justify-between px-2" >
3133 < div className = "flex items-center gap-2" >
3234 < div className = "flex-1 text-sm text-muted-foreground whitespace-nowrap" >
33- { table . getFilteredSelectedRowModel ( ) . rows . length } trên{ ' ' }
34- { table . getFilteredRowModel ( ) . rows . length } dòng được chọn.
35+ { t ( 'row_selected' , {
36+ selected : table . getFilteredSelectedRowModel ( ) . rows . length ,
37+ total : table . getFilteredRowModel ( ) . rows . length ,
38+ } ) }
3539 </ div >
3640 { onDelete && table . getFilteredSelectedRowModel ( ) . rows . length ? (
3741 < Confirm
38- description = "Hành động này không thể hoàn tác. Bạn có chắc chắn muốn xoá?"
42+ description = { t ( 'remove_confirm_desc' ) }
3943 isLoading = { isLoadingDelete }
4044 onConfirm = { onDelete }
41- title = "Xoá những dòng đã chọn?"
45+ title = { t ( 'remove_confirm_title' ) }
4246 >
4347 < span className = " text-sm text-red-500 cursor-pointer" >
44- Xoá { table . getFilteredSelectedRowModel ( ) . rows . length } dòng
48+ { t ( 'remove_row' , {
49+ selected :
50+ table . getFilteredSelectedRowModel ( ) . rows . length ,
51+ } ) }
4552 </ span >
4653 </ Confirm >
4754 ) : null }
4855 </ div >
4956 < div className = "flex items-center space-x-6 lg:space-x-8" >
5057 < div className = "flex items-center space-x-2" >
51- < p className = "text-sm font-medium" > Dòng trên trang </ p >
58+ < p className = "text-sm font-medium" > { t ( 'row_per_page' ) } : </ p >
5259 < Select
5360 onValueChange = { ( value ) => {
5461 table . setPageSize ( Number ( value ) ) ;
@@ -70,8 +77,10 @@ export function DataTablePagination<TData>({
7077 </ Select >
7178 </ div >
7279 < div className = "flex w-[100px] items-center justify-center text-sm font-medium whitespace-nowrap" >
73- Trang { table . getState ( ) . pagination . pageIndex + 1 } trên{ ' ' }
74- { table . getPageCount ( ) }
80+ { t ( 'page_of' , {
81+ current : table . getState ( ) . pagination . pageIndex + 1 ,
82+ total : table . getPageCount ( ) ,
83+ } ) }
7584 </ div >
7685 < div className = "flex items-center space-x-2" >
7786 < Button
0 commit comments