12345678910111213141516171819202122232425262728293031323334353637383940 |
- import Lexers from './../../grammar/';
- import line_i18n from 'line-i18n';
- // This is for LanguageService with localStorage
- const DEFAULT_LANG = "pt";
- class LanguageServiceExtended extends line_i18n.LanguageServiceNoLS {
- constructor () {
- super(DEFAULT_LANG);
- }
- getCurrentLexer () {
- const langInfo = Lexers[this.getLang()];
- if(langInfo === null || langInfo === undefined) {
- return Lexers[this.getDefaultLang()].lexer;
- } else {
- return langInfo.lexer;
- }
- }
- getCurrentLangFuncs () {
- const langInfo = Lexers[this.getLang()];
- if(langInfo === null || langInfo === undefined) {
- return Lexers[this.getDefaultLang()].langFuncs;
- } else {
- return langInfo.langFuncs;
- }
- }
- getCurrentLangLibs () {
- const langInfo = Lexers[this.getLang()];
- if(langInfo === null || langInfo === undefined) {
- return Lexers[this.getDefaultLang()].langLibs;
- }
- return langInfo.langLibs;
- }
- }
- export const LanguageService = new LanguageServiceExtended();
|