You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
clld plugin, adding language families from
Glottolog to a clld app to allow for better navigation and
visualization.
Usage
To equip a Language model with a family relation, the model should inherit from
clld_glottologfamily_plugin.models.HasFamilyMixin. This relation can be populated upon
database initialization calling clld_glottologfamily_plugin.util.load_families.
The families assigned in this way have an associated icon which can be used as map marker.
To make this easier, a custom IMapMarker may inherit from
clld_glottologfamily_plugin.util.LanguageByFamilyMapMarker.
Associated DataTable columns suitable for tables listing Language objects can be
used as follows:
fromclld.web.datatables.languageimportLanguagesfromclld_glottologfamily_plugin.datatablesimportFamilyCol, MacroareaColfromclld_glottologfamily_plugin.modelsimportFamilyfrommodelsimportCustomLanguageclassLanguagesWithFamily(Languages):
defbase_query(self, query):
returnquery.outerjoin(Family) # note: isolates will have no related family!defcol_defs(self):
res=Languages.col_defs(self)
res.append(MacroareaCol(self, 'macroarea', language_cls=CustomLanguage))
res.append(FamilyCol(self, 'family', language_cls=CustomLanguage))
returnres
Assigning families
Family information is retrieved from Glottolog, based on the id attribute of a
language. This will only work if id is either a glottocode or an ISO 639-3 code.
If no related family is found, None will be assigned - rather than a dummy isolates
family or individual one-member families derived from the language.
About
clld plugin, adding language families from Glottolog to a clld app to allow for better navigation and visualization.