diff --git a/frontend/404.tsx b/frontend/404.tsx index 82defad39..057ca63cf 100644 --- a/frontend/404.tsx +++ b/frontend/404.tsx @@ -1,5 +1,5 @@ import * as React from "react"; -import { t } from "i18next"; +import { t } from "./i18next_wrapper"; // No reusability here. Why not just keep it from taking up sass? const STYLES: React.CSSProperties = { diff --git a/frontend/__tests__/entry.tsx b/frontend/__tests__/entry.tsx index 2c73b0c7a..a6c102a8a 100644 --- a/frontend/__tests__/entry.tsx +++ b/frontend/__tests__/entry.tsx @@ -33,7 +33,7 @@ jest.mock("../routes", () => { import { stopIE } from "../util/stop_ie"; import { shortRevision } from "../util/util"; import { detectLanguage } from "../i18n"; -import { init } from "i18next"; +import I from "i18next"; describe("entry file", () => { it("Calls the expected callbacks", async () => { @@ -42,6 +42,6 @@ describe("entry file", () => { expect(stopIE).toHaveBeenCalled(); expect(shortRevision).toHaveBeenCalled(); expect(detectLanguage).toHaveBeenCalled(); - expect(init).toHaveBeenCalled(); + expect(I.init).toHaveBeenCalled(); }); }); diff --git a/frontend/account/components/change_password.tsx b/frontend/account/components/change_password.tsx index 0ec6ef270..675390714 100644 --- a/frontend/account/components/change_password.tsx +++ b/frontend/account/components/change_password.tsx @@ -1,5 +1,5 @@ import * as React from "react"; -import { t } from "i18next"; + import { Widget, WidgetHeader, @@ -14,6 +14,7 @@ import { success, error } from "farmbot-toastr/dist"; import { Content } from "../../constants"; import { uniq } from "lodash"; import { BlurablePassword } from "../../ui/blurable_password"; +import { t } from "../../i18next_wrapper"; interface PasswordForm { new_password: string; diff --git a/frontend/account/components/delete_account.tsx b/frontend/account/components/delete_account.tsx index d581c7525..68225b4f0 100644 --- a/frontend/account/components/delete_account.tsx +++ b/frontend/account/components/delete_account.tsx @@ -1,5 +1,5 @@ import * as React from "react"; -import { t } from "i18next"; + import { Widget, WidgetHeader, @@ -10,6 +10,7 @@ import { import { DeleteAccountProps, DeleteAccountState } from "../interfaces"; import { Content } from "../../constants"; import { BlurablePassword } from "../../ui/blurable_password"; +import { t } from "../../i18next_wrapper"; export class DeleteAccount extends React.Component { diff --git a/frontend/account/components/export_account_panel.tsx b/frontend/account/components/export_account_panel.tsx index 908ce7acf..fe245b9be 100644 --- a/frontend/account/components/export_account_panel.tsx +++ b/frontend/account/components/export_account_panel.tsx @@ -1,7 +1,8 @@ import * as React from "react"; import { Widget, WidgetHeader, WidgetBody, Row, Col } from "../../ui"; import { Content } from "../../constants"; -import { t } from "i18next"; +import { t } from "../../i18next_wrapper"; + export function ExportAccountPanel(props: { onClick: () => void }) { return diff --git a/frontend/account/components/settings.tsx b/frontend/account/components/settings.tsx index 1cbe85d72..8a24ffcf0 100644 --- a/frontend/account/components/settings.tsx +++ b/frontend/account/components/settings.tsx @@ -1,9 +1,10 @@ import * as React from "react"; -import { t } from "i18next"; + import { BlurableInput, Widget, WidgetHeader, WidgetBody, SaveBtn } from "../../ui/index"; import { SettingsPropTypes } from "../interfaces"; +import { t } from "../../i18next_wrapper"; export class Settings extends React.Component { render() { diff --git a/frontend/account/index.tsx b/frontend/account/index.tsx index 0e2f669ee..d5fea49ea 100644 --- a/frontend/account/index.tsx +++ b/frontend/account/index.tsx @@ -1,5 +1,4 @@ import * as React from "react"; -import { t } from "i18next"; import { connect } from "react-redux"; import { Settings, DeleteAccount, ChangePassword } from "./components"; import { Props } from "./interfaces"; @@ -16,6 +15,7 @@ import { requestAccountExport } from "./request_account_export"; import { DevWidget } from "./dev/dev_widget"; import { BooleanConfigKey } from "farmbot/dist/resources/configs/web_app"; import { DevMode } from "./dev/dev_mode"; +import { t } from "../i18next_wrapper"; const KEYS: (keyof User)[] = ["id", "name", "email", "created_at", "updated_at"]; diff --git a/frontend/account/labs/labs_features.tsx b/frontend/account/labs/labs_features.tsx index a58c5d87f..d78a500b8 100644 --- a/frontend/account/labs/labs_features.tsx +++ b/frontend/account/labs/labs_features.tsx @@ -2,9 +2,10 @@ import * as React from "react"; import { WidgetHeader, Widget, WidgetBody } from "../../ui/index"; import { LabsFeaturesList } from "./labs_features_list_ui"; import { maybeToggleFeature } from "./labs_features_list_data"; -import { t } from "i18next"; + import { ToolTips } from "../../constants"; import { GetWebAppConfigValue } from "../../config_storage/actions"; +import { t } from "../../i18next_wrapper"; interface LabsFeaturesProps { getConfigValue: GetWebAppConfigValue; diff --git a/frontend/account/labs/labs_features_list_data.ts b/frontend/account/labs/labs_features_list_data.ts index c2c5c4eaa..1cc785957 100644 --- a/frontend/account/labs/labs_features_list_data.ts +++ b/frontend/account/labs/labs_features_list_data.ts @@ -1,9 +1,10 @@ -import { t } from "i18next"; + import { BooleanSetting } from "../../session_keys"; import { Content } from "../../constants"; import { VirtualTrail } from "../../farm_designer/map/layers/farmbot/bot_trail"; import { GetWebAppConfigValue, setWebAppConfigValue } from "../../config_storage/actions"; import { BooleanConfigKey } from "farmbot/dist/resources/configs/web_app"; +import { t } from "../../i18next_wrapper"; export interface LabsFeature { /** Toggle label. */ diff --git a/frontend/account/request_account_export.ts b/frontend/account/request_account_export.ts index 79d439be0..a2ec4de25 100644 --- a/frontend/account/request_account_export.ts +++ b/frontend/account/request_account_export.ts @@ -1,9 +1,10 @@ import { API } from "../api"; import { Content } from "../constants"; import { success } from "farmbot-toastr"; -import { t } from "i18next"; + import axios, { AxiosResponse } from "axios"; import { DeviceAccountSettings } from "farmbot/dist/resources/api_resources"; +import { t } from "../i18next_wrapper"; interface DataDumpExport { device?: DeviceAccountSettings; } type Response = AxiosResponse; diff --git a/frontend/api/crud.ts b/frontend/api/crud.ts index e65c0a882..79ee6fbc8 100644 --- a/frontend/api/crud.ts +++ b/frontend/api/crud.ts @@ -17,11 +17,12 @@ import { ResourceIndex } from "../resources/interfaces"; import { SequenceBodyItem } from "farmbot/dist"; import { Actions } from "../constants"; import { maybeStartTracking } from "./maybe_start_tracking"; -import { t } from "i18next"; + import { newTaggedResource } from "../sync/actions"; import { arrayUnwrap } from "../resources/util"; import { findByUuid } from "../resources/reducer_support"; import { assign, noop } from "lodash"; +import { t } from "../i18next_wrapper"; export function edit(tr: TaggedResource, changes: Partial): ReduxAction { diff --git a/frontend/app.tsx b/frontend/app.tsx index c5acef401..3fa8f4c40 100644 --- a/frontend/app.tsx +++ b/frontend/app.tsx @@ -1,5 +1,5 @@ import * as React from "react"; -import { t } from "i18next"; + import { connect } from "react-redux"; import { init, error } from "farmbot-toastr"; import { NavBar } from "./nav"; @@ -24,6 +24,7 @@ import { takeSortedLogs } from "./logs/state_to_props"; import { FirmwareConfig } from "farmbot/dist/resources/configs/firmware"; import { getFirmwareConfig } from "./resources/getters"; import { intersection } from "lodash"; +import { t } from "./i18next_wrapper"; /** For the logger module */ init(); diff --git a/frontend/connectivity/connect_device.ts b/frontend/connectivity/connect_device.ts index fc2b74703..637baaca5 100644 --- a/frontend/connectivity/connect_device.ts +++ b/frontend/connectivity/connect_device.ts @@ -7,7 +7,7 @@ import { success, error, info, warning } from "farmbot-toastr"; import { HardwareState } from "../devices/interfaces"; import { GetState, ReduxAction } from "../redux/interfaces"; import { Content, Actions } from "../constants"; -import { t } from "i18next"; + import { EXPECTED_MAJOR, EXPECTED_MINOR, @@ -27,6 +27,7 @@ import { onLogs } from "./log_handlers"; import { ChannelName, MessageType } from "../sequences/interfaces"; import { DeepPartial } from "redux"; import { slowDown } from "./slow_down"; +import { t } from "../i18next_wrapper"; export const TITLE = "New message from bot"; /** TODO: This ought to be stored in Redux. It is here because of historical diff --git a/frontend/controls/axis_display_group.tsx b/frontend/controls/axis_display_group.tsx index 5b2ce5561..d729ccd16 100644 --- a/frontend/controls/axis_display_group.tsx +++ b/frontend/controls/axis_display_group.tsx @@ -1,8 +1,9 @@ import * as React from "react"; -import { t } from "i18next"; + import { Row, Col } from "../ui/index"; import { AxisDisplayGroupProps } from "./interfaces"; import { isNumber } from "lodash"; +import { t } from "../i18next_wrapper"; const Axis = ({ val }: { val: number | undefined }) => diff --git a/frontend/controls/axis_input_box_group.tsx b/frontend/controls/axis_input_box_group.tsx index ca6955618..cb117ae3d 100644 --- a/frontend/controls/axis_input_box_group.tsx +++ b/frontend/controls/axis_input_box_group.tsx @@ -1,10 +1,11 @@ import * as React from "react"; import { AxisInputBox } from "./axis_input_box"; -import { t } from "i18next"; + import { Row, Col } from "../ui/index"; import { AxisInputBoxGroupProps, AxisInputBoxGroupState } from "./interfaces"; import { isNumber } from "lodash"; import { Vector3 } from "farmbot"; +import { t } from "../i18next_wrapper"; /** Coordinate input and GO button for Move widget. */ export class AxisInputBoxGroup extends diff --git a/frontend/controls/key_val_show_row.tsx b/frontend/controls/key_val_show_row.tsx index 713fdd282..8769672c4 100644 --- a/frontend/controls/key_val_show_row.tsx +++ b/frontend/controls/key_val_show_row.tsx @@ -1,7 +1,7 @@ import * as React from "react"; import { Row, Col } from "../ui/index"; import { ToggleButton } from "./toggle_button"; -import { t } from "i18next"; +import { t } from "../i18next_wrapper"; export interface KeyValRowProps { label: string; diff --git a/frontend/controls/move/bot_position_rows.tsx b/frontend/controls/move/bot_position_rows.tsx index d54bf832e..62034d3ef 100644 --- a/frontend/controls/move/bot_position_rows.tsx +++ b/frontend/controls/move/bot_position_rows.tsx @@ -1,5 +1,5 @@ import * as React from "react"; -import { t } from "i18next"; + import { Row, Col } from "../../ui"; import { BotLocationData } from "../../devices/interfaces"; import { moveAbs } from "../../devices/actions"; @@ -8,6 +8,7 @@ import { AxisDisplayGroup } from "../axis_display_group"; import { AxisInputBoxGroup } from "../axis_input_box_group"; import { GetWebAppBool } from "./interfaces"; import { BooleanSetting } from "../../session_keys"; +import { t } from "../../i18next_wrapper"; export interface BotPositionRowsProps { locationData: BotLocationData; diff --git a/frontend/controls/move/direction_button.tsx b/frontend/controls/move/direction_button.tsx index 57185f266..7bc9aa473 100644 --- a/frontend/controls/move/direction_button.tsx +++ b/frontend/controls/move/direction_button.tsx @@ -2,7 +2,7 @@ import * as React from "react"; import { moveRelative } from "../../devices/actions"; import { DirectionButtonProps, Payl } from "./interfaces"; import { CONFIG_DEFAULTS } from "farmbot/dist/config"; -import { t } from "i18next"; +import { t } from "../../i18next_wrapper"; export function directionDisabled(props: DirectionButtonProps): boolean { const { diff --git a/frontend/controls/move/jog_buttons.tsx b/frontend/controls/move/jog_buttons.tsx index 8056d722c..a640eae43 100644 --- a/frontend/controls/move/jog_buttons.tsx +++ b/frontend/controls/move/jog_buttons.tsx @@ -4,8 +4,7 @@ import { homeAll, findHome } from "../../devices/actions"; import { JogMovementControlsProps } from "./interfaces"; import { getDevice } from "../../device"; import { buildDirectionProps } from "./direction_axes_props"; -import { t } from "i18next"; - +import { t } from "../../i18next_wrapper"; const DEFAULT_STEP_SIZE = 100; /* diff --git a/frontend/controls/move/jog_controls_group.tsx b/frontend/controls/move/jog_controls_group.tsx index b1bc8f520..3092baa20 100644 --- a/frontend/controls/move/jog_controls_group.tsx +++ b/frontend/controls/move/jog_controls_group.tsx @@ -1,5 +1,5 @@ import * as React from "react"; -import { t } from "i18next"; + import { McuParams } from "farmbot"; import { BotPosition } from "../../devices/interfaces"; import { changeStepSize } from "../../devices/actions"; @@ -7,6 +7,7 @@ import { StepSizeSelector } from "./step_size_selector"; import { GetWebAppBool } from "./interfaces"; import { JogButtons } from "./jog_buttons"; import { BooleanSetting } from "../../session_keys"; +import { t } from "../../i18next_wrapper"; interface JogControlsGroupProps { dispatch: Function; diff --git a/frontend/controls/move/motor_position_plot.tsx b/frontend/controls/move/motor_position_plot.tsx index 42acbb94f..09f9ebbdf 100644 --- a/frontend/controls/move/motor_position_plot.tsx +++ b/frontend/controls/move/motor_position_plot.tsx @@ -3,8 +3,9 @@ import { Xyz, LocationName, Dictionary } from "farmbot"; import moment from "moment"; import { BotLocationData, BotPosition } from "../../devices/interfaces"; import { trim } from "../../util"; -import { t } from "i18next"; + import { cloneDeep, max, get, isNumber, isEqual, takeRight, ceil, range } from "lodash"; +import { t } from "../../i18next_wrapper"; const HEIGHT = 50; const HISTORY_LENGTH_SECONDS = 120; diff --git a/frontend/controls/move/move.tsx b/frontend/controls/move/move.tsx index 70a5f491b..2de3768cf 100644 --- a/frontend/controls/move/move.tsx +++ b/frontend/controls/move/move.tsx @@ -1,5 +1,5 @@ import * as React from "react"; -import { t } from "i18next"; + import { Widget, WidgetBody, WidgetHeader } from "../../ui"; import { EStopButton } from "../../devices/components/e_stop_btn"; import { MustBeOnline } from "../../devices/must_be_online"; @@ -14,6 +14,7 @@ import { BotPositionRows } from "./bot_position_rows"; import { MotorPositionPlot } from "./motor_position_plot"; import { Popover, Position } from "@blueprintjs/core"; import { BooleanConfigKey } from "farmbot/dist/resources/configs/web_app"; +import { t } from "../../i18next_wrapper"; export class Move extends React.Component { diff --git a/frontend/controls/move/settings_menu.tsx b/frontend/controls/move/settings_menu.tsx index 9c79b4faf..4285976a2 100644 --- a/frontend/controls/move/settings_menu.tsx +++ b/frontend/controls/move/settings_menu.tsx @@ -1,10 +1,11 @@ import * as React from "react"; -import { t } from "i18next"; + import { BooleanSetting } from "../../session_keys"; import { ToggleButton } from "../toggle_button"; import { ToggleWebAppBool, GetWebAppBool } from "./interfaces"; import { BooleanConfigKey } from "farmbot/dist/resources/configs/web_app"; import { DevSettings } from "../../account/dev/dev_support"; +import { t } from "../../i18next_wrapper"; export const moveWidgetSetting = (toggle: ToggleWebAppBool, getValue: GetWebAppBool) => ({ label, setting }: { label: string, setting: BooleanConfigKey }) => diff --git a/frontend/controls/peripherals/index.tsx b/frontend/controls/peripherals/index.tsx index 9f83f8ac8..1ad2b1083 100644 --- a/frontend/controls/peripherals/index.tsx +++ b/frontend/controls/peripherals/index.tsx @@ -1,5 +1,5 @@ import * as React from "react"; -import { t } from "i18next"; + import { error } from "farmbot-toastr"; import { PeripheralList } from "./peripheral_list"; import { PeripheralForm } from "./peripheral_form"; @@ -10,6 +10,7 @@ import { getArrayStatus } from "../../resources/tagged_resources"; import { saveAll, init } from "../../api/crud"; import { ToolTips } from "../../constants"; import { uniq } from "lodash"; +import { t } from "../../i18next_wrapper"; export class Peripherals extends React.Component { diff --git a/frontend/controls/peripherals/peripheral_form.tsx b/frontend/controls/peripherals/peripheral_form.tsx index 6bb71754c..d0a56c13e 100644 --- a/frontend/controls/peripherals/peripheral_form.tsx +++ b/frontend/controls/peripherals/peripheral_form.tsx @@ -1,9 +1,10 @@ import * as React from "react"; -import { t } from "i18next"; + import { destroy, edit } from "../../api/crud"; import { PeripheralFormProps } from "./interfaces"; import { sortResourcesById } from "../../util"; import { KeyValEditRow } from "../key_val_edit_row"; +import { t } from "../../i18next_wrapper"; export function PeripheralForm(props: PeripheralFormProps) { const { dispatch, peripherals } = props; diff --git a/frontend/controls/peripherals/peripheral_list.tsx b/frontend/controls/peripherals/peripheral_list.tsx index 6c67c1728..8036f0e44 100644 --- a/frontend/controls/peripherals/peripheral_list.tsx +++ b/frontend/controls/peripherals/peripheral_list.tsx @@ -3,7 +3,7 @@ import { pinToggle } from "../../devices/actions"; import { PeripheralListProps } from "./interfaces"; import { sortResourcesById } from "../../util"; import { KeyValShowRow } from "../key_val_show_row"; -import { t } from "i18next"; +import { t } from "../../i18next_wrapper"; export function PeripheralList(props: PeripheralListProps) { const { pins, disabled } = props; diff --git a/frontend/controls/sensor_readings/graph.tsx b/frontend/controls/sensor_readings/graph.tsx index 3674aa0fe..bda6d2ba7 100644 --- a/frontend/controls/sensor_readings/graph.tsx +++ b/frontend/controls/sensor_readings/graph.tsx @@ -1,9 +1,10 @@ import * as React from "react"; import moment from "moment"; import { range, clamp } from "lodash"; -import { t } from "i18next"; + import { SensorReadingPlotProps } from "./interfaces"; import { calcEndOfPeriod } from "./filter_readings"; +import { t } from "../../i18next_wrapper"; /** For SensorReadings plot. */ export const calcTimeParams = (timePeriod: number): { diff --git a/frontend/controls/sensor_readings/location_selection.tsx b/frontend/controls/sensor_readings/location_selection.tsx index d66db53e0..10c8c6dcd 100644 --- a/frontend/controls/sensor_readings/location_selection.tsx +++ b/frontend/controls/sensor_readings/location_selection.tsx @@ -1,12 +1,13 @@ import * as React from "react"; import { Row, Col, BlurableInput } from "../../ui"; -import { t } from "i18next"; + import { AxisInputBoxGroupState } from "../interfaces"; import { Xyz } from "../../devices/interfaces"; import { AxisInputBox } from "../axis_input_box"; import { isNumber } from "lodash"; import { LocationSelectionProps } from "./interfaces"; import { parseIntInput } from "../../util"; +import { t } from "../../i18next_wrapper"; /** Select a location filter for sensor readings. */ export const LocationSelection = diff --git a/frontend/controls/sensor_readings/sensor_readings.tsx b/frontend/controls/sensor_readings/sensor_readings.tsx index 27373b17c..d7651be35 100644 --- a/frontend/controls/sensor_readings/sensor_readings.tsx +++ b/frontend/controls/sensor_readings/sensor_readings.tsx @@ -9,10 +9,11 @@ import { import { LocationSelection, LocationDisplay } from "./location_selection"; import { SensorSelection } from "./sensor_selection"; import { ToolTips } from "../../constants"; -import { t } from "i18next"; + import { TaggedSensor } from "farmbot"; import { AxisInputBoxGroupState } from "../interfaces"; import { SensorReadingsPlot } from "./graph"; +import { t } from "../../i18next_wrapper"; export class SensorReadings extends React.Component { diff --git a/frontend/controls/sensor_readings/sensor_selection.tsx b/frontend/controls/sensor_readings/sensor_selection.tsx index e012a1b2a..3bf86c7d8 100644 --- a/frontend/controls/sensor_readings/sensor_selection.tsx +++ b/frontend/controls/sensor_readings/sensor_selection.tsx @@ -1,8 +1,9 @@ import * as React from "react"; import { FBSelect, DropDownItem } from "../../ui"; -import { t } from "i18next"; + import { TaggedSensor } from "farmbot"; import { SensorSelectionProps } from "./interfaces"; +import { t } from "../../i18next_wrapper"; const ALL_CHOICE: DropDownItem = { label: t("All"), value: "" }; diff --git a/frontend/controls/sensor_readings/table.tsx b/frontend/controls/sensor_readings/table.tsx index 1df7cccff..92531653b 100644 --- a/frontend/controls/sensor_readings/table.tsx +++ b/frontend/controls/sensor_readings/table.tsx @@ -1,9 +1,10 @@ import * as React from "react"; import { SensorReadingsTableProps, TableRowProps } from "./interfaces"; -import { t } from "i18next"; + import { xyzTableEntry } from "../../logs/components/logs_table"; import { formatLogTime } from "../../logs"; import moment from "moment"; +import { t } from "../../i18next_wrapper"; enum TableColWidth { sensor = 125, diff --git a/frontend/controls/sensor_readings/time_period_selection.tsx b/frontend/controls/sensor_readings/time_period_selection.tsx index 1a2b5ac80..7040bab9c 100644 --- a/frontend/controls/sensor_readings/time_period_selection.tsx +++ b/frontend/controls/sensor_readings/time_period_selection.tsx @@ -1,10 +1,11 @@ import * as React from "react"; import { FBSelect, Row, Col, BlurableInput } from "../../ui"; -import { t } from "i18next"; + import moment from "moment"; import { TaggedSensorReading } from "farmbot"; import { TimePeriodSelectionProps, DateDisplayProps } from "./interfaces"; import { cloneDeep } from "lodash"; +import { t } from "../../i18next_wrapper"; /** Look up time period label by seconds. */ const timePeriodLookup = { diff --git a/frontend/controls/sensors/index.tsx b/frontend/controls/sensors/index.tsx index 7f6772804..c570bd1fe 100644 --- a/frontend/controls/sensors/index.tsx +++ b/frontend/controls/sensors/index.tsx @@ -1,5 +1,5 @@ import * as React from "react"; -import { t } from "i18next"; + import { error } from "farmbot-toastr"; import { SensorList } from "./sensor_list"; import { SensorForm } from "./sensor_form"; @@ -10,6 +10,7 @@ import { getArrayStatus } from "../../resources/tagged_resources"; import { saveAll, init } from "../../api/crud"; import { ToolTips } from "../../constants"; import { uniq } from "lodash"; +import { t } from "../../i18next_wrapper"; export class Sensors extends React.Component { constructor(props: SensorsProps) { diff --git a/frontend/controls/sensors/sensor_form.tsx b/frontend/controls/sensors/sensor_form.tsx index bd77a61aa..a9c479c2c 100644 --- a/frontend/controls/sensors/sensor_form.tsx +++ b/frontend/controls/sensors/sensor_form.tsx @@ -1,5 +1,5 @@ import * as React from "react"; -import { t } from "i18next"; + import { destroy, edit } from "../../api/crud"; import { SensorFormProps } from "./interfaces"; import { sortResourcesById } from "../../util"; @@ -8,6 +8,7 @@ import { pinDropdowns } from "../../sequences/step_tiles/pin_and_peripheral_support"; import { PIN_MODES } from "../../sequences/step_tiles/tile_pin_support"; +import { t } from "../../i18next_wrapper"; export function SensorForm(props: SensorFormProps) { const { dispatch, sensors } = props; diff --git a/frontend/controls/sensors/sensor_list.tsx b/frontend/controls/sensors/sensor_list.tsx index 641749b6d..9ea641631 100644 --- a/frontend/controls/sensors/sensor_list.tsx +++ b/frontend/controls/sensors/sensor_list.tsx @@ -3,9 +3,10 @@ import { readPin } from "../../devices/actions"; import { SensorListProps } from "./interfaces"; import { sortResourcesById } from "../../util"; import { Row, Col } from "../../ui"; -import { t } from "i18next"; + import { isNumber } from "lodash"; import { ALLOWED_PIN_MODES } from "farmbot"; +import { t } from "../../i18next_wrapper"; const SensorReadingDisplay = ({ label, value, mode }: diff --git a/frontend/controls/toggle_button.tsx b/frontend/controls/toggle_button.tsx index 9710c3a72..84c0ed5ab 100644 --- a/frontend/controls/toggle_button.tsx +++ b/frontend/controls/toggle_button.tsx @@ -1,6 +1,7 @@ import * as React from "react"; -import { t } from "i18next"; + import { ToggleButtonProps } from "./interfaces"; +import { t } from "../i18next_wrapper"; export class ToggleButton extends React.Component { caption() { diff --git a/frontend/controls/webcam/edit.tsx b/frontend/controls/webcam/edit.tsx index 960cdb3fa..e3cb3e6ee 100644 --- a/frontend/controls/webcam/edit.tsx +++ b/frontend/controls/webcam/edit.tsx @@ -1,11 +1,12 @@ import * as React from "react"; import { Widget, WidgetHeader, WidgetBody } from "../../ui/index"; -import { t } from "i18next"; + import { ToolTips } from "../../constants"; import { WebcamPanelProps } from "./interfaces"; import { KeyValEditRow } from "../key_val_edit_row"; import { SpecialStatus, TaggedWebcamFeed } from "farmbot"; import { sortBy } from "lodash"; +import { t } from "../../i18next_wrapper"; export function sortedFeeds(feeds: TaggedWebcamFeed[]): TaggedWebcamFeed[] { return sortBy(feeds, (f) => { return f.body.id || Infinity; }); diff --git a/frontend/controls/webcam/index.tsx b/frontend/controls/webcam/index.tsx index 5060636ff..f8a88f523 100644 --- a/frontend/controls/webcam/index.tsx +++ b/frontend/controls/webcam/index.tsx @@ -5,8 +5,9 @@ import { WebcamPanelProps } from "./interfaces"; import { TaggedWebcamFeed, SpecialStatus } from "farmbot"; import { edit, save, destroy, init } from "../../api/crud"; import { error } from "farmbot-toastr"; -import { t } from "i18next"; + import { WebcamFeed } from "farmbot/dist/resources/api_resources"; +import { t } from "../../i18next_wrapper"; const HTTP = "http://"; diff --git a/frontend/controls/webcam/show.tsx b/frontend/controls/webcam/show.tsx index 6b23f1516..6a420293b 100644 --- a/frontend/controls/webcam/show.tsx +++ b/frontend/controls/webcam/show.tsx @@ -1,11 +1,12 @@ import * as React from "react"; import { Widget, WidgetHeader, FallbackImg, WidgetBody } from "../../ui/index"; -import { t } from "i18next"; + import { ToolTips } from "../../constants"; import { WebcamPanelProps } from "./interfaces"; import { PLACEHOLDER_FARMBOT } from "../../farmware/images/image_flipper"; import { Flipper } from "./flipper"; import { sortedFeeds } from "./edit"; +import { t } from "../../i18next_wrapper"; type State = { /** Current index in the webcam feed list. diff --git a/frontend/devices/actions.ts b/frontend/devices/actions.ts index 09f0d0566..b4d6ccc6a 100644 --- a/frontend/devices/actions.ts +++ b/frontend/devices/actions.ts @@ -1,4 +1,4 @@ -import { t } from "i18next"; + import axios from "axios"; import { success, warning, info, error } from "farmbot-toastr"; import { getDevice } from "../device"; @@ -23,6 +23,7 @@ import { FbosConfig } from "farmbot/dist/resources/configs/fbos"; import { FirmwareConfig } from "farmbot/dist/resources/configs/firmware"; import { getFirmwareConfig, getFbosConfig } from "../resources/getters"; import { isObject, isString, get, noop } from "lodash"; +import { t } from "../i18next_wrapper"; const ON = 1, OFF = 0; export type ConfigKey = keyof McuParams; diff --git a/frontend/devices/components/diagnostic_dump_row.tsx b/frontend/devices/components/diagnostic_dump_row.tsx index 441fd7659..e272141fe 100644 --- a/frontend/devices/components/diagnostic_dump_row.tsx +++ b/frontend/devices/components/diagnostic_dump_row.tsx @@ -3,7 +3,7 @@ import { Row, Col } from "../../ui"; import { TaggedDiagnosticDump } from "farmbot"; import { destroy } from "../../api/crud"; import { ago } from "../connectivity/status_checks"; -import { t } from "i18next"; +import { t } from "../../i18next_wrapper"; export interface Props { diag: TaggedDiagnosticDump; @@ -20,8 +20,7 @@ export class DiagnosticDumpRow extends React.Component { render() { return - {t("Report {{ticket}} (Saved {{age}})", - { ticket: this.ticket, age: this.age })} + {t("Report {{ticket}} (Saved {{age}})", { ticket: this.ticket, age: this.age })}