mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix ICU contractions
This commit is contained in:
parent
223cfd8f12
commit
d5fa5cf07d
@ -241,7 +241,7 @@ icu_Collator_contractions(icu_Collator *self, PyObject *args, PyObject *kwargs)
|
|||||||
if (self->contractions == NULL) {
|
if (self->contractions == NULL) {
|
||||||
self->contractions = uset_open(1, 0);
|
self->contractions = uset_open(1, 0);
|
||||||
if (self->contractions == NULL) return PyErr_NoMemory();
|
if (self->contractions == NULL) return PyErr_NoMemory();
|
||||||
ucol_getContractionsAndExpansions(self->collator, self->contractions, NULL, 0, &status);
|
self->contractions = ucol_getTailoredSet(self->collator, &status);
|
||||||
}
|
}
|
||||||
status = U_ZERO_ERROR;
|
status = U_ZERO_ERROR;
|
||||||
|
|
||||||
@ -290,7 +290,7 @@ icu_Collator_span_contractions(icu_Collator *self, PyObject *args, PyObject *kwa
|
|||||||
if (self->contractions == NULL) {
|
if (self->contractions == NULL) {
|
||||||
self->contractions = uset_open(1, 0);
|
self->contractions = uset_open(1, 0);
|
||||||
if (self->contractions == NULL) return PyErr_NoMemory();
|
if (self->contractions == NULL) return PyErr_NoMemory();
|
||||||
ucol_getContractionsAndExpansions(self->collator, self->contractions, NULL, 0, &status);
|
self->contractions = ucol_getTailoredSet(self->collator, &status);
|
||||||
}
|
}
|
||||||
status = U_ZERO_ERROR;
|
status = U_ZERO_ERROR;
|
||||||
|
|
||||||
|
@ -315,6 +315,14 @@ pêché'''
|
|||||||
print 'Primary collation in Spanish locale failed'
|
print 'Primary collation in Spanish locale failed'
|
||||||
return
|
return
|
||||||
|
|
||||||
|
print '\nTesting contractions'
|
||||||
|
c = _icu.Collator('cs')
|
||||||
|
if icu_contractions(c) != frozenset([u'Z\u030c', u'z\u030c', u'Ch',
|
||||||
|
u'C\u030c', u'ch', u'cH', u'c\u030c', u's\u030c', u'r\u030c', u'CH',
|
||||||
|
u'S\u030c', u'R\u030c']):
|
||||||
|
print 'Contractions for the Czech language failed'
|
||||||
|
return
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user