Skip to:
Content

bbPress.org

Changeset 482


Ignore:
Timestamp:
10/16/2006 06:26:02 PM (19 years ago)
Author:
mdawaffe
Message:

RTL support props Sewar. Fixes #440

Location:
trunk
Files:
5 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/bb-admin/admin-header.php

    r342 r482  
    11<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    2 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php _e('en'); ?>">
     2<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
    33<head>
    44    <title><?php bb_admin_title() ?></title>
    55    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    6     <style type="text/css">
    7      @import url(<?php option('uri'); ?>bb-admin/style.css);
    8     </style>
     6    <link rel="stylesheet" href="<?php option('uri'); ?>bb-admin/style.css" type="text/css" />
     7<?php global $bb_locale; if ( ('rtl' == $bb_locale->text_direction) ) : ?>
     8    <link rel="stylesheet" href="<?php option('uri'); ?>bb-admin/style-rtl.css" type="text/css" />
     9<?php endif; ?>
    910</head>
    1011
  • trunk/bb-includes/functions.php

    r480 r482  
    305305    case 'edit_lock' :
    306306        return $bb->edit_lock;
     307        break;
     308    case 'language':
     309        return str_replace('_', '-', get_locale());
     310        break;
     311    case 'text_direction':
     312        global $bb_locale;
     313        return $bb_locale->text_direction;
    307314        break;
    308315    case 'version' :
     
    14351442
    14361443function bb_die($message, $title = '') {
     1444    global $bb_locale;
     1445
    14371446    header('Content-Type: text/html; charset=utf-8');
    14381447
     
    14411450?>
    14421451<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    1443 <html xmlns="http://www.w3.org/1999/xhtml">
     1452<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
    14441453<head>
    14451454    <title><?php echo $title ?></title>
    14461455    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    1447     <style media="screen" type="text/css">
    1448     <!--
    1449     html {
    1450         background: #eee;
    1451     }
    1452     body {
    1453         background: #fff;
    1454         color: #000;
    1455         font-family: Georgia, "Times New Roman", Times, serif;
    1456         margin-left: 25%;
    1457         margin-right: 25%;
    1458         padding: .2em 2em;
    1459     }
    1460 
    1461     h1 {
    1462         color: #060;
    1463         font-size: 18px;
    1464         font-weight: lighter;
    1465     }
    1466 
    1467     h2 {
    1468         font-size: 16px;
    1469     }
    1470 
    1471     p, li, dt {
    1472         line-height: 140%;
    1473         padding-bottom: 2px;
    1474     }
    1475 
    1476     ul, ol {
    1477         padding: 5px 5px 5px 20px;
    1478     }
    1479     #logo {
    1480         margin-bottom: 2em;
    1481     }
    1482     -->
    1483     </style>
     1456    <link rel="stylesheet" href="<?php option('uri'); ?>bb-admin/install.css" type="text/css" />
     1457<?php if ( ('rtl' == $bb_locale->text_direction) ) : ?>
     1458    <link rel="stylesheet" href="<?php option('uri'); ?>bb-admin/install-rtl.css" type="text/css" />
     1459<?php endif; ?>
    14841460</head>
    14851461<body>
  • trunk/bb-includes/l10n.php

    r465 r482  
    66        return $locale;
    77
    8     // WPLANG is defined in wp-config.
    9     if (defined('WPLANG'))
    10         $locale = WPLANG;
     8    // BBLANG is defined in config.php
     9    if (defined('BBLANG'))
     10        $locale = BBLANG;
    1111
    1212    if (empty($locale))
     
    7070
    7171    $locale = get_locale();
    72     $mofile = ABSPATH . BBLANGDIR . "/$locale.mo";
     72    $mofile = BBPATH . BBLANGDIR . "/$locale.mo";
    7373
    7474    load_textdomain('default', $mofile);
     
    8080        $path = BBPLUGINDIR;
    8181
    82     $mofile = ABSPATH . "$path/$domain-$locale.mo";
     82    $mofile = BBPATH . "$path/$domain-$locale.mo";
    8383    load_textdomain($domain, $mofile);
    8484}
  • trunk/bb-includes/template-functions.php

    r480 r482  
    1010}
    1111
    12 function bb_stylesheet_uri() {
     12function language_attributes() {
     13    $output = '';
     14    if ( $dir = bb_get_option('text_direction') )
     15        $output = "dir=\"$dir\"";
     16    if ( $lang = bb_get_option('language') ) {
     17        if ( $dir ) $output .= ' ';
     18        $output .= "lang=\"$lang\" xml:lang=\"$lang\"";
     19    }
     20
     21    echo $output;
     22}
     23
     24function bb_stylesheet_uri( $stylesheet = '' ) {
     25    echo bb_get_stylesheet_uri( $stylesheet );
     26}
     27
     28function bb_get_stylesheet_uri( $stylesheet = '' ) {
     29    if ( 'rtl' == $stylesheet )
     30        $css_file = 'style-rtl.css';
     31    else
     32        $css_file = 'style.css';
     33
    1334    if ( file_exists( BBPATH . 'my-templates/style.css') )
    14         echo bb_get_option('uri') . 'my-templates/style.css';
    15     else
    16         echo bb_get_option('uri') . 'bb-templates/style.css';
     35        $r = bb_get_option('uri') . 'my-templates/' . $css_file;
     36    else
     37        $r = bb_get_option('uri') . 'bb-templates/' . $css_file;
     38    return apply_filters( 'bb_get_stylesheet_uri', $r, $stylesheet );
    1739}
    1840
  • trunk/bb-settings.php

    r470 r482  
    6666require( BBPATH . BBINC . '/deprecated.php');
    6767require( BBPATH . BBINC . '/wp-functions.php');
     68if ( defined('BBLANG') && '' != constant('BBLANG') ) {
     69    include_once(BBPATH . BBINC . '/streams.php');
     70    include_once(BBPATH . BBINC . '/gettext.php');
     71}
    6872if ( !( defined('WP_BB') && WP_BB ) ) {  // Don't include these when WP is running.
    6973    require( BBPATH . BBINC . '/kses.php');
    70     if ( defined('WPLANG') && '' != constant('WPLANG') ) {
    71         include_once(BBPATH . BBINC . '/streams.php');
    72         include_once(BBPATH . BBINC . '/gettext.php');
    73     }
    7474    require( BBPATH . BBINC . '/l10n.php');
    7575}
     
    129129$bb_cache = new BB_Cache();
    130130
    131 $bb_roles = new BB_Roles();
     131// Load the default text localization domain.
     132load_default_textdomain();
     133
     134// Pull in locale data after loading text domain.
     135require_once(BBPATH . BBINC . '/locale.php');
     136$bb_locale = new BB_Locale();
     137
     138$bb_roles  = new BB_Roles();
    132139do_action('bb_got_roles', '');
    133140
  • trunk/bb-templates/header.php

    r461 r482  
    11<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    2 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php _e('en'); ?>">
     2<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
    33<head>
    44    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     
    66    <?php bb_feed_head(); ?>
    77    <link rel="stylesheet" href="<?php bb_stylesheet_uri(); ?>" type="text/css" />
     8<?php global $bb_locale; if ( ('rtl' == $bb_locale->text_direction) ) : ?>
     9    <link rel="stylesheet" href="<?php bb_stylesheet_uri( 'rtl' ); ?>" type="text/css" />
     10<?php endif; ?>
    811
    912<?php if ( is_topic() && bb_is_user_logged_in() ) : ?>
  • trunk/config-sample.php

    r481 r482  
    3535$bb->gmt_offset = 0;
    3636
     37// Change this to localize bbPress.  A corresponding MO file for the
     38// chosen language must be installed to bb-includes/languages.
     39// For example, install de.mo to bb-includes/languages and set BBLANG to 'de'
     40// to enable German language support.
     41define('BBLANG', '');
     42
    3743// Your Akismet Key.  You do not need a key to run bbPress, but if you want to take advantage
    3844// of Akismet's powerful spam blocking, you'll need one.  You can get an Akismet key at
Note: See TracChangeset for help on using the changeset viewer.