Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions jsx/I18nSetup.d.ts

This file was deleted.

10 changes: 9 additions & 1 deletion jsx/I18nSetup.js → jsx/I18nSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ import enResources from '../locale/en/LC_MESSAGES/loris.json';
import frResources from '../locale/fr/LC_MESSAGES/loris.json';
import zhResources from '../locale/zh/LC_MESSAGES/loris.json';

declare const loris: any;

declare module 'i18next' {
interface CustomTypeOptions {
defaultNS: 'loris';
}
}

const resources = {
ja: {
loris: jaResources,
Expand All @@ -27,7 +35,6 @@ const resources = {
zh: {
loris: zhResources,
},

};

/**
Expand Down Expand Up @@ -60,4 +67,5 @@ i18n
defaultNS: 'loris',
fallbackNS: [],
});

export default i18n;
11 changes: 6 additions & 5 deletions modules/dataquery/jsx/definefilters.addfiltermodal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
} from './types';
import {CategoriesAPIReturn} from './hooks/usedatadictionary';
import {Trans} from 'react-i18next';
import {TFunction} from 'i18next';

/**
* Renders a selectable list of visits
Expand All @@ -32,7 +33,7 @@ import {Trans} from 'react-i18next';
* @returns {React.ReactElement} - The visit list dropdown
*/
function VisitList(props: {
t: any,
t: TFunction,
selected: string[],
options: string[],
onChange: (newvals: string[]) => void,
Expand Down Expand Up @@ -88,7 +89,7 @@ function VisitList(props: {
* @returns {React.ReactElement} - The modal window
*/
function AddFilterModal(props: {
t: any,
t: TFunction,
query: QueryGroup,
closeModal: () => void,
addQueryGroupItem: (group: QueryGroup, condition: QueryTerm) => void,
Expand Down Expand Up @@ -321,11 +322,11 @@ function AddFilterModal(props: {
* Get a list of possible query operators based on a field's dictionary
*
* @param {object} dict - the field dictionary
* @param {any} t useTranslation
* @param {TFunction} t useTranslation
*
* @returns {object} - list of options for this dictionary
*/
function getOperatorOptions(dict: FieldDictionary, t: any) {
function getOperatorOptions(dict: FieldDictionary, t: TFunction) {
let options: {[operator: string]: string};
if (dict.type == 'integer' || dict.type == 'date' ||
dict.type == 'interval' || dict.type == 'time' ||
Expand Down Expand Up @@ -396,7 +397,7 @@ function valueInput(fielddict: FieldDictionary,
op: Operators,
value: string|string[],
setValue: (val: string) => void,
t: any
t: TFunction,
) {
const vs: string = value as string;
switch (op) {
Expand Down
3 changes: 2 additions & 1 deletion modules/dataquery/jsx/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import hiStrings from '../locale/hi/LC_MESSAGES/dataquery.json';
import jaStrings from '../locale/ja/LC_MESSAGES/dataquery.json';
import frStrings from '../locale/fr/LC_MESSAGES/dataquery.json';
import zhStrings from '../locale/zh/LC_MESSAGES/dataquery.json';
import {TFunction} from 'i18next';

type ActiveCategoryType = {
module: string,
Expand Down Expand Up @@ -77,7 +78,7 @@ function useActiveCategory(
* @returns {React.ReactElement} - The main page of the app
*/
function DataQueryApp(props: {
t: any,
t: TFunction,
queryAdmin: boolean,
}) {
const [activeTab, setActiveTab] = useState('Info');
Expand Down
11 changes: 6 additions & 5 deletions modules/dataquery/jsx/viewdata.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {QueryGroup} from './querydef';
import {FullDictionary, FieldDictionary} from './types';
import {calcPayload} from './calcpayload';
import getDictionaryDescription from './getdictionarydescription';
import {TFunction} from 'i18next';

type TableRow = (string|null)[];

Expand Down Expand Up @@ -333,7 +334,7 @@ function useDataOrganization(
* @returns {React.ReactElement} - The ViewData tab
*/
function ViewData(props: {
t: any
t: TFunction,
fields: APIQueryField[],
filters: QueryGroup,
onRun: () => void
Expand Down Expand Up @@ -830,7 +831,7 @@ function expandLongitudinalCells(
* no data should be displayed
* @param {EnumDisplayTypes} enumDisplay - The format to display
* enum values
* @param {any} t - useTranslation
* @param {TFunction} t - useTranslation

* @returns {function} - the appropriate column formatter for
this data organization
Expand All @@ -842,7 +843,7 @@ function organizedFormatter(
dict: FullDictionary,
displayEmptyVisits: boolean,
enumDisplay: EnumDisplayTypes,
t: any,
t: TFunction,
) {
let callback;
switch (visitOrganization) {
Expand Down Expand Up @@ -1202,7 +1203,7 @@ type HeaderDisplayType = 'fieldname' | 'fielddesc' | 'fieldnamedesc';
* @param {string} org - the visit organization
* @param {string} display - the header display format
* @param {object} fulldict - the data dictionary
* @param {any} t - useTranslation
* @param {TFunction} t - useTranslation
* @param {function} onProgress - Callback to indicate progress in processing
* @returns {array} - A promise which resolves to the array of headers to display
* in the frontend table
Expand All @@ -1212,7 +1213,7 @@ function organizeHeaders(
org: VisitOrgType,
display: HeaderDisplayType,
fulldict: FullDictionary,
t: any,
t: TFunction,
onProgress: (i: number) => void): Promise<string[]> {
/**
* Format a header according to the selected display type
Expand Down
3 changes: 2 additions & 1 deletion modules/dataquery/jsx/welcome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {FlattenedField, FlattenedQuery, VisitOption} from './types';
import ReplayIcon from './ReplayIcon';
import ShareIconA from './ShareIconA';
import {useTranslation} from 'react-i18next';
import {TFunction} from 'i18next';
import 'I18nSetup';

declare const loris: any;
Expand Down Expand Up @@ -1084,7 +1085,7 @@ function ShareIcon(props: {
* @returns {React.ReactElement} - The React element
*/
function NameIcon(props: {
t: any,
t: TFunction,
onClick?: () => void
}): React.ReactElement {
return (<span title={props.t('Name Query', {ns: 'dataquery'})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
import TriggerableModal from 'jsx/TriggerableModal';
import DatasetTagger from '../series/components/DatasetTagger';
import {InfoIcon} from '../series/components/components';
import {TFunction} from 'i18next';

declare global {
interface Window {
Expand All @@ -52,7 +53,7 @@ type CProps = {
eegMontageName: string,
recordingHasHED: boolean,
children: React.ReactNode,
t: any,
t: TFunction,
};

const MenuOption = {
Expand Down
Loading