I have created and am distributing a Calc extension for sorting Lao language wordlists since the standard LO sort (following Thai) is incorrect for Lao. I have included a link to a help file on my website but would prefer to embed it within the extension. Can someone advise where I can find out how to do that? The extension mainly uses JavaScript (since sorting is then about ten times faster than the original version which used only Basic and textSearch RegEx) but including a help file should presumably not depend directly on the script type
Thank you…
Unfortunately, I can’t answer the question. However, with regards to the preamble:
Why not fix Lao in LibreOffice directly? Is there a bug report? And maybe you need some assistance preparing a proper fix as a patch to LibreOffice? Me or @erAck could help with that.
Thanks Mike for your reply - would still like a solution to the question, though!
“Why not fix Lao in LO directly?” I am open to doing that, but would need considerable assistance, since I assume that it would need Java programming which I am not familiar with, as well as a good understanding of LO interfaces.
However, I am not sure if it is feasible. The usual method of sorting text is to define an appropriate comparison routine that can be integrated into a general sorting algorithm, but this is very slow for correct Lao alphabetization due to the complex text processing that is needed to convert the stored character sequence into a correctly ordered phonetic sequence. (None of the major platforms sort Lao correctly, all just use the approach taken for Thai, which is far simpler to code. That also possibly explains why LO’s sorting of Lao would not be reported as a bug.)
The most efficient way I have found for sorting Lao (and over the past twenty or so years I have written sorting code in C, vb.net, VBA, LO Basic and now JavaScript) is to use a large array of regular expressions to identify syllables and parse them into phonetic components. This can be done efficiently if a large array of strings is processed together but if all the regular expressions need to be re-initialized for every call, it is far too slow. Native UNO textSearch RegEx (called from LO Basic) also results in very slow sorting, which is why I am now using JavaScript. (I tried Python first, but their regex syntax differed and did not seem much faster than textSearch. Using vbScript.RegExp was much faster, but that is platform dependent. The JS implementation is much faster than any other coding language I have tried, and comparable to the equivalent VBA code used for Excel.)
But it may be possible to adapt the code I have used if a common initialization can be invoked before starting the actual sorting. If you think this might be useful, please point me to the appropriate documentation needed to add and integrate such sorting into my installed LO which I can test and evaluate before submitting a patch.
You (or anyone reading this forum) can look at the existing extension code by downloading SortLao-1.2.0.oxt (from the link on LaoScript for Windows Downloads) and either installing it or unpacking the extension file directly. I would welcome any comments, especially on the manifest contents, since I have not found any documentation for or examples of extensions with Basic macros calling JavaScript, and am not at all sure I have it all right. I have tested it on both Windows and macOS, but not on Linux.
No, C++. See the developers page for how to start with development. However, collation (“sort” order) is done using ICU so if that’s wrong for Lao then the best would be to contribute there. Collation tables can be tailored in LibreOffice and are for some languages, but if that’s getting complicated it’s rather to be avoided. There’s no Thai or Lao specific override in LibreOffice, so ICU defaults are taken. See also ICU collation docs.
Thank you very much for your reply. Glad to read that LO uses ICU for Thai and Lao, as I was already wondering about contributing to ICU and will now look into that, as well as (possibly) a C++ patch for LO. But as I wrote, sorting Lao correctly needs more than easily be done with collation tables.
Hello…
See attach file example with your extension. Include help PDF.
I only test in Linux, please, test in Windows.
Remove ODS ext.
test.oxt.ods (121.9 KB)
Thank you Mauricio - that was exactly what I was looking for. And yes, it works fine on both Windows and macOS. It’s great to have such swift and appropriate help from the forum (unlike some other forums I have used)!