Tag Models

class jangle.models.tags.IANASubtagRegistryManager(*args, **kwargs)[source]
register(clear=True, descriptions_batch_size=64) None[source]

Saves language, extlang, script, region, grandfathered, and redundant language tags and subtags from the IANA language subtag registry to their corresponding tables.

class jangle.models.tags.IANASubtagRegistry(*args, **kwargs)[source]

Represents a saved instance of the IANA Language Subtag Registry.

See https://www.iana.org/assignments/iso_lang-subtags-templates/iso_lang-subtags-templates.xhtml, https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry.

records: models.manager.RelatedManager[IANASubtagRecord]
file_date
saved

Time registry was saved.

objects = <jangle.models.tags.IANASubtagRegistryManager object>
class jangle.models.tags.IANASubtagRecord(*args, **kwargs)[source]

Abstract model to represent a record in the IANA language subtag registry.

descriptions: models.manager.RelatedManager[IANASubtagDescription]
registry
deprecated

Date deprecated.

added

Date added.

comments
pref_value

Preferred value.

first_description() str[source]
objects = <django.db.models.manager.Manager object>
registry_id
class jangle.models.tags.IANASubtagDescription(id, subtag, text, index)[source]
subtag

IANA subtag record.

text
index
objects = <django.db.models.manager.Manager object>
subtag_id
class jangle.models.tags.SubtagFromIANARecord(*args, **kwargs)[source]
iana

IANA (sub)tag record.

class Meta[source]
abstract = False
iana_id
class jangle.models.tags.LangSubtagFromIANARecord(*args, **kwargs)[source]
class Scope(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
INDIVIDUAL = 'I'
COLLECTION = 'C'
MACROLANGUAGE = 'M'
SPECIAL = 'S'
code

ISO 639 or registered code.

macrolanguage
scope

Classification.

suppress_script

Script used to write the overwhelming majority of documents in this language.

class Meta[source]
abstract = False
get_scope_display(*, field=<django.db.models.fields.CharField: scope>)
iana

IANA (sub)tag record.

iana_id
suppress_script_id
class jangle.models.tags.LanguageSubtag(id, iana, code, macrolanguage, scope, suppress_script, iso_lang_codes, iso_lang, iso_lang_collection)[source]
iso_lang_codes
iso_lang
iso_lang_collection
save(*args, **kwargs) None[source]

Save the current instance. Override this in a subclass if you want to control the saving process.

The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

code

ISO 639 or registered code.

get_scope_display(*, field=<django.db.models.fields.CharField: scope>)
iana

IANA (sub)tag record.

iana_id
iso_lang_codes_id
iso_lang_collection_id
iso_lang_id
macrolanguage
objects = <django.db.models.manager.Manager object>
scope

Classification.

suppress_script

Script used to write the overwhelming majority of documents in this language.

suppress_script_id
class jangle.models.tags.ExtlangSubtag(id, iana, code, macrolanguage, scope, suppress_script, iso_lang)[source]
iso_lang
save(*args, **kwargs) None[source]

Save the current instance. Override this in a subclass if you want to control the saving process.

The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

code

ISO 639 or registered code.

get_scope_display(*, field=<django.db.models.fields.CharField: scope>)
iana

IANA (sub)tag record.

iana_id
iso_lang_id
macrolanguage
objects = <django.db.models.manager.Manager object>
scope

Classification.

suppress_script

Script used to write the overwhelming majority of documents in this language.

suppress_script_id
class jangle.models.tags.ScriptSubtag(*args, **kwargs)[source]
script

External ISO-15924 data from unicode.org.

iana

IANA (sub)tag record.

iana_id
objects = <django.db.models.manager.Manager object>
script_id
class jangle.models.tags.RegionSubtag(*args, **kwargs)[source]
code
region

External UN M.49 and ISO 3166 data.

save(*args, **kwargs) None[source]

Save the current instance. Override this in a subclass if you want to control the saving process.

The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

iana

IANA (sub)tag record.

iana_id
objects = <django.db.models.manager.Manager object>
region_id
class jangle.models.tags.VariantSubtag(*args, **kwargs)[source]
text
iana

IANA (sub)tag record.

iana_id
objects = <django.db.models.manager.Manager object>
tags_through

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

class jangle.models.tags.LanguageTagQuerySet(model=None, query=None, using=None, hints=None)[source]
active() LanguageTagQuerySet[source]

Excludes all deprecated tags and tags with deprecated subtags, according to the IANA subtag registry.

private() LanguageTagQuerySet[source]

Private tags (not langtags with a private subtag).

get_from_lite(lite: LanguageTag) LanguageTag[source]
get_from_match(match: Match[str]) LanguageTag[source]
get_from_str(string: str) LanguageTag[source]
class jangle.models.tags.LanguageTagManager(*args, **kwargs)[source]
get_queryset() LanguageTagQuerySet[source]

Return a new QuerySet object. Subclasses can override this method to customize the behavior of the Manager.

private() LanguageTagQuerySet[source]
active() LanguageTagQuerySet[source]
get_from_lite(lite: LanguageTag) LanguageTag[source]
get_from_match(match: Match[str]) LanguageTag[source]
get_from_str(string: str) LanguageTag[source]
create_from_langtag(langtag: LangTag, allow_deprecated=False, **kwargs) LanguageTag[source]
get_or_create_from_lite(lite: LanguageTag, allow_deprecated=False, defaults: dict[str, Any] = {}) Tuple[LanguageTag, bool][source]
get_or_create_from_str(string: str, allow_deprecated=False, defaults: dict[str, Any] = {}) Tuple[LanguageTag, bool][source]
native() LanguageTag[source]

Returns a LanguageTag from settings.LANGUAGE_CODE

class jangle.models.tags.LanguageTag(*args, **kwargs)[source]

Represents an RFC5646 language tag.

See https://www.rfc-editor.org/rfc/rfc5646.html.

variants_through: models.manager.RelatedManager[LanguageTagVariantSubtag]
extensions: models.manager.RelatedManager[ExtensionSubtag]
iana

Original IANA (sub)tag record.

grandfathered_tag
lang

Language subtag.

extlang

Extlang subtag.

script

Script subtag.

region

Region subtag.

variants

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

extlang_id
iana_id
lang_id
private

Private tag or subtag.

region_id
script_id
property is_private: bool
property pref_tag: LanguageTag

Preferred tag as defined in the IANA registry, or self.

property text: str
property description: str

English description of what the tag represents.

lite() LanguageTag[source]
objects = <jangle.models.tags.LanguageTagManager object>
class jangle.models.tags.LanguageTagVariantSubtag(*args, **kwargs)[source]
objects = <django.db.models.manager.Manager object>
tag_id
variant_id
tag
variant
index
class jangle.models.tags.ExtensionSubtag(*args, **kwargs)[source]
objects = <django.db.models.manager.Manager object>
tag_id
texts: models.manager.RelatedManager[ExtensionSubtagText]
tag
singleton
index
class jangle.models.tags.ExtensionSubtagText(*args, **kwargs)[source]
extension_id
objects = <django.db.models.manager.Manager object>
extension
text
index