2022-11-20 14:59:15 -05:00
|
|
|
import { I18n } from "i18n";
|
|
|
|
import { ILocaleConfig } from "../models/spt/config/ILocaleConfig";
|
|
|
|
import { ILogger } from "../models/spt/utils/ILogger";
|
2023-05-18 15:57:25 -04:00
|
|
|
import { DatabaseServer } from "../servers/DatabaseServer";
|
2023-09-02 22:34:11 -04:00
|
|
|
import { RandomUtil } from "../utils/RandomUtil";
|
2022-11-20 14:59:15 -05:00
|
|
|
import { LocaleService } from "./LocaleService";
|
|
|
|
/**
|
|
|
|
* Handles translating server text into different langauges
|
|
|
|
*/
|
|
|
|
export declare class LocalisationService {
|
|
|
|
protected logger: ILogger;
|
2023-09-02 22:34:11 -04:00
|
|
|
protected randomUtil: RandomUtil;
|
2023-05-18 15:57:25 -04:00
|
|
|
protected databaseServer: DatabaseServer;
|
2022-11-20 14:59:15 -05:00
|
|
|
protected localeService: LocaleService;
|
|
|
|
protected localeConfig: ILocaleConfig;
|
|
|
|
protected i18n: I18n;
|
2023-09-02 22:34:11 -04:00
|
|
|
constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, localeService: LocaleService);
|
2022-11-20 14:59:15 -05: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-05-18 15:57:25 -04:00
|
|
|
/**
|
|
|
|
* Get all locale keys
|
|
|
|
* @returns string array of keys
|
|
|
|
*/
|
|
|
|
getKeys(): string[];
|
2023-09-02 22:34:11 -04:00
|
|
|
/**
|
|
|
|
* 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;
|
2022-11-20 14:59:15 -05:00
|
|
|
}
|