1
0

languageService.js 995 B

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