refactor: move transliteration code to src/dict/transliteration
Some checks are pending
SonarCloud / Build and analyze (push) Waiting to run

This commit is contained in:
shenleban tongying 2024-11-21 02:21:57 -05:00 committed by GitHub
parent f2ce85cda2
commit d3700f2926
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 25 additions and 31 deletions

View file

@ -11,12 +11,6 @@
#include "dict/sounddir.hh" #include "dict/sounddir.hh"
#include "dict/hunspell.hh" #include "dict/hunspell.hh"
#include "dictdfiles.hh" #include "dictdfiles.hh"
#include "dict/romaji.hh"
#include "dict/customtransliteration.hh"
#include "dict/russiantranslit.hh"
#include "dict/german.hh"
#include "dict/greektranslit.hh"
#include "dict/belarusiantranslit.hh"
#include "dict/website.hh" #include "dict/website.hh"
#include "dict/forvo.hh" #include "dict/forvo.hh"
#include "dict/programs.hh" #include "dict/programs.hh"
@ -34,12 +28,19 @@
#include "dict/lingualibre.hh" #include "dict/lingualibre.hh"
#include "metadata.hh" #include "metadata.hh"
#include "dict/transliteration/belarusian.hh"
#include "dict/transliteration/custom.hh"
#include "dict/transliteration/german.hh"
#include "dict/transliteration/greek.hh"
#include "dict/transliteration/romaji.hh"
#include "dict/transliteration/russian.hh"
#ifndef NO_EPWING_SUPPORT #ifndef NO_EPWING_SUPPORT
#include "dict/epwing.hh" #include "dict/epwing.hh"
#endif #endif
#ifdef MAKE_CHINESE_CONVERSION_SUPPORT #ifdef MAKE_CHINESE_CONVERSION_SUPPORT
#include "dict/chinese.hh" #include "dict/transliteration/chinese.hh"
#endif #endif
#include <QMessageBox> #include <QMessageBox>
@ -243,10 +244,10 @@ void loadDictionaries( QWidget * parent,
///// We create transliterations synchronously since they are very simple ///// We create transliterations synchronously since they are very simple
#ifdef MAKE_CHINESE_CONVERSION_SUPPORT #ifdef MAKE_CHINESE_CONVERSION_SUPPORT
addDicts( Chinese::makeDictionaries( cfg.transliteration.chinese ) ); addDicts( ChineseTranslit::makeDictionaries( cfg.transliteration.chinese ) );
#endif #endif
addDicts( Romaji::makeDictionaries( cfg.transliteration.romaji ) ); addDicts( RomajiTranslit::makeDictionaries( cfg.transliteration.romaji ) );
addDicts( CustomTranslit::makeDictionaries( cfg.transliteration.customTrans ) ); addDicts( CustomTranslit::makeDictionaries( cfg.transliteration.customTrans ) );
// Make Russian transliteration // Make Russian transliteration

View file

@ -0,0 +1 @@
Translit

View file

@ -1,7 +1,7 @@
/* This file is (c) 2013 Maksim Tamkovicz <quendimax@gmail.com> /* This file is (c) 2013 Maksim Tamkovicz <quendimax@gmail.com>
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */ * Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
#include "belarusiantranslit.hh" #include "belarusian.hh"
#include "transliteration.hh" #include "transliteration.hh"
#include <QCoreApplication> #include <QCoreApplication>

View file

@ -3,7 +3,6 @@
#pragma once #pragma once
#include <vector>
#include "dictionary.hh" #include "dictionary.hh"
// Support for Belarusian transliteration // Support for Belarusian transliteration

View file

@ -4,16 +4,13 @@
#include "chinese.hh" #include "chinese.hh"
#include <stdexcept> #include <stdexcept>
#include <QCoreApplication> #include <QCoreApplication>
// #ifdef Q_OS_MAC
#include <opencc/opencc.h> #include <opencc/opencc.h>
// #endif
// #include <opencc/SimpleConverter.hpp>
#include "folding.hh" #include "folding.hh"
#include "gddebug.hh" #include "gddebug.hh"
#include "transliteration.hh" #include "transliteration.hh"
#include "utf8.hh" #include "utf8.hh"
namespace Chinese { namespace ChineseTranslit {
class CharacterConversionDictionary: public Transliteration::BaseTransliterationDictionary class CharacterConversionDictionary: public Transliteration::BaseTransliterationDictionary
{ {
@ -162,4 +159,4 @@ std::vector< sptr< Dictionary::Class > > makeDictionaries( Config::Chinese const
return result; return result;
} }
} // namespace Chinese } // namespace ChineseTranslit

View file

@ -3,12 +3,10 @@
#pragma once #pragma once
#include <map>
#include "config.hh"
#include "dictionary.hh" #include "dictionary.hh"
/// Chinese character conversion support. /// Chinese character conversion support.
namespace Chinese { namespace ChineseTranslit {
std::vector< sptr< Dictionary::Class > > makeDictionaries( Config::Chinese const & ); std::vector< sptr< Dictionary::Class > > makeDictionaries( Config::Chinese const & );
} }

View file

@ -1,4 +1,4 @@
#include "customtransliteration.hh" #include "custom.hh"
#include "dictionary.hh" #include "dictionary.hh"
#include <QCoreApplication> #include <QCoreApplication>

View file

@ -1,7 +1,6 @@
#pragma once #pragma once
#include <vector>
#include "transliteration.hh" #include "transliteration.hh"
// Support for Belarusian transliteration // Support for Belarusian transliteration

View file

@ -1,7 +1,7 @@
/* This file is (c) 2010 Jennie Petoumenou <epetoumenou@gmail.com> /* This file is (c) 2010 Jennie Petoumenou <epetoumenou@gmail.com>
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */ * Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
#include "greektranslit.hh" #include "greek.hh"
#include "transliteration.hh" #include "transliteration.hh"
#include <QCoreApplication> #include <QCoreApplication>

View file

@ -1,7 +1,9 @@
#include "romaji.hh" #include "romaji.hh"
#include <QCoreApplication> #include <QCoreApplication>
namespace Romaji { namespace RomajiTranslit {
using std::vector;
class HepburnHiragana: public Transliteration::Table class HepburnHiragana: public Transliteration::Table
{ {
@ -375,4 +377,4 @@ vector< sptr< Dictionary::Class > > makeDictionaries( Config::Romaji const & r )
return result; return result;
} }
} // namespace Romaji } // namespace RomajiTranslit

View file

@ -4,12 +4,9 @@
#pragma once #pragma once
#include "transliteration.hh" #include "transliteration.hh"
#include "config.hh"
/// Japanese romanization (Romaji) support. /// Japanese romanization (Romaji) support.
namespace Romaji { namespace RomajiTranslit {
using std::vector; std::vector< sptr< Dictionary::Class > > makeDictionaries( Config::Romaji const & );
} // namespace RomajiTranslit
vector< sptr< Dictionary::Class > > makeDictionaries( Config::Romaji const & );
} // namespace Romaji

View file

@ -1,7 +1,7 @@
/* This file is (c) 2008-2012 Konstantin Isakov <ikm@goldendict.org> /* This file is (c) 2008-2012 Konstantin Isakov <ikm@goldendict.org>
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */ * Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
#include "russiantranslit.hh" #include "russian.hh"
#include "transliteration.hh" #include "transliteration.hh"
#include <QCoreApplication> #include <QCoreApplication>