mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 15:24:05 +00:00
clean: rename code to code2 in langcoder
This commit is contained in:
parent
4993aaae5f
commit
51ecf09c1d
|
@ -219,7 +219,7 @@ QIcon LangCoder::icon( quint32 _code )
|
|||
{
|
||||
if ( auto code = intToCode2( _code ); code2Exists( code ) ) {
|
||||
const GDLangCode & lc = LANG_CODE_MAP[ code ];
|
||||
return QIcon( ":/flags/" + QString( lc.code ) + ".png" );
|
||||
return QIcon( ":/flags/" + QString( lc.code2 ) + ".png" );
|
||||
}
|
||||
|
||||
return {};
|
||||
|
@ -243,7 +243,7 @@ quint32 LangCoder::findIdForLanguage( gd::wstring const & lang )
|
|||
|
||||
for ( auto const & lc : LANG_CODE_MAP ) {
|
||||
if ( strcasecmp( langFolded.c_str(), lc.lang.c_str() ) == 0 ) {
|
||||
return code2toInt( lc.code.toStdString().c_str() );
|
||||
return code2toInt( lc.code2.toStdString().c_str() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -254,7 +254,7 @@ quint32 LangCoder::findIdForLanguageCode3( std::string const & code )
|
|||
{
|
||||
for ( auto const & lc : LANG_CODE_MAP ) {
|
||||
if ( code == lc.code3 ) {
|
||||
return code2toInt( lc.code );
|
||||
return code2toInt( lc.code2 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -273,7 +273,7 @@ quint32 LangCoder::guessId( const QString & lang )
|
|||
if ( lstr.size() >= 3 ) {
|
||||
for ( auto const & lc : LANG_CODE_MAP ) {
|
||||
if ( lstr == ( lstr.size() == 3 ? QString::fromStdString( lc.code3 ) : QString::fromStdString( lc.lang ) ) ) {
|
||||
return code2toInt( lc.code );
|
||||
return code2toInt( lc.code2 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -311,7 +311,7 @@ bool LangCoder::isLanguageRTL( quint32 _code )
|
|||
if ( auto code = intToCode2( _code ); code2Exists( code ) ) {
|
||||
GDLangCode lc = LANG_CODE_MAP[ code ];
|
||||
if ( lc.isRTL < 0 ) {
|
||||
lc.isRTL = static_cast< int >( QLocale( lc.code ).textDirection() == Qt::RightToLeft );
|
||||
lc.isRTL = static_cast< int >( QLocale( lc.code2 ).textDirection() == Qt::RightToLeft );
|
||||
}
|
||||
return lc.isRTL != 0;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
struct GDLangCode
|
||||
{
|
||||
QString code; // ISO 639-1
|
||||
QString code2; // ISO 639-1 -> always 2 letters thus code2
|
||||
std::string code3; // ISO 639-2B ( http://www.loc.gov/standards/iso639-2/ )
|
||||
int isRTL; // Right-to-left writing; 0 - no, 1 - yes, -1 - let Qt define
|
||||
std::string lang; // Language name in English
|
||||
|
|
Loading…
Reference in a new issue