@@ -7,9 +7,8 @@ import "slickgrid/slick.grid.css"
77import { Dataset , isTotalRow , Row , SingleRow } from "./statistics.types"
88import { StoreService } from "@/services/store"
99import settings from "@/settings"
10- import { locObj } from "@/i18n"
10+ import { loc , locObj } from "@/i18n"
1111import { formatFrequency } from "@/i18n/util"
12- import { LangString } from "@/i18n/types"
1312import { zip } from "lodash"
1413import { corpusListing } from "@/corpora/corpus_listing"
1514
@@ -74,7 +73,7 @@ export class StatisticsGrid extends Slick.Grid<Row> {
7473 refreshColumns ( ) {
7574 const columns = this . getColumns ( ) as SlickgridColumn [ ]
7675 columns . forEach ( ( column ) => {
77- if ( column . translation ) column . name = locObj ( column . translation , this . store . lang )
76+ if ( column . getName ) column . name = column . getName ( this . store . lang )
7877 } )
7978 this . setColumns ( columns )
8079 }
@@ -109,7 +108,7 @@ function createColumns(store: StoreService, corpora: string[], attrs: string[]):
109108 if ( reduceVal == null || reduceValLabel == null ) break
110109 columns . push ( {
111110 id : reduceVal ,
112- translation : reduceValLabel ,
111+ getName : ( lang ) => locObj ( reduceValLabel ! , lang ) ,
113112 field : "hit_value" ,
114113 sortable : true ,
115114 formatter : ( row , cell , value , columnDef , data : Row ) => {
@@ -135,7 +134,7 @@ function createColumns(store: StoreService, corpora: string[], attrs: string[]):
135134
136135 columns . push ( {
137136 id : "total" ,
138- name : "stats_total" ,
137+ getName : ( lang ) => loc ( "stats_total" , lang ) ,
139138 field : "total" ,
140139 sortable : true ,
141140 defaultSortAsc : false ,
@@ -151,7 +150,7 @@ function createColumns(store: StoreService, corpora: string[], attrs: string[]):
151150 corpora . forEach ( ( id ) =>
152151 columns . push ( {
153152 id,
154- translation : settings . corpora [ id . toLowerCase ( ) ] . title ,
153+ getName : ( lang ) => locObj ( settings . corpora [ id . toLowerCase ( ) ] . title , lang ) ,
155154 field : "count" ,
156155 sortable : true ,
157156 defaultSortAsc : false ,
@@ -168,5 +167,5 @@ function createColumns(store: StoreService, corpora: string[], attrs: string[]):
168167}
169168
170169type SlickgridColumn = Slick . Column < Dataset > & {
171- translation ?: LangString
170+ getName ?: ( lang : string ) => string
172171}
0 commit comments