modularize and localization
This commit is contained in:
parent
44f550fe92
commit
109ebbf162
7
src/characteristics/characteristicHandler.ts
Normal file
7
src/characteristics/characteristicHandler.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import { Characteristic, CharacteristicGetHandler, CharacteristicSetHandler, WithUUID } from "homebridge";
|
||||
|
||||
export declare interface CharacteristicHandler{
|
||||
characteristic: WithUUID<new () => Characteristic>
|
||||
getCharacteristicHandler?: CharacteristicGetHandler,
|
||||
setCharacteristicHandler?: CharacteristicSetHandler
|
||||
}
|
6
src/defaults.ts
Normal file
6
src/defaults.ts
Normal file
@ -0,0 +1,6 @@
|
||||
import { RobotService } from "./models/services";
|
||||
|
||||
export const BACKGROUND_INTERVAL = 30;
|
||||
export const PREFIX = false;
|
||||
export const ALL_SERVICES = new Set(Object.values(RobotService));
|
||||
export const LOCALE = "en"
|
57
src/localization.ts
Normal file
57
src/localization.ts
Normal file
@ -0,0 +1,57 @@
|
||||
export enum availableLocales {
|
||||
EN = "en",
|
||||
DE = "de",
|
||||
FR = "fr",
|
||||
}
|
||||
|
||||
const localizationDicts = {
|
||||
'en': {
|
||||
"clean": "Clean",
|
||||
"cleanZone": "Clean Zone",
|
||||
"cleanThe": "Clean the",
|
||||
"goToDock": "Go to Dock",
|
||||
"dockState": "Docked",
|
||||
"binFull": "Bin Full",
|
||||
"eco": "Eco Mode",
|
||||
"noGoLines": "NoGo Lines",
|
||||
"extraCare": "Extra Care",
|
||||
"schedule": "Schedule",
|
||||
"findMe": "Find me",
|
||||
"cleanSpot": "Clean Spot",
|
||||
"battery": "Battery"
|
||||
},
|
||||
'de': {
|
||||
"clean": "Sauge",
|
||||
"cleanZone": "Sauge Zone",
|
||||
"cleanThe": "Sauge",
|
||||
"goToDock": "Zur Basis",
|
||||
"dockState": "In der Basis",
|
||||
"binFull": "Behälter voll",
|
||||
"eco": "Eco Modus",
|
||||
"noGoLines": "NoGo Linien",
|
||||
"extraCare": "Extra Care",
|
||||
"schedule": "Zeitplan",
|
||||
"findMe": "Finde mich",
|
||||
"cleanSpot": "Spot Reinigung",
|
||||
"battery": "Batterie"
|
||||
},
|
||||
'fr': {
|
||||
"clean": "Aspirer",
|
||||
"cleanZone": "Aspirer Zone",
|
||||
"cleanThe": "Aspirer",
|
||||
"goToDock": "Retour à la base",
|
||||
"dockState": "Sur la base",
|
||||
"binFull": "Conteneur plein",
|
||||
"eco": "Eco mode",
|
||||
"noGoLines": "Lignes NoGo",
|
||||
"extraCare": "Extra Care",
|
||||
"schedule": "Planifier",
|
||||
"findMe": "Me retrouver",
|
||||
"cleanSpot": "Nettoyage local",
|
||||
"battery": "Batterie"
|
||||
}
|
||||
}
|
||||
|
||||
export function localize(label: string, locale: availableLocales) : string {
|
||||
return localizationDicts[locale][label] ?? label
|
||||
}
|
19
src/models/services.ts
Normal file
19
src/models/services.ts
Normal file
@ -0,0 +1,19 @@
|
||||
export enum CleanType {
|
||||
ALL,
|
||||
SPOT,
|
||||
}
|
||||
|
||||
export enum RobotService {
|
||||
CLEAN = "clean",
|
||||
CLEAN_SPOT = "cleanSpot",
|
||||
CLEAN_ZONE = "cleanZone",
|
||||
GO_TO_DOCK = "goToDock",
|
||||
DOCKED = "dockState",
|
||||
BIN_FULL = "binFull",
|
||||
FIND_ME = "findMe",
|
||||
SCHEDULE = "schedule",
|
||||
ECO = "eco",
|
||||
NOGO_LINES = "noGoLines",
|
||||
EXTRA_CARE = "extraCare",
|
||||
BATTERY = "battery",
|
||||
}
|
Loading…
Reference in New Issue
Block a user