setPath("/usr/lib/mdictionary/dict.xdxf");
stopped = false;
+
+
+ qDebug()<<removeAccents(QString::fromUtf8("Słońce"));
}
QString XdxfPlugin::langFrom() const {
QSet<Translation*> translations;
QFile dictionaryFile(path);
+ word = removeAccents(word);
+ qDebug()<<word;
+
stopped = false;
if(word.indexOf("*")==-1)
word+="*";
dictionaryReader.readNextStartElement();
if(!dictionaryReader.atEnd())
a = dictionaryReader.readElementText();
- if(regWord.exactMatch(a) && (i<limit || limit==0)) {
+ if(regWord.exactMatch(removeAccents(a)) && (i<limit || limit==0)) {
bool ok=true;
Translation *tran;
foreach(tran,translations)
}
QString XdxfPlugin::removeAccents(QString string) {
+
+ string = string.replace(QString::fromUtf8("ł"), "l", Qt::CaseInsensitive);
QString normalized = string.normalized(QString::NormalizationForm_D);
+ normalized = normalized;
for(int i=0; i<normalized.size(); i++) {
- if(!normalized[i].isLetterOrNumber() && !normalized[i].isSpace()) {
+ if( !normalized[i].isLetterOrNumber() &&
+ !normalized[i].isSpace() &&
+ !normalized[i].isDigit()) {
normalized.remove(i,1);
}
}