RTL Direction

Discussion in 'XenForo 1 Support' started by N A, Sep 5, 2017.

Tags:
  1. N A

    N A Member

    Hi @Arty,

    My forum main language is English and font direction under Appearance-->Languages is set to the default LTR.

    I am creating a new resource using resource manager, however, I want to force RTL direction on text. I could not find anything inside "Rich Text Editor" that allows me to do that. Only "Alight Right" and "Align Left" but nothing there controls direction ! I was expecting something like this https://www.froala.com/wysiwyg-editor/examples/rtl-ltr-custom-button but no luck !

    I have tried also using "<div class="messageText ugc baseHtml">" to be able to force RTL using HTML
    <h1 dir="rtl" style="text-align: right;">
    RTL text goes here
    </h1>


    but no luck ! It looks like it is not possible to use HTML directly !

    Any suggestions ?

    Thanks in advance.
     
  2. Arty

    Arty Administrator Designer

    Code:
    <div style="direction: rtl; text-align: right"> text goes here </div>
     
  3. N A

    N A Member

    Unfortunately, "Resource Description" accepts only BBcodes. I managed to do this by creating custom BBcode that replaces [rtl]{text}[/rtl] with the above html code and it works fine.

    However, I would like to edit the builtin "Align Right" bbcode to add "direction" tag inside it. So whenever "Align Right" is applied, it would automatically change direction to rtl. This would be better than having a separate bbcode for direction.

    Any idea how to edit/customize builtin BBCodes ?
     
  4. Arty

    Arty Administrator Designer

    I don't think that's possible. Its one of hardcoded bbcodes, not controlled by template.
     
  5. N A

    N A Member

    But this can be edited directly inside the relevant file on the server. any idea which file has the relevant replacement HTML code ?
     
  6. Arty

    Arty Administrator Designer

    See function renderTagAlign in library/XenForo/BbCode/Formatter/Base.php
     
  7. N A

    N A Member

    Thanks Arty...that did the trick.
     
  8. N A

    N A Member

    One more question, is it possible to automatically detect whether it's RTL or LTR language and automatically adjust alignment (Right | Left)? the same exact way Google Docs working ?
     
  9. Arty

    Arty Administrator Designer

    Its not possible with style. Such feature requires modification of XenForo BBCode engine.
     
  10. N A

    N A Member

    Thanks for the hint. could you please direct me where to research more on that?
     
  11. Arty

    Arty Administrator Designer

    I don't know. It would require detecting letters in some way, which I know absolutely nothing about because I'm not familiar with any RTL languages.
     
  12. Dadparvar

    Dadparvar New Member

  13. N A

    N A Member


    That's really helpful....thanks for sharing. Any suggestions how to use it inside XF ?