2
2
* This file is part of qdacco
3
3
* qdacco: offline Dacco Catalan <-> English dictionary
4
4
*
5
- * Copyright (c) 2005, 2006, 2007, 2015, 2020, 2021, 2023
5
+ * Copyright (c) 2005, 2006, 2007, 2015, 2020, 2021, 2023-2024
6
6
* Carles Pina i Estany <[email protected] >
7
7
*
8
8
* qdacco is free software; you can redistribute it and/or modify
@@ -101,6 +101,8 @@ void StructureList::startElement(QXmlStreamReader& reader) {
101
101
m_inFemPlural = true ;
102
102
} else if (qName == " synonyms" ) {
103
103
m_inSynonyms = true ;
104
+ } else if (qName == " otherlocal" ) {
105
+ m_inOtherLocal = true ;
104
106
} else if (exampleElements.contains (qName)) {
105
107
m_inExample = true ;
106
108
} else if (noteElements.contains (qName)) {
@@ -146,6 +148,8 @@ void StructureList::endElement(QXmlStreamReader& reader) {
146
148
}
147
149
else if (qName == " synonyms" ) {
148
150
m_inSynonyms = false ;
151
+ } else if (qName == " otherlocal" ) {
152
+ m_inOtherLocal = false ;
149
153
}
150
154
if (exampleElements.contains (qName)) {
151
155
m_inExample = false ;
@@ -194,6 +198,7 @@ void StructureList::processEntry(QXmlStreamReader& reader) {
194
198
m_inTranslation = false ;
195
199
m_inExample = false ;
196
200
m_inPlural = false ;
201
+ m_inOtherLocal = false ;
197
202
m_inNote = false ;
198
203
m_inFems = false ;
199
204
m_inFemPlural = false ;
@@ -216,6 +221,11 @@ void StructureList::processEntry(QXmlStreamReader& reader) {
216
221
if (m_inTranslation && m_inPlural) {
217
222
m_translation.plural = ch;
218
223
}
224
+ if (m_inTranslation && m_inOtherLocal) {
225
+ // This is added but not used in the UI
226
+ // (it also needs to read the "local="us" and then show it as British local)
227
+ m_translation.otherLocal = ch;
228
+ }
219
229
else if (m_inTranslation && m_inSynonyms) {
220
230
m_translation.synonyms = ch;
221
231
}
@@ -244,7 +254,19 @@ void StructureList::processEntry(QXmlStreamReader& reader) {
244
254
m_translation.femalePlural = ch;
245
255
}
246
256
else if (m_inTranslation) {
247
- m_translation.translation = ch;
257
+ /* There are entries where the "translation" is between different parts. For example:
258
+ *
259
+ * <Entry frequency="17500000">neighbor<nouns><translations><translation gender="mf" local="us">veí<otherlocal>neighbour</otherlocal>
260
+ *
261
+ * </translation></translations></nouns>
262
+ *
263
+ * </Entry>
264
+ * Since there are empty spaces after </otherlocal> and before </translation>,
265
+ * the m_translation.translation = ch; was removing the previous text added in the translation.
266
+ * Now it's adding it trimmed so "veí" stays, and if there was some other meaningul text it would
267
+ * be added.
268
+ */
269
+ m_translation.translation += ch.trimmed ();
248
270
}
249
271
else if (m_inExpressions) {
250
272
m_expressions.expression = ch;
0 commit comments