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

Handles getting locales from config or users machine

Constructors

new
LocaleService(
logger: ILogger,
databaseServer: DatabaseServer,
configServer: ConfigServer,
)

Properties

protected
configServer: ConfigServer
protected
databaseServer: DatabaseServer
protected
localeConfig: ILocaleConfig
protected
logger: ILogger

Methods

protected
getPlatformForClientLocale(): string

Get the locale of the computer running the server

protected
getPlatformForServerLocale(): string

Get the full locale of the computer running the server lowercased e.g. en-gb / pt-pt

Gets the game locale key from the locale.json file, if value is 'system' get system locale

Gets the game locale key from the locale.json file, if value is 'system' get system locale

getLocaleDb(): Record<string, string>

Get the eft globals db file based on the configured locale in config/locale.json, if not found, fall back to 'en'

getLocaleFallbacks(): { [locale: string]: string; }

Get array of languages supported for localisation

Get array of languages supported for localisation