1
0

languageService.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. 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 = new LanguageServiceExtended();