]> Git trees. - libqmvoc.git/commitdiff
Use Neutral everywhere instead of Neuter.
authorFrederik Gladhorn <gladhorn@kde.org>
Sat, 29 Sep 2007 12:49:14 +0000 (12:49 +0000)
committerFrederik Gladhorn <gladhorn@kde.org>
Sat, 29 Sep 2007 12:49:14 +0000 (12:49 +0000)
Make localization for special types work.

svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=718659

13 files changed:
keduvocdocument/keduvocconjugation.h
keduvocdocument/keduvocdeclination.h
keduvocdocument/keduvocgrammar.cpp
keduvocdocument/keduvocgrammar.h
keduvocdocument/keduvockvtml2reader.cpp
keduvocdocument/keduvockvtml2writer.cpp
keduvocdocument/keduvockvtmlreader.cpp
keduvocdocument/keduvockvtmlwriter.cpp
keduvocdocument/keduvocpersonalpronoun.cpp
keduvocdocument/keduvocpersonalpronoun.h
keduvocdocument/keduvocwordtype.cpp
keduvocdocument/keduvocwordtype.h
keduvocdocument/kvtml2defs.h

index 4d87de9d5d0f3ba34cf162f5926ba3b488180dbc..56e17e290296fe122e7ca3b63cd67b91934cfaca 100644 (file)
@@ -43,13 +43,13 @@ public:
         NumberMAX
     };
 
-    // store third person neuter/common in the same sttr
+    // store third person neutral/common in the same sttr
     enum ConjugationPerson {
         First,
         Second,
         ThirdMale,
         ThirdFemale,
-        ThirdNeuterCommon,
+        ThirdNeutralCommon,
         PersonMAX
     };
 
index dfd5ef097cb31fec7eb7995f0191d9e48e05060e..7252579ccc5808780c798be8064227ebc803c63b 100644 (file)
@@ -37,13 +37,6 @@ public:
         Dual,
         Plural
     };
-/*
-    enum DeclinationGender {
-        Undefined,
-        Masculine,
-        Feminine,
-        Neuter
-    };*/
 
     enum DeclinationCase {
         Nominative = 1,
index 748c76c918d4092f7ea6a7496824759a789469e6..948c89fbe0e086657cc224600f185dd5a6c1536e 100644 (file)
@@ -150,11 +150,11 @@ KEduVocArticle::KEduVocArticle( const QString &fem_def, const QString &fem_indef
 {
     setArticle( mal_def, Singular, Definite, Masculine );
     setArticle( fem_def, Singular, Definite, Feminine );
-    setArticle( neu_def, Singular, Definite, Neuter );
+    setArticle( neu_def, Singular, Definite, Neutral );
 
     setArticle( mal_indef, Singular, Indefinite, Masculine );
     setArticle( fem_indef, Singular, Indefinite, Feminine );
-    setArticle( neu_indef, Singular, Indefinite, Neuter );
+    setArticle( neu_indef, Singular, Indefinite, Neutral );
 }
 
 KEduVocArticle::~KEduVocArticle()
index 3795e46b49bb995f42e41c63a6443b4fb55895a4..9679cf426146cc6bf3e27cdf6d642444fdafa325 100644 (file)
@@ -50,7 +50,7 @@ public:
     enum ArticleGender {
         Masculine,
         Feminine,
-        Neuter,
+        Neutral,
         GenderMAX
     };
 
index fa35d4970f8b30ce732fafe71e76325ee678a869..8e9255ca0d9e97322cbc5c30b6e46b354c530b5b 100644 (file)
@@ -550,56 +550,49 @@ bool KEduVocKvtml2Reader::readTypes( QDomElement &typesElement )
         // set type and specialtype
         mainTypeName =
             currentTypeElement.firstChildElement( KVTML_TYPENAME ).text();
-        m_doc->wordTypes().addType( mainTypeName,
-                                     currentTypeElement.firstChildElement( KVTML_SPECIALWORDTYPE ).text() );
+
+        QString specialType = currentTypeElement.firstChildElement( KVTML_SPECIALWORDTYPE ).text();
+        if ( !specialType.isEmpty() ) {
+            // get the localized version
+            if ( specialType == KVTML_SPECIALWORDTYPE_NOUN ) {
+                specialType = m_doc->wordTypes().specialTypeNoun();
+            }
+            if ( specialType == KVTML_SPECIALWORDTYPE_VERB ) {
+                specialType = m_doc->wordTypes().specialTypeVerb();
+            }
+            if ( specialType == KVTML_SPECIALWORDTYPE_ADVERB ) {
+                specialType = m_doc->wordTypes().specialTypeAdverb();
+            }
+            if ( specialType == KVTML_SPECIALWORDTYPE_ADJECTIVE ) {
+                specialType = m_doc->wordTypes().specialTypeAdjective();
+            }
+        }
+        m_doc->wordTypes().addType( mainTypeName, specialType );
 
         // iterate sub type elements <subwordtypedefinition>
-        QDomElement currentSubTypeElement =    currentTypeElement.firstChildElement( KVTML_SUBWORDTYPEDEFINITION );
+        QDomElement currentSubTypeElement = currentTypeElement.firstChildElement( KVTML_SUBWORDTYPEDEFINITION );
         while ( !currentSubTypeElement.isNull() ) {
+            QString specialSubType = currentSubTypeElement.firstChildElement( KVTML_SPECIALWORDTYPE ).text();
+            if ( !specialSubType.isEmpty() ) {
+                // get the localized version
+                if ( specialSubType == KVTML_SPECIALWORDTYPE_NOUN_MALE ) {
+                    specialSubType = m_doc->wordTypes().specialTypeNounMale();
+                }
+                if ( specialSubType == KVTML_SPECIALWORDTYPE_NOUN_FEMALE ) {
+                    specialSubType = m_doc->wordTypes().specialTypeNounFemale();
+                }
+                if ( specialSubType == KVTML_SPECIALWORDTYPE_NOUN_NEUTRAL ) {
+                    specialSubType = m_doc->wordTypes().specialTypeNounNeutral();
+                }
+            }
             // set type and specialtype
             m_doc->wordTypes().addSubType( mainTypeName,
                                             currentSubTypeElement.firstChildElement( KVTML_SUBTYPENAME ).text(),
-                                            currentSubTypeElement.firstChildElement( KVTML_SPECIALWORDTYPE ).text() );
-
-
+                                            specialSubType );
             currentSubTypeElement = currentSubTypeElement.nextSiblingElement( KVTML_SUBWORDTYPEDEFINITION );
         }
-
-
-
-
-
         currentTypeElement = currentTypeElement.nextSiblingElement( KVTML_WORDTYPEDEFINITION );
     }
-
-
-    /*
-    for (int i = 0; i < typeNodes.count(); ++i)
-    {
-      QDomElement currentElement = typeNodes.item(i).toElement();
-      if (currentElement.parentNode() == typesElement)
-      {
-        m_doc->wordTypes().addType(currentElement.text());
-      }
-    }*/
-
-
-
-
-
-
-
-//   QDomNodeList typeNodes = typesElement.elementsByTagName(KVTML_WORDTYPEDEFINITION);
-//   for (int i = 0; i < typeNodes.count(); ++i)
-//   {
-//     QDomElement currentElement = typeNodes.item(i).toElement();
-//     if (currentElement.parentNode() == typesElement)
-//     {
-//       m_doc->wordTypes().addType(currentElement.text());
-//     }
-//   }
-
-//   m_doc->setTypeDescriptions(types);
     return true;
 }
 
@@ -796,9 +789,9 @@ bool KEduVocKvtml2Reader::readConjugationPerson(QDomElement & personElement, KEd
     conjugation.setConjugation( currentElement.text(),
         KEduVocConjugation::ThirdFemale, number );
 
-    currentElement = personElement.firstChildElement( KVTML_THIRD_NEUTER_COMMON );
+    currentElement = personElement.firstChildElement( KVTML_THIRD_NEUTRAL_COMMON );
     conjugation.setConjugation( currentElement.text(),
-        KEduVocConjugation::ThirdNeuterCommon, number );
+        KEduVocConjugation::ThirdNeutralCommon, number );
 }
 
 
@@ -806,8 +799,8 @@ bool KEduVocKvtml2Reader::readPersonalPronoun(QDomElement & pronounElement, KEdu
 {
     pronoun.setMaleFemaleDifferent(!pronounElement.firstChildElement(
         KVTML_THIRD_PERSON_MALE_FEMALE_DIFFERENT).isNull());
-    pronoun.setNeuterExists( !pronounElement.firstChildElement(
-        KVTML_THIRD_PERSON_NEUTER_EXISTS).isNull() );
+    pronoun.setNeutralExists( !pronounElement.firstChildElement(
+        KVTML_THIRD_PERSON_NEUTRAL_EXISTS).isNull() );
     pronoun.setDualExists( !pronounElement.firstChildElement(
         KVTML_DUAL_EXISTS).isNull() );
 
@@ -846,9 +839,9 @@ bool KEduVocKvtml2Reader::readPersonalPronounChild(QDomElement & personElement,
     pronoun.setPersonalPronoun( currentElement.text(),
         KEduVocConjugation::ThirdFemale, number );
 
-    currentElement = personElement.firstChildElement( KVTML_THIRD_NEUTER_COMMON );
+    currentElement = personElement.firstChildElement( KVTML_THIRD_NEUTRAL_COMMON );
     pronoun.setPersonalPronoun( currentElement.text(),
-        KEduVocConjugation::ThirdNeuterCommon, number );
+        KEduVocConjugation::ThirdNeutralCommon, number );
 }
 
 
index 71e793b35d7d21ec1d638b2b7fb09a58dc056fbb..a48bac99092195bfb241010d981271270af01186 100644 (file)
@@ -238,11 +238,11 @@ bool KEduVocKvtml2Writer::writeArticle( QDomElement &articleElement, int article
     }
 
     // neutral
-    articleString = m_doc->identifier(article).article().article( KEduVocArticle::Singular, KEduVocArticle::Definite, KEduVocArticle::Neuter );
+    articleString = m_doc->identifier(article).article().article( KEduVocArticle::Singular, KEduVocArticle::Definite, KEduVocArticle::Neutral );
     if ( !articleString.isEmpty() ) {
         definite.appendChild( newTextElement( KVTML_NEUTRAL, articleString ) );
     }
-    articleString = m_doc->identifier(article).article().article( KEduVocArticle::Singular, KEduVocArticle::Indefinite, KEduVocArticle::Neuter );
+    articleString = m_doc->identifier(article).article().article( KEduVocArticle::Singular, KEduVocArticle::Indefinite, KEduVocArticle::Neutral );
     if ( !articleString.isEmpty() ) {
         indefinite.appendChild( newTextElement( KVTML_NEUTRAL, articleString ) );
     }
@@ -271,35 +271,46 @@ bool KEduVocKvtml2Writer::writeTypes( QDomElement &typesElement )
         kDebug() << "Writing type: " << mainTypeName;
         QDomElement typeDefinitionElement = m_domDoc.createElement( KVTML_WORDTYPEDEFINITION );
         typeDefinitionElement.appendChild( newTextElement( KVTML_TYPENAME, mainTypeName ) );
-        if ( !wt.specialType( mainTypeName ).isEmpty() ) {
-            typeDefinitionElement.appendChild( newTextElement( KVTML_SPECIALWORDTYPE, wt.specialType( mainTypeName ) ) );
+
+        QString specialType = wt.specialType( mainTypeName );
+        if ( !specialType.isEmpty() ) {
+            // get the NOT localized version for the doc
+            if ( specialType == m_doc->wordTypes().specialTypeNoun() ) {
+                specialType = KVTML_SPECIALWORDTYPE_NOUN;
+            }
+            if ( specialType == m_doc->wordTypes().specialTypeVerb()) {
+                specialType =  KVTML_SPECIALWORDTYPE_VERB;
+            }
+            if ( specialType == m_doc->wordTypes().specialTypeAdverb()) {
+                specialType = KVTML_SPECIALWORDTYPE_ADVERB;
+            }
+            if ( specialType ==  m_doc->wordTypes().specialTypeAdjective()) {
+                specialType = KVTML_SPECIALWORDTYPE_ADJECTIVE;
+            }
+            typeDefinitionElement.appendChild( newTextElement( KVTML_SPECIALWORDTYPE, specialType ) );
         }
 
         // subtypes
         foreach( QString subTypeName, wt.subTypeNameList( mainTypeName ) ) {
             QDomElement subTypeDefinitionElement = m_domDoc.createElement( KVTML_SUBWORDTYPEDEFINITION );
             subTypeDefinitionElement.appendChild( newTextElement( KVTML_SUBTYPENAME, subTypeName ) );
-            if ( !wt.specialSubType( mainTypeName, subTypeName ).isEmpty() ) {
-                subTypeDefinitionElement.appendChild( newTextElement( KVTML_SPECIALWORDTYPE, wt.specialSubType( mainTypeName, subTypeName ) ) );
+            QString specialSubType = wt.specialSubType( mainTypeName, subTypeName );
+            if ( !specialSubType.isEmpty() ) {
+                if ( specialSubType == m_doc->wordTypes().specialTypeNounMale() ) {
+                    specialSubType = KVTML_SPECIALWORDTYPE_NOUN_MALE;
+                }
+                if ( specialSubType == m_doc->wordTypes().specialTypeNounFemale() ) {
+                    specialSubType = KVTML_SPECIALWORDTYPE_NOUN_FEMALE;
+                }
+                if ( specialSubType == m_doc->wordTypes().specialTypeNounNeutral() ) {
+                    specialSubType = KVTML_SPECIALWORDTYPE_NOUN_NEUTRAL;
+                }
+                subTypeDefinitionElement.appendChild( newTextElement( KVTML_SPECIALWORDTYPE, specialSubType ) );
             }
             typeDefinitionElement.appendChild( subTypeDefinitionElement );
         }
         typesElement.appendChild( typeDefinitionElement );
     }
-
-
-
-
-
-    /*
-      foreach(QString type, m_doc->typeDescriptions())
-      {
-        if (!(type.isNull()) )
-        {
-          typesElement.appendChild(newTextElement(KVTML_WORDTYPE, type));
-        }
-      }*/
-
     return true;
 }
 
@@ -548,7 +559,7 @@ bool KEduVocKvtml2Writer::writeConjugation( QDomElement &conjugationElement,
         QString third_female = conjugation.conjugation(
             KEduVocConjugation::ThirdFemale, num );
         QString third_neutral = conjugation.conjugation(
-            KEduVocConjugation::ThirdNeuterCommon, num );
+            KEduVocConjugation::ThirdNeutralCommon, num );
 
         if ( !first.isEmpty() || !second.isEmpty() || !third_female.isEmpty() ||
                 !third_male.isEmpty() || !third_neutral.isEmpty() ) {
@@ -569,7 +580,7 @@ bool KEduVocKvtml2Writer::writeConjugation( QDomElement &conjugationElement,
             number.appendChild( newTextElement( KVTML_2NDPERSON, second ) );
             number.appendChild( newTextElement( KVTML_THIRD_MALE, third_male ) );
             number.appendChild( newTextElement( KVTML_THIRD_FEMALE, third_female ) );
-            number.appendChild( newTextElement( KVTML_THIRD_NEUTER_COMMON, third_neutral ) );
+            number.appendChild( newTextElement( KVTML_THIRD_NEUTRAL_COMMON, third_neutral ) );
 
             conjugationElement.appendChild( number );
         }
@@ -592,8 +603,8 @@ bool KEduVocKvtml2Writer::writePersonalPronoun(QDomElement & pronounElement, con
     if ( pronoun.maleFemaleDifferent() ) {
         pronounElement.appendChild( m_domDoc.createElement( KVTML_THIRD_PERSON_MALE_FEMALE_DIFFERENT ) );
     }
-    if ( pronoun.neuterExists() ) {
-        pronounElement.appendChild( m_domDoc.createElement( KVTML_THIRD_PERSON_NEUTER_EXISTS ) );
+    if ( pronoun.neutralExists() ) {
+        pronounElement.appendChild( m_domDoc.createElement( KVTML_THIRD_PERSON_NEUTRAL_EXISTS ) );
     }
     if ( pronoun.dualExists() ) {
         pronounElement.appendChild( m_domDoc.createElement( KVTML_DUAL_EXISTS ) );
@@ -609,7 +620,7 @@ bool KEduVocKvtml2Writer::writePersonalPronoun(QDomElement & pronounElement, con
         QString third_female = pronoun.personalPronoun(
             KEduVocConjugation::ThirdFemale, num );
         QString third_neutral = pronoun.personalPronoun(
-            KEduVocConjugation::ThirdNeuterCommon, num );
+            KEduVocConjugation::ThirdNeutralCommon, num );
 
         if ( !first.isEmpty() || !second.isEmpty() || !third_female.isEmpty() ||
                 !third_male.isEmpty() || !third_neutral.isEmpty() ) {
@@ -630,13 +641,13 @@ bool KEduVocKvtml2Writer::writePersonalPronoun(QDomElement & pronounElement, con
             number.appendChild( newTextElement( KVTML_2NDPERSON, second ) );
             number.appendChild( newTextElement( KVTML_THIRD_MALE, third_male ) );
             number.appendChild( newTextElement( KVTML_THIRD_FEMALE, third_female ) );
-            number.appendChild( newTextElement( KVTML_THIRD_NEUTER_COMMON, third_neutral ) );
+            number.appendChild( newTextElement( KVTML_THIRD_NEUTRAL_COMMON, third_neutral ) );
 
             if ( pronoun.maleFemaleDifferent() ) {
                 number.appendChild( m_domDoc.createElement( KVTML_THIRD_PERSON_MALE_FEMALE_DIFFERENT ) );
             }
-            if ( pronoun.neuterExists() ) {
-                number.appendChild( m_domDoc.createElement( KVTML_THIRD_PERSON_NEUTER_EXISTS ) );
+            if ( pronoun.neutralExists() ) {
+                number.appendChild( m_domDoc.createElement( KVTML_THIRD_PERSON_NEUTRAL_EXISTS ) );
             }
             pronounElement.appendChild( number );
         }
index 45bc80e3b568149a90f862c470e322c8df5ee4d9..fd570c97690c66d911bea1732bcb5859e50ee9b4 100644 (file)
@@ -484,25 +484,25 @@ bool KEduVocKvtmlReader::readConjugation( QDomElement &domElementParent, KEduVoc
     conjugation.setConjugation( pers2_plur, KEduVocConjugation::Second, numP);
 
     if ( s3_common ) {
-        conjugation.setConjugation( pers3_f_sing, KEduVocConjugation::ThirdNeuterCommon, KEduVocConjugation::Singular );
+        conjugation.setConjugation( pers3_f_sing, KEduVocConjugation::ThirdNeutralCommon, KEduVocConjugation::Singular );
     } else  {
         conjugation.setConjugation( pers3_m_sing,
             KEduVocConjugation::ThirdMale, KEduVocConjugation::Singular );
         conjugation.setConjugation( pers3_f_sing,
             KEduVocConjugation::ThirdFemale, KEduVocConjugation::Singular );
         conjugation.setConjugation( pers3_n_sing,
-            KEduVocConjugation::ThirdNeuterCommon, KEduVocConjugation::Singular );
+            KEduVocConjugation::ThirdNeutralCommon, KEduVocConjugation::Singular );
     }
 
     if ( p3_common ) {
-        conjugation.setConjugation( pers3_f_plur, KEduVocConjugation::ThirdNeuterCommon, KEduVocConjugation::Plural );
+        conjugation.setConjugation( pers3_f_plur, KEduVocConjugation::ThirdNeutralCommon, KEduVocConjugation::Plural );
     } else  {
         conjugation.setConjugation( pers3_m_plur,
             KEduVocConjugation::ThirdMale, KEduVocConjugation::Plural );
         conjugation.setConjugation( pers3_f_plur,
             KEduVocConjugation::ThirdFemale, KEduVocConjugation::Plural );
         conjugation.setConjugation( pers3_n_plur,
-            KEduVocConjugation::ThirdNeuterCommon, KEduVocConjugation::Plural );
+            KEduVocConjugation::ThirdNeutralCommon, KEduVocConjugation::Plural );
     }
 
     return true;
@@ -590,14 +590,14 @@ bool KEduVocKvtmlReader::readPersonalPronouns( QDomElement &domElementParent, KE
 
     // used to have common in female
     if ( s3_common ) {
-        pronouns.setPersonalPronoun( pers3_f_sing, KEduVocConjugation::ThirdNeuterCommon, numS );
+        pronouns.setPersonalPronoun( pers3_f_sing, KEduVocConjugation::ThirdNeutralCommon, numS );
     } else  {
         pronouns.setPersonalPronoun( pers3_m_sing,
             KEduVocConjugation::ThirdMale, numS );
         pronouns.setPersonalPronoun( pers3_f_sing,
             KEduVocConjugation::ThirdFemale, numS );
         pronouns.setPersonalPronoun( pers3_n_sing,
-            KEduVocConjugation::ThirdNeuterCommon, numS );
+            KEduVocConjugation::ThirdNeutralCommon, numS );
         pronouns.setMaleFemaleDifferent(true);
     }
 
@@ -606,14 +606,14 @@ bool KEduVocKvtmlReader::readPersonalPronouns( QDomElement &domElementParent, KE
     pronouns.setPersonalPronoun( pers1_sing, KEduVocConjugation::First, numP );
     pronouns.setPersonalPronoun( pers2_sing, KEduVocConjugation::Second, numP );
     if ( p3_common ) {
-        pronouns.setPersonalPronoun( pers3_f_plur, KEduVocConjugation::ThirdNeuterCommon, numP );
+        pronouns.setPersonalPronoun( pers3_f_plur, KEduVocConjugation::ThirdNeutralCommon, numP );
     } else  {
         pronouns.setPersonalPronoun( pers3_m_plur,
             KEduVocConjugation::ThirdMale, numP );
         pronouns.setPersonalPronoun( pers3_f_plur,
             KEduVocConjugation::ThirdFemale, numP );
         pronouns.setPersonalPronoun( pers3_n_plur,
-            KEduVocConjugation::ThirdNeuterCommon, numP );
+            KEduVocConjugation::ThirdNeutralCommon, numP );
         pronouns.setMaleFemaleDifferent(true);
     }
 
index cadab68e3febf76e5c62dda08f737b3d2b5fea52..249365026182e0b009c629594cfa818f134ae9d8 100644 (file)
@@ -383,8 +383,8 @@ bool KEduVocKvtmlWriter::writeArticle( QDomElement &domElementParent )
             domElementEntry.appendChild( domElementMI );
         }
 
-        // neuter
-        articleString = m_doc->identifier(i).article().article( KEduVocArticle::Singular, KEduVocArticle::Definite, KEduVocArticle::Neuter );
+        // neutral
+        articleString = m_doc->identifier(i).article().article( KEduVocArticle::Singular, KEduVocArticle::Definite, KEduVocArticle::Neutral );
         if ( !articleString.isEmpty() ) {
             QDomElement domElementND = m_domDoc.createElement( KV_ART_ND );
             QDomText domTextND = m_domDoc.createTextNode( articleString );
@@ -392,7 +392,7 @@ bool KEduVocKvtmlWriter::writeArticle( QDomElement &domElementParent )
             domElementND.appendChild( domTextND );
             domElementEntry.appendChild( domElementND );
         }
-        articleString = m_doc->identifier(i).article().article( KEduVocArticle::Singular, KEduVocArticle::Indefinite, KEduVocArticle::Neuter );
+        articleString = m_doc->identifier(i).article().article( KEduVocArticle::Singular, KEduVocArticle::Indefinite, KEduVocArticle::Neutral );
         if ( !articleString.isEmpty() ) {
             QDomElement domElementNI = m_domDoc.createElement( KV_ART_NI );
             QDomText domTextNI = m_domDoc.createTextNode( articleString );
index 6a4634a3290071b46d12b4de08256504fb35c6f4..c167a6007a0efc687ae91dd882fe3ecaa59a3d2e 100644 (file)
@@ -22,7 +22,7 @@ public:
     Private();
 
     bool m_maleFemaleDifferent;
-    bool m_neuterExists;
+    bool m_neutralExists;
     bool m_dualExists;
     QMap<int, QString> m_personalpronouns;
 };
@@ -31,7 +31,7 @@ public:
 KEduVocPersonalPronoun::Private::Private()
 {
     m_maleFemaleDifferent = false;
-    m_neuterExists = false;
+    m_neutralExists = false;
     m_dualExists = false;
 }
 
@@ -44,7 +44,7 @@ KEduVocPersonalPronoun::KEduVocPersonalPronoun( const KEduVocPersonalPronoun& ot
         : d( new Private )
 {
     d->m_maleFemaleDifferent = other.d->m_maleFemaleDifferent;
-    d->m_neuterExists = other.d->m_neuterExists;
+    d->m_neutralExists = other.d->m_neutralExists;
     d->m_personalpronouns = other.d->m_personalpronouns;
     d->m_dualExists = other.d->m_dualExists;
 }
@@ -59,7 +59,7 @@ KEduVocPersonalPronoun::~KEduVocPersonalPronoun()
 KEduVocPersonalPronoun& KEduVocPersonalPronoun::operator = ( const KEduVocPersonalPronoun& other )
 {
     d->m_maleFemaleDifferent = other.d->m_maleFemaleDifferent;
-    d->m_neuterExists = other.d->m_neuterExists;
+    d->m_neutralExists = other.d->m_neutralExists;
     d->m_personalpronouns = other.d->m_personalpronouns;
     d->m_dualExists = other.d->m_dualExists;
     return *this;
@@ -70,7 +70,7 @@ bool KEduVocPersonalPronoun::operator ==(const KEduVocPersonalPronoun& other) co
 {
     return d->m_personalpronouns == other.d->m_personalpronouns &&
         d->m_maleFemaleDifferent == other.d->m_maleFemaleDifferent &&
-        d->m_neuterExists == other.d->m_neuterExists &&
+        d->m_neutralExists == other.d->m_neutralExists &&
         d->m_dualExists == other.d->m_dualExists;
 }
 
@@ -105,14 +105,14 @@ void KEduVocPersonalPronoun::setMaleFemaleDifferent(bool different)
     d->m_maleFemaleDifferent = different;
 }
 
-bool KEduVocPersonalPronoun::neuterExists() const
+bool KEduVocPersonalPronoun::neutralExists() const
 {
-    return d->m_neuterExists;
+    return d->m_neutralExists;
 }
 
-void KEduVocPersonalPronoun::setNeuterExists(bool exists)
+void KEduVocPersonalPronoun::setNeutralExists(bool exists)
 {
-    d->m_neuterExists = exists;
+    d->m_neutralExists = exists;
 }
 
 bool KEduVocPersonalPronoun::dualExists() const
index 05a921ef84aa4beb11b7f7f2f6c4369923e5f918..d5638fcd63fd5b486be3f6ae913d261c473ca385 100644 (file)
@@ -44,8 +44,8 @@ public:
     bool maleFemaleDifferent() const;
     void setMaleFemaleDifferent(bool different);
 
-    bool neuterExists() const;
-    void setNeuterExists(bool exists);
+    bool neutralExists() const;
+    void setNeutralExists(bool exists);
 
     bool dualExists() const;
     void setDualExists(bool exists);
index 0e32af1c27bdb30aadb68deaffd96c94a5c3c2c4..9f72e224d7eef1b25f87dec2a3c93d942e71dc01 100644 (file)
@@ -63,14 +63,12 @@ public:
     {
         QString m_subTypeName;
         QString m_specialType;
-        QString m_specialTypeExplanation;
         bool operator== ( const subWordType& other );
     };
     struct wordType
     {
         QString m_typeName;
         QString m_specialType;
-        QString m_specialTypeExplanation;
         QList<subWordType> m_subWordTypeList;
         bool operator== ( const wordType& other );
     };
@@ -78,68 +76,46 @@ public:
     /// Map containing the word type name and its properties.
     QList<wordType> m_wordTypeList;
 
-    static const QString WORDTYPE_NOUN;
-    static const QString WORDTYPE_NOUN_MALE;
-    static const QString WORDTYPE_NOUN_FEMALE;
-    static const QString WORDTYPE_NOUN_NEUTRAL;
-
-    static const QString WORDTYPE_VERB;
-    static const QString WORDTYPE_VERB_REGULAR;
-    static const QString WORDTYPE_VERB_IRREGULAR;
-    static const QString WORDTYPE_ADJECTIVE;
-    static const QString WORDTYPE_ADVERB;
-
-    static const QString WORDTYPE_NOUN_EXPLANATION;
-    static const QString WORDTYPE_NOUN_MALE_EXPLANATION;
-    static const QString WORDTYPE_NOUN_FEMALE_EXPLANATION;
-    static const QString WORDTYPE_NOUN_NEUTRAL_EXPLANATION;
-
-    static const QString WORDTYPE_VERB_EXPLANATION;
-    static const QString WORDTYPE_VERB_REGULAR_EXPLANATION;
-    static const QString WORDTYPE_VERB_IRREGULAR_EXPLANATION;
-    static const QString WORDTYPE_ADJECTIVE_EXPLANATION;
-    static const QString WORDTYPE_ADVERB_EXPLANATION;
-};
-
-const QString KEduVocWordType::Private::WORDTYPE_NOUN = QString( "noun" );
-const QString KEduVocWordType::Private::WORDTYPE_NOUN_MALE = QString( "noun male" );
-const QString KEduVocWordType::Private::WORDTYPE_NOUN_FEMALE = QString( "noun female" );
-const QString KEduVocWordType::Private::WORDTYPE_NOUN_NEUTRAL = QString( "noun neutral" );
-
-const QString KEduVocWordType::Private::WORDTYPE_VERB = QString( "verb" );
-const QString KEduVocWordType::Private::WORDTYPE_VERB_REGULAR = QString( "verb regular" );
-const QString KEduVocWordType::Private::WORDTYPE_VERB_IRREGULAR = QString( "verb irregular" );
-
-const QString KEduVocWordType::Private::WORDTYPE_ADJECTIVE = QString( "adjective" );
-const QString KEduVocWordType::Private::WORDTYPE_ADVERB = QString( "adverb" );
-
+    static const QString WORDTYPE_SPECIAL_NOUN;
+    static const QString WORDTYPE_SPECIAL_NOUN_MALE;
+    static const QString WORDTYPE_SPECIAL_NOUN_FEMALE;
+    static const QString WORDTYPE_SPECIAL_NOUN_NEUTRAL;
 
-const QString KEduVocWordType::Private::WORDTYPE_NOUN_EXPLANATION = QString( i18n( "This holds the words of type noun. You can rename it but not delete since the article training relies on it!" ) );
-const QString KEduVocWordType::Private::WORDTYPE_NOUN_MALE_EXPLANATION = QString( "This holds the words of type noun male. You can rename it but not delete since the article training relies on it!" );
-const QString KEduVocWordType::Private::WORDTYPE_NOUN_FEMALE_EXPLANATION = QString( "This holds the words of type noun female. You can rename it but not delete since the article training relies on it!" );
-const QString KEduVocWordType::Private::WORDTYPE_NOUN_NEUTRAL_EXPLANATION = QString( "This holds the words of type noun neutral. You can rename it but not delete since the article training relies on it!" );
+    static const QString WORDTYPE_SPECIAL_VERB;
+    static const QString WORDTYPE_SPECIAL_VERB_REGULAR;
+    static const QString WORDTYPE_SPECIAL_VERB_IRREGULAR;
+    static const QString WORDTYPE_SPECIAL_ADJECTIVE;
+    static const QString WORDTYPE_SPECIAL_ADVERB;
+};
 
-const QString KEduVocWordType::Private::WORDTYPE_VERB_EXPLANATION = QString( "This holds the words of type verb. You can rename it but not delete since the article training relies on it!" );
-const QString KEduVocWordType::Private::WORDTYPE_VERB_REGULAR_EXPLANATION = QString( "This holds the words of type regular verbs. You can rename it but not delete since the article training relies on it!" );
-const QString KEduVocWordType::Private::WORDTYPE_VERB_IRREGULAR_EXPLANATION = QString( "This holds the words of type irregular verbs. You can rename it but not delete since the article training relies on it!" );
+const QString KEduVocWordType::Private::WORDTYPE_SPECIAL_NOUN =
+    QString( i18nc( "@item:inlistbox The grammatical type of a word", "Noun" ) );
+const QString KEduVocWordType::Private::WORDTYPE_SPECIAL_NOUN_MALE =
+    QString( i18nc( "@item:inlistbox A subtype of the grammatical word type: Noun", "Male" ) );
+const QString KEduVocWordType::Private::WORDTYPE_SPECIAL_NOUN_FEMALE =
+    QString( i18nc( "@item:inlistbox A subtype of the grammatical word type: Noun", "Female" ) );
+const QString KEduVocWordType::Private::WORDTYPE_SPECIAL_NOUN_NEUTRAL =
+    QString( i18nc( "@item:inlistbox A subtype of the grammatical word type: Noun", "Neutral" ) );
 
-const QString KEduVocWordType::Private::WORDTYPE_ADJECTIVE_EXPLANATION = QString( "This holds the words of type adjective. You can rename it but not delete since the article training relies on it!" );
-const QString KEduVocWordType::Private::WORDTYPE_ADVERB_EXPLANATION = QString( "This holds the words of type adverb. You can rename it but not delete since the article training relies on it!" );
+const QString KEduVocWordType::Private::WORDTYPE_SPECIAL_VERB =
+    QString( i18nc( "@item:inlistbox The grammatical type of a word", "Verb" ) );
+const QString KEduVocWordType::Private::WORDTYPE_SPECIAL_ADJECTIVE =
+    QString( i18nc( "@item:inlistbox The grammatical type of a word", "Adjective" ) );
+const QString KEduVocWordType::Private::WORDTYPE_SPECIAL_ADVERB =
+    QString( i18nc( "@item:inlistbox The grammatical type of a word", "Adverb" ) );
 
 
 bool KEduVocWordType::Private::wordType::operator ==(const wordType & other)
 {
     return m_typeName == other.m_typeName &&
         m_specialType == other.m_specialType &&
-        m_specialTypeExplanation == other.m_specialTypeExplanation &&
         m_subWordTypeList == other.m_subWordTypeList;
 }
 
 bool KEduVocWordType::Private::subWordType::operator ==(const subWordType & other)
 {
     return m_subTypeName == other.m_subTypeName &&
-        m_specialType == other.m_specialType &&
-        m_specialTypeExplanation == other.m_specialTypeExplanation;
+        m_specialType == other.m_specialType;
 }
 
 bool KEduVocWordType::operator ==(const KEduVocWordType & other)
@@ -171,39 +147,28 @@ KEduVocWordType::KEduVocWordType( const KEduVocWordType & other )
 
 void KEduVocWordType::createDefaultWordTypes()
 {
-    // first the special types which cannot be deleted:
-    addType( i18nc( "@item:inlistbox The grammatical type of a word", "Noun" ),
-        d->WORDTYPE_NOUN, d->WORDTYPE_NOUN_EXPLANATION );
-
-    addSubType( i18nc( "@item:inlistbox The grammatical type of a word", "Noun" ),
-        i18nc( "@item:inlistbox A subtype of the grammatical word type: Noun", "Male" ),
-        d->WORDTYPE_NOUN_MALE, d->WORDTYPE_NOUN_MALE_EXPLANATION );
+    // first the special types
+    addType(  d->WORDTYPE_SPECIAL_NOUN, d->WORDTYPE_SPECIAL_NOUN );
 
-    addSubType( i18nc( "@item:inlistbox The grammatical type of a word", "Noun" ),
-        i18nc( "@item:inlistbox A subtype of the grammatical word type: Noun", "Female" ),
-        d->WORDTYPE_NOUN_FEMALE, d->WORDTYPE_NOUN_FEMALE_EXPLANATION );
+    addSubType( d->WORDTYPE_SPECIAL_NOUN,
+        d->WORDTYPE_SPECIAL_NOUN_MALE, d->WORDTYPE_SPECIAL_NOUN_MALE );
 
-    addSubType( i18nc( "@item:inlistbox The grammatical type of a word", "Noun" ),
-        i18nc( "@item:inlistbox A subtype of the grammatical word type: Noun", "Neutral" ),
-        d->WORDTYPE_NOUN_NEUTRAL, d->WORDTYPE_NOUN_NEUTRAL_EXPLANATION );
+    addSubType( d->WORDTYPE_SPECIAL_NOUN,
+        d->WORDTYPE_SPECIAL_NOUN_FEMALE, d->WORDTYPE_SPECIAL_NOUN_FEMALE );
 
-    addType( i18nc( "@item:inlistbox The grammatical type of a word", "Verb" ),
-        d->WORDTYPE_VERB, d->WORDTYPE_VERB_EXPLANATION );
+    addSubType( d->WORDTYPE_SPECIAL_NOUN,
+        d->WORDTYPE_SPECIAL_NOUN_NEUTRAL, d->WORDTYPE_SPECIAL_NOUN_NEUTRAL );
 
-    addSubType( i18nc( "@item:inlistbox The grammatical type of a word", "Verb" ),
-        i18nc( "@item:inlistbox A subtype of the grammatical word type: Verb with regular conjugation","Regular" ),
-        d->WORDTYPE_VERB_REGULAR, d->WORDTYPE_VERB_REGULAR_EXPLANATION );
+    addType( d->WORDTYPE_SPECIAL_VERB, d->WORDTYPE_SPECIAL_VERB );
 
-    addSubType( i18nc( "@item:inlistbox The grammatical type of a word", "Verb" ),
-        i18nc( "@item:inlistbox A subtype of the grammatical word type: Verb with irregular conjugation","Irregular" ),
-        d->WORDTYPE_VERB_IRREGULAR, d->WORDTYPE_VERB_IRREGULAR_EXPLANATION );
+    addSubType( d->WORDTYPE_SPECIAL_VERB,
+        i18nc( "@item:inlistbox A subtype of the grammatical word type: Verb with regular conjugation","Regular" ) );
 
-    addType(  i18nc( "@item:inlistbox The grammatical type of a word", "Adjective" ) ,
-        d->WORDTYPE_ADJECTIVE, d->WORDTYPE_ADJECTIVE_EXPLANATION );
-
-    addType(  i18nc( "@item:inlistbox The grammatical type of a word", "Adverb" ),
-        d->WORDTYPE_ADVERB, d->WORDTYPE_ADVERB_EXPLANATION );
+    addSubType( d->WORDTYPE_SPECIAL_VERB,
+        i18nc( "@item:inlistbox A subtype of the grammatical word type: Verb with irregular conjugation","Irregular" ) );
 
+    addType( d->WORDTYPE_SPECIAL_ADJECTIVE, d->WORDTYPE_SPECIAL_ADJECTIVE );
+    addType( d->WORDTYPE_SPECIAL_ADVERB, d->WORDTYPE_SPECIAL_ADVERB );
 
     addType( i18nc( "@item:inlistbox The grammatical type of an entry", "Question" ) );
     addType( i18nc( "@item:inlistbox The grammatical type of a word", "Name" ) );
@@ -266,7 +231,7 @@ QStringList KEduVocWordType::subTypeNameList( const QString & mainType ) const
 }
 
 
-void KEduVocWordType::addType( const QString & typeName, const QString & specialType, const QString & specialTypeExplanation )
+void KEduVocWordType::addType( const QString & typeName, const QString & specialType )
 {
     if ( typeName.isEmpty() ) {
         kDebug() << "Attempting to add empty type. When opening old kvtml documents this is ok.";
@@ -279,10 +244,9 @@ void KEduVocWordType::addType( const QString & typeName, const QString & special
     d->m_wordTypeList.append( Private::wordType() );
     d->m_wordTypeList[d->m_wordTypeList.count()-1].m_typeName = typeName;
     d->m_wordTypeList[d->m_wordTypeList.count()-1].m_specialType = specialType;
-    d->m_wordTypeList[d->m_wordTypeList.count()-1].m_specialTypeExplanation = specialTypeExplanation;
 }
 
-void KEduVocWordType::addSubType( const QString & mainType, const QString & typeName, const QString & specialType, const QString & specialTypeExplanation )
+void KEduVocWordType::addSubType( const QString & mainType, const QString & typeName, const QString & specialType )
 {
     int mt = mainTypeIndex( mainType );
 
@@ -290,7 +254,6 @@ void KEduVocWordType::addSubType( const QString & mainType, const QString & type
 
     d->m_wordTypeList[mt].m_subWordTypeList[d->m_wordTypeList[mt].m_subWordTypeList.count()-1].m_subTypeName = typeName;
     d->m_wordTypeList[mt].m_subWordTypeList[d->m_wordTypeList[mt].m_subWordTypeList.count()-1].m_specialType = specialType;
-    d->m_wordTypeList[mt].m_subWordTypeList[d->m_wordTypeList[mt].m_subWordTypeList.count()-1].m_specialTypeExplanation = specialTypeExplanation;
 }
 
 void KEduVocWordType::renameType( const QString & oldTypeName, const QString & newTypeName )
@@ -360,7 +323,6 @@ QString KEduVocWordType::specialType( const QString & typeName )
 {
     int index = mainTypeIndex( typeName );
     if ( index >= 0 ) {
-kDebug() << "special for " << typeName << ":" << d->m_wordTypeList[index].m_specialType;
         return d->m_wordTypeList[index].m_specialType;
     }
     return QString();
@@ -381,35 +343,35 @@ QString KEduVocWordType::specialSubType( const QString & mainTypeName, const QSt
 
 QString KEduVocWordType::specialTypeNoun() const
 {
-    return d->WORDTYPE_NOUN;
+    return d->WORDTYPE_SPECIAL_NOUN;
 }
 QString KEduVocWordType::specialTypeNounMale() const
 {
-    return d->WORDTYPE_NOUN_MALE;
+    return d->WORDTYPE_SPECIAL_NOUN_MALE;
 }
 QString KEduVocWordType::specialTypeNounFemale() const
 {
-    return d->WORDTYPE_NOUN_FEMALE;
+    return d->WORDTYPE_SPECIAL_NOUN_FEMALE;
 }
 QString KEduVocWordType::specialTypeNounNeutral() const
 {
-    return d->WORDTYPE_NOUN_NEUTRAL;
+    return d->WORDTYPE_SPECIAL_NOUN_NEUTRAL;
 }
 
 
 QString KEduVocWordType::specialTypeVerb() const
 {
-    return d->WORDTYPE_VERB;
+    return d->WORDTYPE_SPECIAL_VERB;
 }
 
 QString KEduVocWordType::specialTypeAdjective() const
 {
-    return d->WORDTYPE_ADJECTIVE;
+    return d->WORDTYPE_SPECIAL_ADJECTIVE;
 }
 
 QString KEduVocWordType::specialTypeAdverb() const
 {
-    return d->WORDTYPE_ADVERB;
+    return d->WORDTYPE_SPECIAL_ADVERB;
 }
 
 void KEduVocWordType::setSpecialType(const QString & typeName, const QString & newSpecialType)
@@ -417,9 +379,7 @@ void KEduVocWordType::setSpecialType(const QString & typeName, const QString & n
     int mainIndex = mainTypeIndex( typeName );
     if ( mainIndex >= 0 ) {
         d->m_wordTypeList[mainIndex].m_specialType = newSpecialType;
-kDebug() << "set special type" << typeName << ": " << d->m_wordTypeList[mainIndex].m_specialType;
     }
-
 }
 
 void KEduVocWordType::setSpecialSubType(const QString & mainTypeName, const QString & subTypeName, const QString & newSpecialType)
@@ -429,7 +389,6 @@ void KEduVocWordType::setSpecialSubType(const QString & mainTypeName, const QStr
         int subIndex = subTypeIndex( mainTypeName, subTypeName );
         if ( subIndex >= 0 ) {
             d->m_wordTypeList[mainIndex].m_subWordTypeList[subIndex].m_specialType = newSpecialType;
-kDebug() << "set special sub type" << subTypeName << ": " << d->m_wordTypeList[mainIndex].m_subWordTypeList[subIndex].m_specialType;
         }
     }
 }
index 1d8842fa7a17449e1df710fe48805d0fbe4ccfed..79cb26ceb477a16bf7bc758d3ffa0d4b77fb1349 100644 (file)
@@ -58,9 +58,8 @@ public:
      * Create a new word type in the list of known types
      * @param typeName Name of the word type
      * @param specialType Name of the special type - this is used internally to identify which types are use for special queries - verb query needs special == "verb" for example.
-     * @param specialTypeExplanation An explanation which can be shown to the user. Since the type can be renamed if it's special, but not deleted this is necessary.
      */
-    void addType( const QString& typeName, const QString& specialType = QString(), const QString& specialTypeExplanation = QString() );
+    void addType( const QString& typeName, const QString& specialType = QString() );
 
 
     /**
@@ -68,9 +67,8 @@ public:
      * @param mainType The word type to which the subtype belongs.
      * @param typeName Sub type name
      * @param specialType See above
-     * @param specialTypeExplanation See above
      */
-    void addSubType( const QString& mainType, const QString& typeName, const QString& specialType = QString(), const QString& specialTypeExplanation = QString() );
+    void addSubType( const QString& mainType, const QString& typeName, const QString& specialType = QString() );
 
     /**
      * Get a list of all known main word types.
index dc9d3479bab7638dcbcb795a52a689a44fac3330..04abd5f733f573cbde105375e6de70c3e8a7cccd 100644 (file)
 #define KVTML_2NDPERSON         "secondperson"
 #define KVTML_THIRD_MALE        "thirdpersonmale"
 #define KVTML_THIRD_FEMALE      "thirdpersonfemale"
-#define KVTML_THIRD_NEUTER_COMMON "thirdpersonneutercommon"
+#define KVTML_THIRD_NEUTRAL_COMMON "thirdpersonneutralcommon"
 
 // for the personal pronuns:
 // if this tag exists, in a conjugation male/female are different
 #define KVTML_THIRD_PERSON_MALE_FEMALE_DIFFERENT "malefemaledifferent"
-// if this tag exists conjugations even have a neuter form for the third person
-#define KVTML_THIRD_PERSON_NEUTER_EXISTS "neuterexists"
+// if this tag exists conjugations even have a neutral form for the third person
+#define KVTML_THIRD_PERSON_NEUTRAL_EXISTS "neutralexists"
 #define KVTML_DUAL_EXISTS        "dualexists"
 
 // word types
 #define KVTML_WORDTYPE              "wordtype"
 #define KVTML_TYPENAME              "typename"
 #define KVTML_SUBTYPENAME           "subtypename"
+
+// these are necessary to enable practices based on word types. users can give types arbitrary names, but these few are hardcoded.
 #define KVTML_SPECIALWORDTYPE       "specialwordtype"
+#define KVTML_SPECIALWORDTYPE_NOUN        "noun"
+#define KVTML_SPECIALWORDTYPE_NOUN_MALE   "male"
+#define KVTML_SPECIALWORDTYPE_NOUN_FEMALE "female"
+#define KVTML_SPECIALWORDTYPE_NOUN_NEUTRAL "neutral"
+#define KVTML_SPECIALWORDTYPE_VERB        "verb"
+#define KVTML_SPECIALWORDTYPE_ADJECTIVE   "adjective"
+#define KVTML_SPECIALWORDTYPE_ADVERB      "adverb"
 
 #define KVTML_TENSES            "tenses"
 #define KVTML_TENSE             "tense"