eyes-of-a-trader/types/services/LocalisationService.d.ts

37 lines
1.3 KiB
TypeScript
Raw Normal View History

2023-01-15 09:44:31 +11:00
import { I18n } from "i18n";
import { ILocaleConfig } from "../models/spt/config/ILocaleConfig";
import { ILogger } from "../models/spt/utils/ILogger";
2023-10-09 20:08:53 +11:00
import { DatabaseServer } from "../servers/DatabaseServer";
import { RandomUtil } from "../utils/RandomUtil";
2023-01-15 09:44:31 +11:00
import { LocaleService } from "./LocaleService";
/**
* Handles translating server text into different langauges
*/
export declare class LocalisationService {
protected logger: ILogger;
2023-10-09 20:08:53 +11:00
protected randomUtil: RandomUtil;
protected databaseServer: DatabaseServer;
2023-01-15 09:44:31 +11:00
protected localeService: LocaleService;
protected localeConfig: ILocaleConfig;
protected i18n: I18n;
2023-10-09 20:08:53 +11:00
constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, localeService: LocaleService);
2023-01-15 09:44:31 +11:00
/**
* Get a localised value using the passed in key
* @param key Key to loop up locale for
* @param args optional arguments
* @returns Localised string
*/
getText(key: string, args?: any): string;
2023-10-09 20:08:53 +11:00
/**
* Get all locale keys
* @returns string array of keys
*/
getKeys(): string[];
/**
* From the provided partial key, find all keys that start with text and choose a random match
* @param partialKey Key to match locale keys on
* @returns locale text
*/
getRandomTextThatMatchesPartialKey(partialKey: string): string;
2023-01-15 09:44:31 +11:00
}