Make localization for special types work.
svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=718659
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
};
Dual,
Plural
};
-/*
- enum DeclinationGender {
- Undefined,
- Masculine,
- Feminine,
- Neuter
- };*/
enum DeclinationCase {
Nominative = 1,
{
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()
enum ArticleGender {
Masculine,
Feminine,
- Neuter,
+ Neutral,
GenderMAX
};
// 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;
}
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 );
}
{
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() );
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 );
}
}
// 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 ) );
}
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;
}
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() ) {
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 );
}
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 ) );
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() ) {
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 );
}
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;
// 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);
}
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);
}
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 );
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 );
Private();
bool m_maleFemaleDifferent;
- bool m_neuterExists;
+ bool m_neutralExists;
bool m_dualExists;
QMap<int, QString> m_personalpronouns;
};
KEduVocPersonalPronoun::Private::Private()
{
m_maleFemaleDifferent = false;
- m_neuterExists = false;
+ m_neutralExists = false;
m_dualExists = false;
}
: 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;
}
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;
{
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;
}
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
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);
{
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 );
};
/// 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)
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" ) );
}
-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.";
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 );
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 )
{
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();
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)
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)
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;
}
}
}
* 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() );
/**
* @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.
#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"