Skip to content

r3ps4J/i18next-fxserver-language-detector

Repository files navigation

Introduction

npm version

This is a i18next language detection plugin for FXServer. It will detect the languages based on a convar variable. The language detector will fallback to the locale convar when the specified convar is not found or empty.

Getting started

Install the package via npm.

npm install @r3ps4j/i18next-fxserver-language-detector

To make use of the package, import it and load the detector as a module using i18next.use:

import i18next from "i18next";
import LanguageDetector from "@r3ps4j/i18next-fxserver-language-detector";

i18next.use(LanguageDetector).init(i18nextOptions);

Detector options

{
    convar: "i18next_lng", // Defaults to "i18next_lng"
}

Options can be passed in by setting options.detection in i18next.init:

import i18next from "i18next";
import LanguageDetector from "@r3ps4j/i18next-fxserver-language-detector";

i18next.use(LanguageDetector).init({
    detection: options,
});