[liblouis-liblouisxml] Re: Problems with using the JS-build of Liblouis

  • From: Bert Frees <bertfrees@xxxxxxxxx>
  • To: liblouis-liblouisxml@xxxxxxxxxxxxx
  • Date: Mon, 15 Feb 2021 13:48:30 +0100

Hello Andrey,

I've only used the JS bindings in one application, and that application
calls Liblouis within a web worker. I can't really say anything about other
setups.

My application works with Firefox, but not with other browsers. If I
remember correctly there was an issue with handling "include" rules. It
could well be that you are facing the same issue here. Can you test it with
Firefox?

So basically, the JS bindings are currently broken, and I don't know how to
fix them. Reiner Dolp, the person who created the project, has moved on to
other projects.

Bert


Op za 23 jan. 2021 om 23:26 schreef Андрей Якубой <andrewia2002@xxxxxxxxx>:

Hello!

I'm trying to use the JS-build of Liblouis in my WEB-application (in
html-file). I've grabbed the build here:
https://github.com/liblouis/js-build
And than I've copyed there easy-api.js from the main Javascript-Liblouis
repo.

But I have two problems:
Firstly, if I add the Liblouis-scripts in the 'head' section and than
try to use it in the 'body' one, I get the message: "liblouis is not
defined".
```
<head>
<script src="build-no-tables-utf32.js"></script>
     <script src="easy-api.js"></script>
</head>
<body>
alert(liblouis.version());
</body>
```
But I have the second problem even if liblouis is defined (when I add
and use it in the same section): When I try to translate string:
```
document.write(liblouis.translateString("unicode.dis,ru-litbrl.ctb",
"Тестовая строка"));
```
This returns "null" And such message in console:
easy-api.js:520 [ERROR] unicode.dis,ru-litbrl.ctb could not be compiled
Although I'm sure that these tables works correct and don't contains
mistakes.

Can anybody explaine me what do I do wrong?

Many thanks.

Other related posts: