[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Fwd: Re: KDE3, (finally) bidi support
From:       Matthias Kalle Dalheimer <kalle () klaralvdalens-datakonsult ! se>
Date:       2001-10-22 5:45:31
[Download RAW message or body]



----------  Forwarded Message  ----------

Subject: Re: KDE3, (finally) bidi support
Date: Mon, 22 Oct 2001 01:29:41 +0200
From: "Diego G. Iastrubni" <iastrubn@012.net.il>
To: Meni Livne <livne@kde.org>
Cc: Kalle Dalheimer<kalle@kde.org>

There are a lot of holes on the translation and a lot "mirred" hebrew words
in kcontrol for example. ( meni: you have a lot of work dud...).

Anyway: to make QT and KDE program look better using an hebrew /arabic/some
other bidi lenguage interface you should run for example:
kmail -reverse.
    -reverse will call in QAppication::QApplication to
QApplication:SetReversedLayout(true), wich will make a more native look for
QT applications. My idea is to make in klocale a new part, which will be
hoding the "global reverse layot status", if it is true all applications will
be mirrorws (RTL), this can be done in KApplication. When a kde application
is called -reverse, and GloabelReverseLayot=true,it will be mirroed again to
LTR.  On the kdeglogalrc (or something like this...) :
    [Locale]
    ReversedLayot=true
There can be another solution if no kconfig file is used, and this can be
using a KDE_BIDI, or KDE_REVERSED_LAYOT system enviroment.

here is a small patch (simply add this to the existing code)

<klocale.h>
  /*  dgi code */
public:
  friend class KGlobal; // for initInstance()
  /**
   * Retrives if the user prefears reverse layot globaly.
   * dgi_il
   */
   bool globalReverseLayot() const;

  /**
   * If you are using an hebrew/arabic display
   * you shoud change it to TRUE
   *
   * @return True on success. always... ;)
   */
  bool setGlobalReverseLayot(const bool enabled);

 /**
   * @internal Init the localization part of the instance with the config
   * object.
   *
   * @param config The configuration object used for init.
   */
  void initReverseLayot(KConfig *config);

private:
   bool m_globalReverseLayot; // bidisupport!!!
</klocale.h>

<klocale.cpp>
/**
  * Retrives if the user prefears reverse layot globaly.
  * dgi_il
  */
bool KLocale::setGlobalReverseLayot(const bool enabled)
{
  m_globalReverseLayot = enabled;

  return true;
}

bool KLocale::globalReverseLayot() const
{
  return m_globalReverseLayot;
}

 /**
   * @internal Init the localization part of the instance with the config
   * object.
   *
   * @param config The configuration object used for init.
   */

#define KEY_REVERSED_LAYOUT "ReversedLayot"

void KLocale::initReverseLayot(KConfig *config)
{
  KConfigGroupSaver saver(config, "Locale");
  config->setGroup( "Locale" );

  if ( config->hasKey( KEY_REVERSED_LAYOUT )) {
     bool tmp = config->readBoolEntry( KEY_REVERSED_LAYOUT );
     setGlobalReverseLayot( tmp );
     if (tmp==true)
       kdWarning(173) << "Using reversed layout (hebrew - RTL)" << endl;
     else
       kdWarning(173) << "Using NOT reversed layout (normal - LTR)" << endl;
  }
  else {
     QString bidi;

     bidi = getenv("KDE_BIDI");
     kbWarning(173) << "KDE_BIDI = " << bidi << endl;

     if ((bidi=="yes") || (bidi=="true") || (bidi=="on")){
       kdWarning(173) << "Using RTL layout, from enviroment" << endl;
       setGlobalReverseLayot( true );
     }

  }
}
</klocale.cpp>

<kapplication>
somwhere in KApplication ::init()...
    if (KGlobal::locale()->globalReverseLayot() == true)
      setReverseLayout ( true );
</kapplication>

this code has some bugs, in klocale::initReveredLayout, it does not read from
the configfile, and not from the enviroment, but I am sure that it can be
fixed :)

next part is in kde-control-centre in locale have a check box that enables
it. And when the user chooses Arabic-speaking or Hebrew speaking locale, it
will automagicly enabled.

You will see some bugs, expecially in menus, this is a QT bug (even in the
fianel 3.0) and in the shortcuts. Well A full report is comming from me to
lars@trolltech.com.

 - diego

-------------------------------------------------------

-- 
Matthias Kalle Dalheimer
President & CEO Klarälvdalens Datakonsult AB
Platform-independent Software Solutions
http://www.klaralvdalens-datakonsult.se

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic