All files / src/config locales.ts

100% Statements 2/2
100% Branches 0/0
100% Functions 0/0
100% Lines 2/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59                        2x                                                                   2x                        
/**
 * @copyright nhcarrigan
 * @license Naomi's Public License
 * @author Naomi Carrigan
 */
 
import { Locale } from "discord.js";
 
/**
 * List of locales that LibreTranslate supports. This is a mix of
 * Discord locales and mapped values.
 */
const supportedLocales: Array<string> = [
  Locale.Indonesian,
  "en",
  Locale.Bulgarian,
  "zh",
  "zt",
  Locale.Czech,
  Locale.Danish,
  Locale.Dutch,
  Locale.Finnish,
  Locale.French,
  Locale.German,
  Locale.Greek,
  Locale.Hindi,
  Locale.Hungarian,
  Locale.Italian,
  Locale.Japanese,
  Locale.Korean,
  Locale.Lithuanian,
  Locale.Polish,
  "pt",
  Locale.Romanian,
  Locale.Russian,
  "es",
  "sv",
  Locale.Thai,
  Locale.Turkish,
  Locale.Ukrainian,
];
 
/**
 * Maps a Discord locale string to the corresponding LibreTranslate
 * locale when they are different.
 */
const mappedLocales: Partial<Record<Locale, string>> = {
  [Locale.EnglishGB]:    "en",
  [Locale.EnglishUS]:    "en",
  [Locale.ChineseCN]:    "zh",
  [Locale.ChineseTW]:    "zt",
  [Locale.PortugueseBR]: "pt",
  [Locale.SpanishES]:    "es",
  [Locale.SpanishLATAM]: "es",
  [Locale.Swedish]:      "sv",
};
 
export { supportedLocales, mappedLocales };