dokuwiki
dokuwiki copied to clipboard
Added support for RTL text in an LTR blog
Self explanatory.
I am unsure where details.php is being used. But if it's used for the same format, we'll have to apply the same modification there too.
Sorry this is far from self explanatory. Can you please provide details on what exactly this fixes and why it's necessary?
@splitbrain - apologies for being unclear.
As the title suggest, this PR is adding support for RTL text.
More details: dir="auto"
helps browser to set the content in the correct direction. You can try the following text as your page content:
صفحه
متن متن متن متن متن متن متن متن متن متن متن
متن متن متن متن متن متن
متن متن
متن متن متن متن متن متن متن متن
Without this PR, it gets rendered left aligned (similar to how Github renders it here).
After this change, this is how it gets rendered:
By setting https://www.dokuwiki.org/config:lang the ltr and rtl are swopped as well. The direction is available as dir attribute to the html element. See e.g. https://codesearch.dokuwiki.org/xref/dokuwiki/lib/tpl/dokuwiki/main.php#16
How is this dir=auto combining with existing one?
Sure, but that's a global config, right? It applies to the entire side.
The change proposed in this PR is to address a case where the site is LTR but one (or some) posts are in RTL language.
The screenshot above is in an example of that - where the site is LTR, but this single post is in RTL language.
Regarding this question:
How is this dir=auto combining with existing one?
Like I said above, if the site is in English, but one post is in an RTL language, this change would cover it.
I haven't tried the reverse, but I assume it is the same. i.e., dir="auto"
would left align an English post in and RTL site.
Although dir=auto
helps somewhat in that case, it would be better (for translation services, like Google Translate, and screenreaders) if you set the correct lang
as well. You can do that with the Wrap plugin via <WRAP :fa>متن متن متن</WRAP>
.
That will translate into <div lang="fa" dir="rtl" [...]>متن متن متن</div>
.
Interesting. Wasn't aware of this sorcery.
I still believe dir="auto" is no harm, and it's the way to go as it automatically handles these cases without manual intervention.
But if the community thinks otherwise, feel free to close the PR as there is an alternative solution using WRAP
to fix this issue.
I don't think it does any harm either.
If you have whole pages in other languages, you could also use the Translation plugin. That can change the whole page's language (and dir
) as well (via the translateui
setting).
I thought it would change lang
and dir
on the main content if it is not set to change the whole page's language, but I just checked and noticed that it doesn't do that. I will open an issue for that.