Greek transliteration by Jennie Petoumenou.

This commit is contained in:
Konstantin Isakov 2010-05-29 13:22:08 +04:00
parent d59fb9e568
commit 2b557e7f4b
8 changed files with 744 additions and 37 deletions

View file

@ -416,6 +416,9 @@ Class load() throw( exError )
applyBoolOption( c.transliteration.enableGermanTransliteration, applyBoolOption( c.transliteration.enableGermanTransliteration,
transliteration.namedItem( "enableGermanTransliteration" ) ); transliteration.namedItem( "enableGermanTransliteration" ) );
applyBoolOption( c.transliteration.enableGreekTransliteration,
transliteration.namedItem( "enableGreekTransliteration" ) );
QDomNode romaji = transliteration.namedItem( "romaji" ); QDomNode romaji = transliteration.namedItem( "romaji" );
if ( !romaji.isNull() ) if ( !romaji.isNull() )
@ -743,6 +746,12 @@ void save( Class const & c ) throw( exError )
opt.appendChild( dd.createTextNode( c.transliteration.enableGermanTransliteration ? "1":"0" ) ); opt.appendChild( dd.createTextNode( c.transliteration.enableGermanTransliteration ? "1":"0" ) );
transliteration.appendChild( opt ); transliteration.appendChild( opt );
// Greek translit
opt = dd.createElement( "enableGreekTransliteration" );
opt.appendChild( dd.createTextNode( c.transliteration.enableGreekTransliteration ? "1":"0" ) );
transliteration.appendChild( opt );
// Romaji // Romaji
QDomElement romaji = dd.createElement( "romaji" ); QDomElement romaji = dd.createElement( "romaji" );

View file

@ -258,12 +258,14 @@ struct Transliteration
{ {
bool enableRussianTransliteration; bool enableRussianTransliteration;
bool enableGermanTransliteration; bool enableGermanTransliteration;
bool enableGreekTransliteration;
Romaji romaji; Romaji romaji;
bool operator == ( Transliteration const & other ) const bool operator == ( Transliteration const & other ) const
{ return enableRussianTransliteration == other.enableRussianTransliteration && { return enableRussianTransliteration == other.enableRussianTransliteration &&
romaji == other.romaji && romaji == other.romaji &&
enableGermanTransliteration == other.enableGermanTransliteration; enableGermanTransliteration == other.enableGermanTransliteration &&
enableGreekTransliteration == other.enableGreekTransliteration;
} }
bool operator != ( Transliteration const & other ) const bool operator != ( Transliteration const & other ) const
@ -271,7 +273,8 @@ struct Transliteration
Transliteration(): Transliteration():
enableRussianTransliteration( false ), enableRussianTransliteration( false ),
enableGermanTransliteration( false ) enableGermanTransliteration( false ),
enableGreekTransliteration( false )
{} {}
}; };

View file

@ -138,7 +138,8 @@ HEADERS += folding.hh \
articlewebview.hh \ articlewebview.hh \
zipfile.hh \ zipfile.hh \
indexedzip.hh \ indexedzip.hh \
termination.hh termination.hh \
greektranslit.hh
FORMS += groups.ui \ FORMS += groups.ui \
dictgroupwidget.ui \ dictgroupwidget.ui \
mainwindow.ui \ mainwindow.ui \
@ -215,7 +216,8 @@ SOURCES += folding.cc \
articlewebview.cc \ articlewebview.cc \
zipfile.cc \ zipfile.cc \
indexedzip.cc \ indexedzip.cc \
termination.cc termination.cc \
greektranslit.cc
win32 { win32 {
SOURCES += mouseover_win32/ThTypes.c SOURCES += mouseover_win32/ThTypes.c
HEADERS += mouseover_win32/ThTypes.h HEADERS += mouseover_win32/ThTypes.h

655
greektranslit.cc Normal file
View file

@ -0,0 +1,655 @@
/* This file is (c) 2010 Jennie Petoumenou <epetoumenou@gmail.com>
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
#include "greektranslit.hh"
#include "transliteration.hh"
#include <QCoreApplication>
namespace GreekTranslit {
class GreekTable: public Transliteration::Table
{
public:
GreekTable();
};
GreekTable::GreekTable()
{
// Utf8
//ANCIENT GREEK DIACRITICS (BETA CODE)
// Adapted from beta2unicode.py by James Tauber <http://jtauber.com/>
//uppercase (asterisk & capitals)
//oceia - bareia
ins("*)A", "");
ins("*(A", "");
ins("*\\A", "");
ins("*/A", "Ά");
ins("*)\\A", "");
ins("*(\\A", "");
ins("*)/A", "");
ins("*(/A", "");
ins("*)E", "");
ins("*(E", "");
ins("*\\E", "");
ins("*/E", "Έ");
ins("*)\\E", "");
ins("*(\\E", "");
ins("*)/E", "");
ins("*(/E", "");
ins("*)H", "");
ins("*(H", "");
ins("*\\H", "");
ins("*/H", "Ή");
ins("*)\\H", "");
ins("*(\\H", "");
ins("*)/H", "");
ins("*(/H", "");
ins("*)I", "");
ins("*(I", "");
ins("*\\I", "");
ins("*/I", "Ί");
ins("*)\\I", "");
ins("*(\\I", "");
ins("*)/I", "");
ins("*(/I", "");
ins("*)O", "");
ins("*(O", "");
ins("*\\O", "");
ins("*/O", "Ό");
ins("*)\\O", "");
ins("*(\\O", "");
ins("*)/O", "");
ins("*(/O", "");
ins("*(R", "");
ins("*(U", "");
ins("*\\U", "");
ins("*/U", "Ύ");
ins("*(\\U", "");
ins("*(/U", "");
ins("*)W", "");
ins("*(W", "");
ins("*\\W", "");
ins("*/W", "Ώ");
ins("*)\\W", "");
ins("*(\\W", "");
ins("*)/W", "");
ins("*(/W", "");
//perispwmenh
ins("*)=A", "");
ins("*(=A", "");
ins("*)=H", "");
ins("*(=H", "");
ins("*)=I", "");
ins("*(=I", "Ἷ");
ins("*(=U", "");
ins("*)=W", "");
ins("*(=W", "");
//upogegrammenh
ins("*A|", "");
ins("*)A|", "");
ins("*(A|", "");
ins("*)/A|", "");
ins("*(/A|", "");
ins("*)=A|", "");
ins("*(=A|", "");
ins("*H|", "");
ins("*)H|", "");
ins("*(H|", "");
ins("*)/H|", "");
ins("*(/H|", "");
ins("*)=H|", "");
ins("*(=H|", "");
ins("*W|", "");
ins("*)W|", "");
ins("*(W|", "");
ins("*)/W|", "");
ins("*(/W|", "");
ins("*)=W|", "");
ins("*(=W|", "");
ins("*|A", "");
ins("*)|A", "");
ins("*(|A", "");
ins("*)/|A", "");
ins("*(/|A", "");
ins("*)=|A", "");
ins("*(=|A", "");
ins("*|H", "");
ins("*)|H", "");
ins("*(|H", "");
ins("*)/|H", "");
ins("*(/|H", "");
ins("*)=|H", "");
ins("*(=|H", "");
ins("*|W", "");
ins("*)|W", "");
ins("*(|W", "");
ins("*)/|W", "");
ins("*(/|W", "");
ins("*)=|W", "");
ins("*(=|W", "");
//dialutika
ins("*+I", "Ϊ");
ins("*+U", "Ϋ");
//uppercase (asterisk & small letters)
//oceia - bareia
ins("*)a", "");
ins("*(a", "");
ins("*\\a", "");
ins("*/a", "Ά");
ins("*)\\a", "");
ins("*(\\a", "");
ins("*)/a", "");
ins("*(/a", "");
ins("*)e", "");
ins("*(e", "");
ins("*\\e", "");
ins("*/e", "Έ");
ins("*)\\e", "");
ins("*(\\e", "");
ins("*)/e", "");
ins("*(/e", "");
ins("*)h", "");
ins("*(h", "");
ins("*\\h", "");
ins("*/h", "Ή");
ins("*)\\h", "");
ins("*(\\h", "");
ins("*)/h", "");
ins("*(/h", "");
ins("*)i", "");
ins("*(i", "");
ins("*\\i", "");
ins("*/i", "Ί");
ins("*)\\i", "");
ins("*(\\i", "");
ins("*)/i", "");
ins("*(/i", "");
ins("*)o", "");
ins("*(o", "");
ins("*\\o", "");
ins("*/o", "Ό");
ins("*)\\o", "");
ins("*(\\o", "");
ins("*)/o", "");
ins("*(/o", "");
ins("*(r", "");
ins("*(u", "");
ins("*\\u", "");
ins("*/u", "Ύ");
ins("*(\\u", "");
ins("*(/u", "");
ins("*)w", "");
ins("*(w", "");
ins("*\\w", "");
ins("*/w", "Ώ");
ins("*)\\w", "");
ins("*(\\w", "");
ins("*)/w", "");
ins("*(/w", "");
//perispwmenh
ins("*)=a", "");
ins("*(=a", "");
ins("*)=h", "");
ins("*(=h", "");
ins("*)=i", "");
ins("*(=i", "Ἷ");
ins("*(=u", "");
ins("*)=w", "");
ins("*(=w", "");
//upogegrammenh
ins("*a|", "");
ins("*)a|", "");
ins("*(a|", "");
ins("*)/a|", "");
ins("*(/a|", "");
ins("*)=a|", "");
ins("*(=a|", "");
ins("*h|", "");
ins("*)h|", "");
ins("*(h|", "");
ins("*)/h|", "");
ins("*(/h|", "");
ins("*)=h|", "");
ins("*(=h|", "");
ins("*w|", "");
ins("*)w|", "");
ins("*(w|", "");
ins("*)/w|", "");
ins("*(/w|", "");
ins("*)=w|", "");
ins("*(=w|", "");
ins("*|a", "");
ins("*)|a", "");
ins("*(|a", "");
ins("*)/|a", "");
ins("*(/|a", "");
ins("*)=|a", "");
ins("*(=|a", "");
ins("*|h", "");
ins("*)|h", "");
ins("*(|h", "");
ins("*)/|h", "");
ins("*(/|h", "");
ins("*)=|h", "");
ins("*(=|h", "");
ins("*|w", "");
ins("*)|w", "");
ins("*(|w", "");
ins("*)/|w", "");
ins("*(/|w", "");
ins("*)=|w", "");
ins("*(=|w", "");
//dialutika
ins("*+i", "Ϊ");
ins("*+u", "Ϋ");
//lowercase (capitals)
//oceia - bareia
ins("A)", "");
ins("A(", "");
ins("A\\", "");
ins("A/", "ά");
ins("A)\\", "");
ins("A(\\", "");
ins("A)/", "");
ins("A(/", "");
ins("E)", "");
ins("E(", "");
ins("E\\", "");
ins("E/", "έ");
ins("E)\\", "");
ins("E(\\", "");
ins("E)/", "");
ins("E(/", "");
ins("H)", "");
ins("H(", "");
ins("H\\", "");
ins("H/", "ή");
ins("H)\\", "");
ins("H(\\", "");
ins("H)/", "");
ins("H(/", "");
ins("I)", "");
ins("I(", "");
ins("I\\", "");
ins("I/", "ί");
ins("I)\\", "");
ins("I(\\", "");
ins("I)/", "");
ins("I(/", "");
ins("O)", "");
ins("O(", "");
ins("O\\", "");
ins("O/", "ό");
ins("O)\\", "");
ins("O(\\", "");
ins("O)/", "");
ins("O(/", "");
ins("R(", "");
ins("U)", "");
ins("U(", "");
ins("U\\", "");
ins("U/", "ύ");
ins("U)\\", "");
ins("U(\\", "");
ins("U)/", "");
ins("U(/", "");
ins("W)", "");
ins("W(", "");
ins("W\\", "");
ins("W/", "ώ");
ins("W)\\", "");
ins("W(\\", "");
ins("W)/", "");
ins("W(/", "");
//perispwmenh
ins("A=", "");
ins("A)=", "");
ins("A(=", "");
ins("H=", "");
ins("H)=", "");
ins("H(=", "");
ins("I=", "");
ins("I)=", "");
ins("I(=", "");
ins("U=", "");
ins("U)=", "");
ins("U(=", "");
ins("W=", "");
ins("W)=", "");
ins("W(=", "");
//upogegrammenh
ins("A|", "");
ins("A)|", "");
ins("A(|", "");
ins("A/|", "");
ins("A)/|", "");
ins("A(/|", "");
ins("A=|", "");
ins("A)=|", "");
ins("A(=|", "");
ins("H|", "");
ins("H)|", "");
ins("H(|", "");
ins("H/|", "");
ins("H)/|", "");
ins("H(/|", "");
ins("H=|", "");
ins("H)=|", "");
ins("H(=|", "");
ins("W|", "");
ins("W)|", "");
ins("W(|", "");
ins("W/|", "");
ins("W)/|", "");
ins("W(/|", "");
ins("W=|", "");
ins("W)=|", "");
ins("W(=|", "");
//dialutika
ins("I+", "ϊ");
ins("I\\+", "");
ins("I+\\", "");
ins("I/+", "");
ins("I+/", "");
ins("U+", "ϋ");
ins("U\\+", "");
ins("U+\\", "");
ins("U/+", "");
ins("U+/", "");
//lowercase (small letters)
//oceia - bareia
ins("a)", "");
ins("a(", "");
ins("a\\", "");
ins("a/", "ά");
ins("a)\\", "");
ins("a(\\", "");
ins("a)/", "");
ins("a(/", "");
ins("e)", "");
ins("e(", "");
ins("e\\", "");
ins("e/", "έ");
ins("e)\\", "");
ins("e(\\", "");
ins("e)/", "");
ins("e(/", "");
ins("h)", "");
ins("h(", "");
ins("h\\", "");
ins("h/", "ή");
ins("h)\\", "");
ins("h(\\", "");
ins("h)/", "");
ins("h(/", "");
ins("i)", "");
ins("i(", "");
ins("i\\", "");
ins("i/", "ί");
ins("i)\\", "");
ins("i(\\", "");
ins("i)/", "");
ins("i(/", "");
ins("o)", "");
ins("o(", "");
ins("o\\", "");
ins("o/", "ό");
ins("o)\\", "");
ins("o(\\", "");
ins("o)/", "");
ins("o(/", "");
ins("r(", "");
ins("u)", "");
ins("u(", "");
ins("u\\", "");
ins("u/", "ύ");
ins("u)\\", "");
ins("u(\\", "");
ins("u)/", "");
ins("u(/", "");
ins("w)", "");
ins("w(", "");
ins("w\\", "");
ins("w/", "ώ");
ins("w)\\", "");
ins("w(\\", "");
ins("w)/", "");
ins("w(/", "");
//perispwmenh
ins("a=", "");
ins("a)=", "");
ins("a(=", "");
ins("h=", "");
ins("h)=", "");
ins("h(=", "");
ins("i=", "");
ins("i)=", "");
ins("i(=", "");
ins("u=", "");
ins("u)=", "");
ins("u(=", "");
ins("w=", "");
ins("w)=", "");
ins("w(=", "");
//upogegrammenh
ins("a|", "");
ins("a)|", "");
ins("a(|", "");
ins("a/|", "");
ins("a)/|", "");
ins("a(/|", "");
ins("a=|", "");
ins("a)=|", "");
ins("a(=|", "");
ins("h|", "");
ins("h)|", "");
ins("h(|", "");
ins("h/|", "");
ins("h)/|", "");
ins("h(/|", "");
ins("h=|", "");
ins("h)=|", "");
ins("h(=|", "");
ins("w|", "");
ins("w)|", "");
ins("w(|", "");
ins("w/|", "");
ins("w)/|", "");
ins("w(/|", "");
ins("w=|", "");
ins("w)=|", "");
ins("w(=|", "");
//dialutika
ins("i+", "ϊ");
ins("i\\+", "");
ins("i+\\", "");
ins("i/+", "");
ins("i+/", "");
ins("u+", "ϋ");
ins("u\\+", "");
ins("u+\\", "");
ins("u/+", "");
ins("u+/", "");
//MODERN GREEK DIACRITICS
ins("'a", "ά");
ins("'e", "έ");
ins("'h", "ή");
ins("'i", "ί");
ins("\"i", "ϊ");
ins("\"'i", "ΐ");
ins("':i", "ΐ");
ins("'o", "ό");
ins("'u", "ύ");
ins("\"u", "ϋ");
ins("\"'u", "ΰ");
ins("':u", "ΰ");
ins("'w", "ώ");
ins("'A", "ά");
ins("'E", "έ");
ins("'H", "ή");
ins("'I", "ί");
ins("\"I", "ϊ");
ins("'O", "ό");
ins("'U", "ύ");
ins("\"U", "ϋ");
ins("'W", "ώ");
//BASE CHARACTERS
ins("a", "α");
ins("b", "β");
ins("v", "β");
ins("g", "γ");
ins("d", "δ");
ins("e", "ε");
ins("z", "ζ");
ins("h", "η");
ins("q", "θ");
ins("8", "θ");
ins("i", "ι");
ins("k", "κ");
ins("l", "λ");
ins("m", "μ");
ins("n", "ν");
ins("c", "ξ");
ins("3", "ξ");
ins("ks", "ξ");
ins("o", "ο");
ins("p", "π");
ins("r", "ρ");
ins("s", "σ");
ins("s1", "σ");
ins("j", "ς");
ins("s2", "ς");
ins("s\\n", "ς");
ins("t", "τ");
ins("u", "υ");
ins("f", "φ");
ins("x", "χ");
ins("y", "ψ");
ins("ps", "ψ");
ins("w", "ω");
ins("A", "α");
ins("B", "β");
ins("V", "β");
ins("G", "γ");
ins("D", "δ");
ins("E", "ε");
ins("Z", "ζ");
ins("H", "η");
ins("Q", "θ");
ins("I", "ι");
ins("K", "κ");
ins("L", "λ");
ins("M", "μ");
ins("N", "ν");
ins("C", "ξ");
ins("KS", "ξ");
ins("Ks", "ξ");
ins("O", "ο");
ins("P", "π");
ins("R", "ρ");
ins("S", "σ");
ins("S1", "σ");
ins("J", "ς");
ins("S2", "ς");
ins("S\\n", "ς");
ins("T", "τ");
ins("U", "υ");
ins("F", "φ");
ins("X", "χ");
ins("Y", "ψ");
ins("PS", "ψ");
ins("Ps", "ψ");
ins("W", "ω");
}
sptr< Dictionary::Class > makeDictionary() throw( std::exception )
{
static GreekTable t;
return new Transliteration::TransliterationDictionary( "baa9e37a1aa69cdb5daca14a48ffe5ae",
QCoreApplication::translate( "GreekTranslit", "Greek Transliteration" ).toUtf8().data(),
QIcon( ":/flags/gr.png" ), t );
}
}

16
greektranslit.hh Normal file
View file

@ -0,0 +1,16 @@
/* This file is (c) 2010 Jennie Petoumenou <epetoumenou@gmail.com>
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
#ifndef GREEKTRANSLIT_HH
#define GREEKTRANSLIT_HH
#include "dictionary.hh"
// Support for Greek transliteration
namespace GreekTranslit {
sptr< Dictionary::Class > makeDictionary() throw( std::exception );
}
#endif // GREEKTRANSLIT_HH

View file

@ -14,6 +14,7 @@
#include "romaji.hh" #include "romaji.hh"
#include "russiantranslit.hh" #include "russiantranslit.hh"
#include "german.hh" #include "german.hh"
#include "greektranslit.hh"
#include "website.hh" #include "website.hh"
#include <QMessageBox> #include <QMessageBox>
@ -198,6 +199,10 @@ void loadDictionaries( QWidget * parent, bool showInitially,
if ( cfg.transliteration.enableGermanTransliteration ) if ( cfg.transliteration.enableGermanTransliteration )
dictionaries.push_back( GermanTranslit::makeDictionary() ); dictionaries.push_back( GermanTranslit::makeDictionary() );
// Make Greek transliteration
if ( cfg.transliteration.enableGreekTransliteration )
dictionaries.push_back( GreekTranslit::makeDictionary() );
///// We create MediaWiki dicts syncronously, since they use netmgr ///// We create MediaWiki dicts syncronously, since they use netmgr
{ {

View file

@ -52,6 +52,7 @@ Sources::Sources( QWidget * parent, Config::Paths const & paths,
ui.enableRussianTransliteration->setChecked( trs.enableRussianTransliteration ); ui.enableRussianTransliteration->setChecked( trs.enableRussianTransliteration );
ui.enableGermanTransliteration->setChecked( trs.enableGermanTransliteration ); ui.enableGermanTransliteration->setChecked( trs.enableGermanTransliteration );
ui.enableGreekTransliteration->setChecked( trs.enableGreekTransliteration );
ui.enableRomaji->setChecked( trs.romaji.enable ); ui.enableRomaji->setChecked( trs.romaji.enable );
ui.enableHepburn->setChecked( trs.romaji.enableHepburn ); ui.enableHepburn->setChecked( trs.romaji.enableHepburn );
ui.enableNihonShiki->setChecked( trs.romaji.enableNihonShiki ); ui.enableNihonShiki->setChecked( trs.romaji.enableNihonShiki );
@ -236,6 +237,7 @@ Config::Transliteration Sources::getTransliteration() const
tr.enableRussianTransliteration = ui.enableRussianTransliteration->isChecked(); tr.enableRussianTransliteration = ui.enableRussianTransliteration->isChecked();
tr.enableGermanTransliteration = ui.enableGermanTransliteration->isChecked(); tr.enableGermanTransliteration = ui.enableGermanTransliteration->isChecked();
tr.enableGreekTransliteration = ui.enableGreekTransliteration->isChecked();
tr.romaji.enable = ui.enableRomaji->isChecked(); tr.romaji.enable = ui.enableRomaji->isChecked();
tr.romaji.enableHepburn = ui.enableHepburn->isChecked(); tr.romaji.enableHepburn = ui.enableHepburn->isChecked();
tr.romaji.enableNihonShiki = ui.enableNihonShiki->isChecked(); tr.romaji.enableNihonShiki = ui.enableNihonShiki->isChecked();

View file

@ -353,39 +353,54 @@ of the appropriate groups to use them.</string>
</spacer> </spacer>
</item> </item>
<item> <item>
<widget class="QCheckBox" name="enableRussianTransliteration"> <layout class="QGridLayout" name="gridLayout_2">
<property name="text"> <item row="0" column="0">
<string>Russian transliteration</string> <widget class="QCheckBox" name="enableRussianTransliteration">
</property> <property name="text">
<property name="icon"> <string>Russian transliteration</string>
<iconset resource="flags.qrc"> </property>
<normaloff>:/flags/ru.png</normaloff>:/flags/ru.png</iconset> <property name="icon">
</property> <iconset resource="flags.qrc">
</widget> <normaloff>:/flags/ru.png</normaloff>:/flags/ru.png</iconset>
</item> </property>
<item> </widget>
<spacer name="verticalSpacer_6"> </item>
<property name="orientation"> <item row="0" column="1">
<enum>Qt::Vertical</enum> <widget class="QCheckBox" name="enableGreekTransliteration">
</property> <property name="text">
<property name="sizeHint" stdset="0"> <string>Greek transliteration</string>
<size> </property>
<width>20</width> <property name="icon">
<height>40</height> <iconset resource="flags.qrc">
</size> <normaloff>:/flags/gr.png</normaloff>:/flags/gr.png</iconset>
</property> </property>
</spacer> </widget>
</item> </item>
<item> <item row="1" column="0">
<widget class="QCheckBox" name="enableGermanTransliteration"> <spacer name="verticalSpacer_6">
<property name="text"> <property name="orientation">
<string>German transliteration</string> <enum>Qt::Vertical</enum>
</property> </property>
<property name="icon"> <property name="sizeHint" stdset="0">
<iconset resource="flags.qrc"> <size>
<normaloff>:/flags/de.png</normaloff>:/flags/de.png</iconset> <width>20</width>
</property> <height>40</height>
</widget> </size>
</property>
</spacer>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="enableGermanTransliteration">
<property name="text">
<string>German transliteration</string>
</property>
<property name="icon">
<iconset resource="flags.qrc">
<normaloff>:/flags/de.png</normaloff>:/flags/de.png</iconset>
</property>
</widget>
</item>
</layout>
</item> </item>
<item> <item>
<spacer name="verticalSpacer_7"> <spacer name="verticalSpacer_7">