ibexa

Path

ez publish / technical manual / 4.5 / features / multi-language / the bit-field algorithm


Caution: This documentation is for eZ Publish legacy, from version 3.x to 5.x.

  • The bit-field algorithm

    The following text reveals some technical details related to the bit-field algorithm that is used for language filtering and prioritizing.

    The system stores information about all the translation languages in the "ezcontent_language" database table. These languages are identified by powers of 2 i.e. their ID numbers are 2, 4, 8, 16, 32 etc. The value 1 (2^0) is used for marking the objects always available. When an object is marked always available, it will be shown even though it does not exist in a language that is specified using the prioritized language list (the "SiteLanguageList" configuration array).

    The "always_available" field

    The "ezcontentclass" table in the database includes the "always_available" field (0 by default) which controls whether new instances (objects) of a class should be set to "always available" or not. If this value is set to 1 for a class, then all newly created instances of that class will be always available. Note that this can be changed on the object level later on. The class setting only controls the initial value of the "always available" flag of the objects.

    The "language_mask" field

    When storing information about a content object in the "ezcontentobject" database table, the system uses a special bit-field called "language_mask" to identify languages in which the last published version of an object exist. This field contains the sum of the ID numbers of these languages plus 1 if an object is always available. When a new object is created, the sum of the initial language ID and the default "always_available" value (specified in the class) will be recorded to the object's "language_mask" field.

    The "language_mask" bit-field is updated every time an object's language configuration changes. This typically happens when a translation is added or removed to/from an object.

    Example

    Let's say that you have two translation languages with the following ID numbers:

    Language name

    ID

    English (United Kingdom)

    2

    French (France)

    4

    This allows the following possible values of "language_mask" for your content objects:

    Language mask

    Bitmap

    Languages

    2

    00010

    The object exists in English.

    3

    00011

    The object exists in English and is always available.

    4

    00100

    The object exists in French.

    5

    00101

    The object exists in French and is always available.

    6

    00110

    The object exists in English and French.

    7

    00111

    The object exists in English and French and is always available.

    When storing information about an object's version in the "ezcontentobject_version" database table, the "language_mask" bit-field contains the sum of the ID numbers of the languages in which a version exists plus 1.

    The "initial_language_id" field

    The "ezcontentobject" table in the database includes the "initial_language_id" field which is used for storing the ID number of the object's initial language.

    When storing information about an object's version in the "ezcontentobject_version" database table, the system records the ID number of the language which the version was edited in to a special bit-field called "initial_language_id".

    The "language_id" field

    When storing information about an object attribute in the "ezcontentobject_attribute" database table, the system uses the "language_code" field to store the language code of the translation that the attribute belongs to (for example "eng-GB"). The "language_id" bit-field represents the same information in terms of language ID numbers i.e. this field contains the ID number of the translation language.

    Svitlana Shatokhina (21/07/2006 3:36 pm)

    Svitlana Shatokhina (07/08/2006 1:26 pm)

    Svitlana Shatokhina, Balazs Halasy, Ole-Morten Halvorsen


    Comments

    There are no comments.