Skip to main content
The Deno 2 Release Candidate is here
Learn more
class LocalisationService
Re-export
import { LocalisationService } from "https://deno.land/x/sptaki@1.2.0/services/mod.ts";

Handles translating server text into different langauges

Constructors

new
LocalisationService(
logger: ILogger,
randomUtil: RandomUtil,
databaseServer: DatabaseServer,
localeService: LocaleService,
)

Properties

protected
databaseServer: DatabaseServer
protected
i18n: I18n
protected
localeService: LocaleService
protected
logger: ILogger
protected
randomUtil: RandomUtil

Methods

getKeys(): string[]

Get all locale keys

getRandomTextThatMatchesPartialKey(partialKey: string): string

From the provided partial key, find all keys that start with text and choose a random match

getText(key: string, args?: any): string

Get a localised value using the passed in key