import { Lang } from '../../services' ; export enum LangCode { EN_US = 'en-US' , EN_PIRATE = 'en-Pirate' } export class Language { public static keyword ( langCode ) { return Lang . getRef ( 'meta.language' , langCode ) ; } public static regex ( langCode ) { return Lang . getRegex ( 'metaRegexes.language' , langCode ) ; } public static displayName ( langCode ) { return Lang . getRef ( 'meta.languageDisplay' , langCode ) ; } public static locale ( langCode ) { return Lang . getRef ( 'meta.locale' , langCode ) ; } public static translators ( langCode ) { return Lang . getRef ( 'meta.translators' , langCode ) ; } public static find ( input ) { for ( let langCode of Object . values ( LangCode ) ) { if ( this . regex ( langCode ) . test ( input ) ) { return langCode ; } } } public static list ( ) { return Object . values ( LangCode ) . map ( langCode => { return Lang . getRef ( 'lists.languageItem' , langCode , { LANGUAGE_NAME : this . displayName ( langCode ) , LANGUAGE_KEYWORD : this . keyword ( langCode ) , } ) ; } ) . join ( '\n' ) . trim ( ) ; } }