-
-
Notifications
You must be signed in to change notification settings - Fork 24
Open
Description
In the UCA standard's introduction they present an example as the following
| Language | Swedish: | German: |
|---|---|---|
| -- | z < ö | ö < z |
@jtauber How would I achieve this with PyUCA?
If I use the foreign C++ bindings with PyICU I can produce the above example like this
>>> def collate_compare(collator, a, b): return collator.getSortKey(a) > collator.getSortKey(b)
...
>>> col_de = Collator.createInstance(Locale("de_DE"))
>>> col_de.setStrength(Collator.PRIMARY)
>>> col_se = Collator.createInstance(Locale("sv_SE"))
>>> col_se.setStrength(Collator.PRIMARY)
>>> collate_compare(col_de, "ö", "z") # German: ö is more than z => False
False
>>> collate_compare(col_se, "ö", "z") # Swedish: ö is more than z => True
TrueHowever, I would much prefer a pure python solution without mixing in external C++ dependencies as these make installation and usage cumbersome. I could not find any guidance in the documentation on how to achieve this goal with PyUCA so would love any help or pointers.
hydrargyrum
Metadata
Metadata
Assignees
Labels
No labels