1
0

languageService.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import Lexers from './../../grammar/';
  2. import line_i18n from 'line-i18n';
  3. import { Config } from "./../util/config";
  4. class LanguageServiceExtended extends line_i18n.LanguageServiceNoLS {
  5. constructor () {
  6. super(typeof(iLMparameters) === 'undefined' ? Config.default_lang : iLMparameters.lang);
  7. }
  8. getDefaultLang () {
  9. return "pt";
  10. }
  11. getCurrentLexer () {
  12. const langInfo = Lexers[this.getLang()];
  13. if(langInfo === null || langInfo === undefined) {
  14. return Lexers[this.getDefaultLang()].lexer;
  15. } else {
  16. return langInfo.lexer;
  17. }
  18. }
  19. getCurrentLangFuncs () {
  20. const langInfo = Lexers[this.getLang()];
  21. if(langInfo === null || langInfo === undefined) {
  22. return Lexers[this.getDefaultLang()].langFuncs;
  23. } else {
  24. return langInfo.langFuncs;
  25. }
  26. }
  27. getCurrentLangLibs () {
  28. const langInfo = Lexers[this.getLang()];
  29. if(langInfo === null || langInfo === undefined) {
  30. return Lexers[this.getDefaultLang()].langLibs;
  31. }
  32. return langInfo.langLibs;
  33. }
  34. }
  35. export const LanguageService = new LanguageServiceExtended();