Open fadhleryani opened 3 months ago
This is currently not yet possible, unfortunately.
If you want to take a stab at implementing this, here's a way to go about it:
textDirection
setting should (by convention) be indexed with a metadata field named textDirection
. So e.g. if you corpus is set to ltr
, documents that are right-to-left should have the textDirection
metadata field set to rtl
. (it would be fine to give all documents a textDirection
metadata field, of course)corpus-frontend
would need to be updated to also look for the textDirection
metadata field when displaying hits and documents and use that to set the correct text-direction
per hit (currently it is set for the entire table of hits).If you have any more questions, don't hesitate to ask.
Hi Jan thanks for your quick reply!
A main issue is actually with the "After Hit Hit Before Hit" order in the table. I'm imaginining I could rename the columns to "Context.. Hit ..Context" and have the text appear from the correct direction based on the metadata. Any pointers on how I might be able to do that?
Have a look at HitsTable.vue.
For the table headings, you can customize the text via custom locale files, see here. Create a file e.g. $corporaInterfaceDataDir/MyCorpus/static/locales/en-us.json
containing:
{
"results": {
"table": {
"before": "context",
"after": "context"
}
}
}
For the direction the hit is displayed in, right now, the dir
property is passed to the Hit
component from HitsTable
(line 90). You want to add a dir(h)
method that determines the correct direction for the current hit based on h.doc.docInfo.textDirection
(the metadata field to index with the doc).
Good luck and please submit a PR, we'd be happy to have a look and merge it if possible.
I managed to create the method and pass the direction from metadata, but this only results in changing the placement of the dots '...'
What I would like is for the columns to be switched.
Also I noticed that regardless of whether or not I set textDirection: 'rtl' in the blf format file, the order of the HitContextComponent inside the HitRowDetails is always off for my rtl texts, and are fine for the ltr.
It's difficult for me to help without knowing your data, .blf.yaml and changes to corpus-frontend.
If you have your own clone of BlackLab on GitHub, you can easily create a (draft) pull request here with your changes so far, so I can have a look.
Please also upload a toy example data file, ideally 2 small docs, one rtl and one ltr, as well as your .blf.yaml
file. Then I can index it and view it in your corpus-frontend version and have a better idea of what's happening.
Woops, that wasn't mean to close the issue!
I did find and fix (quite a few! 😮) bugs relating to rtl rendering.
Though I cannot read Arabic, so it is difficult to verify correctness. If you could take another look with the latest dev
that would be great!
I understand you can switch the direction of the entire corpus interface in the
corpusConfig
setting in the ..format.blf file, but is it possible to customize things for this to work on the document level?For reference, my corpus has multiple gloss features which exist for both the Arabic and English documents, and I've enabled
multipleValues
annotation, so the search returns the expected documents, but the direction is reversed for one of the languages which makes the interface unusable.