FrequencyLanguageMap
in package
Maps LWT language names to external frequency/dictionary source codes.
Provides lookups for:
- FrequencyWords project (GitHub) language codes
- Kaikki.org (Wiktextract) language names
- Wiktionary edition codes
Table of Contents
Properties
- $map : array<string, array{freqCode: string, kaikkiName: string, wiktCode: string}>|null
Methods
- getFrequencyCode() : string|null
- Get the FrequencyWords project code (e.g., "es" for Spanish).
- getKaikkiLanguageName() : string|null
- Get the kaikki.org language name (e.g., "Spanish").
- getSupportedLanguages() : array<int, string>
- Get all supported language names.
- getWiktionaryCode() : string|null
- Get the Wiktionary edition code (e.g., "es" for Spanish Wiktionary).
- isSupported() : bool
- Check if starter vocabulary is available for a language.
- reset() : void
- Reset the cached map (for testing).
- load() : array<string, array{freqCode: string, kaikkiName: string, wiktCode: string}>
- Load the language map from the JSON data file.
Properties
$map
private
static array<string, array{freqCode: string, kaikkiName: string, wiktCode: string}>|null
$map
= null
Methods
getFrequencyCode()
Get the FrequencyWords project code (e.g., "es" for Spanish).
public
static getFrequencyCode(string $languageName) : string|null
Parameters
- $languageName : string
Return values
string|nullgetKaikkiLanguageName()
Get the kaikki.org language name (e.g., "Spanish").
public
static getKaikkiLanguageName(string $languageName) : string|null
Parameters
- $languageName : string
Return values
string|nullgetSupportedLanguages()
Get all supported language names.
public
static getSupportedLanguages() : array<int, string>
Return values
array<int, string>getWiktionaryCode()
Get the Wiktionary edition code (e.g., "es" for Spanish Wiktionary).
public
static getWiktionaryCode(string $languageName) : string|null
Parameters
- $languageName : string
Return values
string|nullisSupported()
Check if starter vocabulary is available for a language.
public
static isSupported(string $languageName) : bool
Parameters
- $languageName : string
Return values
boolreset()
Reset the cached map (for testing).
public
static reset() : void
load()
Load the language map from the JSON data file.
private
static load() : array<string, array{freqCode: string, kaikkiName: string, wiktCode: string}>