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

View file

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

View file

@ -138,7 +138,8 @@ HEADERS += folding.hh \
articlewebview.hh \
zipfile.hh \
indexedzip.hh \
termination.hh
termination.hh \
greektranslit.hh
FORMS += groups.ui \
dictgroupwidget.ui \
mainwindow.ui \
@ -215,7 +216,8 @@ SOURCES += folding.cc \
articlewebview.cc \
zipfile.cc \
indexedzip.cc \
termination.cc
termination.cc \
greektranslit.cc
win32 {
SOURCES += mouseover_win32/ThTypes.c
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 "russiantranslit.hh"
#include "german.hh"
#include "greektranslit.hh"
#include "website.hh"
#include <QMessageBox>
@ -198,6 +199,10 @@ void loadDictionaries( QWidget * parent, bool showInitially,
if ( cfg.transliteration.enableGermanTransliteration )
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
{

View file

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

View file

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