Show the article in RTL mode if the target language is hebrew (patch by dmdmdm)

Some refinements done by ikm.
This commit is contained in:
Konstantin Isakov 2009-12-27 15:40:20 +03:00
parent 689859082c
commit d431321f3d
2 changed files with 19 additions and 3 deletions

View file

@ -70,6 +70,13 @@ pre
* therefore hidden */ * therefore hidden */
.bglpos { display: none; } .bglpos { display: none; }
/* Right-to-left text */
.bglrtl
{
text-align: right;
direction: rtl;
}
/******** StarDict dictionaries' classes *********/ /******** StarDict dictionaries' classes *********/

View file

@ -9,6 +9,7 @@
#include "utf8.hh" #include "utf8.hh"
#include "chunkedstorage.hh" #include "chunkedstorage.hh"
#include "langcoder.hh" #include "langcoder.hh"
#include "language.hh"
#include <map> #include <map>
#include <set> #include <set>
@ -641,21 +642,29 @@ void BglArticleRequest::run()
"</b></b></b></b></b></b></b></b>" "</b></b></b></b></b></b></b></b>"
"</i></i></i></i></i></i></i></i>"; "</i></i></i></i></i></i></i></i>";
static Language::Id hebrew = LangCoder::code2toInt( "he" );
for( i = mainArticles.begin(); i != mainArticles.end(); ++i ) for( i = mainArticles.begin(); i != mainArticles.end(); ++i )
{ {
result += "<h3>"; result += "<h3>";
result += postfixToSuperscript( i->second.first ); result += postfixToSuperscript( i->second.first );
result += "</h3>"; result += "</h3>";
result += i->second.second; if ( dict.idxHeader.langTo == hebrew )
result += "<div class=\"bglrtl\">" + i->second.second + "</div>";
else
result += i->second.second ;
result += cleaner; result += cleaner;
} }
for( i = alternateArticles.begin(); i != alternateArticles.end(); ++i ) for( i = alternateArticles.begin(); i != alternateArticles.end(); ++i )
{ {
result += "<h3>"; result += "<h3>";
result += postfixToSuperscript( i->second.first ); result += postfixToSuperscript( i->second.first );
result += "</h3>"; result += "</h3>";
result += i->second.second; if ( dict.idxHeader.langTo == hebrew )
result += "<div class=\"bglrtl\">" + i->second.second + "</div>";
else
result += i->second.second ;
result += cleaner; result += cleaner;
} }
// Do some cleanups in the text // Do some cleanups in the text