Commit 32e63415 authored by Nick Shaforostoff's avatar Nick Shaforostoff

try harder detecting plural forms

now it finds general 'xx' when langcode is 'xx_YY'
parent 129c6627
......@@ -162,6 +162,12 @@ QString GNUPluralForms(const QString& lang)
if (KDE_ISLIKELY( i>=0 ))
return QString::fromLatin1(langsWithPInfo[i].plural);
i=langsWithPInfoCount;
while(--i>=0 && !l.startsWith(langsWithPInfo[i].lang))
;
if (KDE_ISLIKELY( i>=0 ))
return QString::fromLatin1(langsWithPInfo[i].plural);
//BEGIN alternative
// NOTE does this work under M$ OS?
......@@ -325,7 +331,7 @@ void updateHeader(QString& header,
if (Q_UNLIKELY( !found ))
headerList.append(temp);
langCode=Project::instance()->isLoaded()?
Project::instance()->langCode():
Settings::defaultLangCode();
......
......@@ -175,6 +175,7 @@ sonnet_static
DEFINES += HAVE_HUNSPELL
#win32: DEFINES += HUNSPELL_STATIC
INCLUDEPATH += ../../hunspell/src/hunspell
INCLUDEPATH += ../../hunspell/src
mac:LIBS += -L../../hunspell/src/hunspell/.libs/ -lhunspell-1.2
win32:LIBS += -L../../hunspell/src/win_api/x64/Release_dll -llibhunspell
......
......@@ -42,8 +42,7 @@ bool SettingsController::ensureProjectIsLoaded()
QString fullUserName();// defined in <platform>helpers.cpp
Settings::Settings()
: mDefaultLangCode(QLocale::system().name())
, mAddColor(0x99,0xCC,0xFF)
: mAddColor(0x99,0xCC,0xFF)
, mDelColor(0xFF,0x99,0x99)
, mMsgFont()
, mHighlightSpaces(true)
......@@ -68,6 +67,8 @@ Settings::Settings()
if (mAuthorName.isEmpty()) {mAuthorName = fullUserName(); if (mAuthorName.length()) mAuthorName[0]=mAuthorName.at(0).toUpper();}
mAuthorEmail = s.value(QStringLiteral("Author/Email"), QString()).toString();
mDefaultLangCode = s.value(QStringLiteral("Editor/TargetLangCode"), QLocale::system().name()).toString();
mAltTransViewEverShownWithData = s.value(QStringLiteral("Editor/AltTransViewEverShownWithData"),false).toBool();
}
......@@ -77,6 +78,8 @@ void Settings::save()
s.setValue(QStringLiteral("Author/Name"), mAuthorName);
s.setValue(QStringLiteral("Author/Email"), mAuthorEmail);
s.setValue(QStringLiteral("Editor/TargetLangCode"), mDefaultLangCode);
s.setValue(QStringLiteral("Editor/AltTransViewEverShownWithData"), mAltTransViewEverShownWithData);
}
......
......@@ -20,6 +20,7 @@ public:
public slots:
static void setAuthorName(const QString& v){self()->mAuthorName = v;}
static void setAuthorEmail(const QString& v){self()->mAuthorEmail = v;}
static void setDefaultLangCode(const QString& v){self()->mDefaultLangCode = v;}
public:
static QString authorName() {return self()->mAuthorName;}
......
......@@ -61,6 +61,7 @@ WelcomeTab::WelcomeTab(QWidget *parent)
connect(targetLangCombo, SIGNAL(currentIndexChanged(int)), t, SLOT(setLangCode(int)));
connect(s, SIGNAL(langCodeSelected(QString)), Project::instance(), SLOT(setSourceLangCode(QString)));
connect(t, SIGNAL(langCodeSelected(QString)), Project::instance(), SLOT(setTargetLangCode(QString)));
connect(t, SIGNAL(langCodeSelected(QString)), Settings::self(), SLOT(setDefaultLangCode(QString)));
authorNameEdit->setText(Settings::self()->authorName());
connect(authorNameEdit, SIGNAL(textChanged(QString)), Settings::self(), SLOT(setAuthorName(QString)));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment