1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. This forum is for release discussion only. Discussions that do not relate specifically to the resource release should be discussed in another, more appropriate forum.
    Dismiss Notice
  3. This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

[1.0.0 b1] Basic RTL

Discussion in 'Code Modifications [Archive]' started by Msharry, Oct 7, 2010.

  1. Msharry

    Msharry Active Member

    This is just Basic RTL, it will do must of the job.

    Open library/XenForo/CssOutput.php

    Before:
    PHP:
            //rgba translation - only for IE
    Add:
    PHP:
            $output str_replace(array('left','right' ,'ri_ght'), array('ri_ght','left','right'), $output);
            
    $output preg_replace('#(margin|padding):\s?([0-9]+px) ([0-9]+px) ([0-9]+px) ([0-9]+px);#i''\1: \2 \5 \4 \3'$output);
     
    arabic, Nasr, kkm323 and 5 others like this.
  2. siros

    siros Member

    Hi Msharry .


    RTL support should be built-in feature, with out doing any file edits ,


    I tried this code and it did work.


    Thanks for sharing though , I guess no need to rush for us the RTL'ers :p since we won't be using it in a live eviroment until declared stable and I believe most of people won't .
     
  3. Msharry

    Msharry Active Member

  4. siros

    siros Member

    I added it .

    it doesn't look as it should. :(


    I guess I need to play with admincp just to get used to the navigation and some other options there .
     
  5. Omri.L

    Omri.L Active Member

    Fantastic!
    How can I control it only to specific style ?

    Which variable contains the styleid in this function?
     
  6. Msharry

    Msharry Active Member

    Or you can just ignore post #3 if you are using Firefox and right clinking on the page and choose Switch text direction.
     
  7. Msharry

    Msharry Active Member

    You need to do more editing:
    find:
    PHP:
    protected $_styleId 0;
    add after it:
    PHP:
    private static $styleId_ 0;
    find:
    PHP:
            if (!empty($input['d']))
            {
                
    $this->_inputModifiedDate intval($input['d']);
            }
    add after it:
    PHP:
    self::$styleId_ $this->_styleId;
    then use this:
    PHP:
           // 2 is your style Id
           
    if (self::$styleId_ == 2)
            {
                
    $output str_replace(array('left','right' ,'ri_ght'), array('ri_ght','left','right'), $output);
                
    $output preg_replace('#(margin|padding):\s?([0-9]+px)  ([0-9]+px) ([0-9]+px) ([0-9]+px);#i''\1: \2 \5 \4 \3'$output);
            }
    instead of (post#1):
    PHP:
            $output str_replace(array('left','right' ,'ri_ght'), array('ri_ght','left','right'), $output);
            
    $output preg_replace('#(margin|padding):\s?([0-9]+px)  ([0-9]+px) ([0-9]+px) ([0-9]+px);#i''\1: \2 \5 \4 \3'$output);
     
    Traffic likes this.
  8. Omri.L

    Omri.L Active Member

    Firstly, Thanks for giving your time!
    But it doesn't seem to work.

    Before, it worked but on every style. now it doesn't.

    And the style id I need to change is really 2
     
  9. Omri.L

    Omri.L Active Member

    OK, the strangest thing...
    It seem to work now after few tries... I have no clue what causing it not to work sometimes.
    anyways it's perfect now, I just don't have any scroller to navigate the page width, only for down and up
     
  10. Msharry

    Msharry Active Member

    Maybe caching (Control+F5)?!

    Anyway as I said, it just basic, this will break any inline JavaScript CSS, I may need more time to look into it,
     
  11. Omri.L

    Omri.L Active Member

    Ok thanks anyway, it made my forum 80% RTL vaild :)
     
    Msharry likes this.
  12. Apokalupsis

    Apokalupsis Active Member

    What is RTL?
     
  13. g0rn

    g0rn Well-Known Member

    Right-to-left. RTL languages are Arabic, Hebrew and some others.
     
  14. Msharry

    Msharry Active Member

Share This Page