Skip to content

Localizations

albert.resources.localizations

LocalizationLanguage

Bases: str, Enum

A language that localizations can be written in.

Attributes:

Name Type Description
GERMAN str

German ("de").

JAPANESE str

Japanese ("ja").

CHINESE str

Chinese ("zh").

SPANISH str

Spanish ("es").

GERMAN

GERMAN = 'de'

JAPANESE

JAPANESE = 'ja'

CHINESE

CHINESE = 'zh'

SPANISH

SPANISH = 'es'

LocalizationEnumValue

Bases: BaseAlbertModel

An enum option within a localization validation rule, with its own translations.

Show JSON schema:
{
  "description": "An enum option within a localization validation rule, with its own translations.",
  "properties": {
    "id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The ID of the enum value (format ``ENM...``).",
      "title": "Id"
    },
    "text": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The source (untranslated) display text of the enum value.",
      "title": "Text"
    },
    "localization": {
      "anyOf": [
        {
          "additionalProperties": {
            "additionalProperties": {
              "type": "string"
            },
            "type": "object"
          },
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Translations keyed by attribute and language code (e.g. ``{\"text\": {\"de\": \"Apfel\"}}``). Language codes are drawn from [`LocalizationLanguage`][albert.resources.localizations.LocalizationLanguage].",
      "title": "Localization"
    }
  },
  "title": "LocalizationEnumValue",
  "type": "object"
}

Fields:

id

id: str | None = None

The ID of the enum value (format ENM...).

text

text: str | None = None

The source (untranslated) display text of the enum value.

localization

localization: dict[str, dict[str, str]] | None = None

Translations keyed by attribute and language code (e.g. {"text": {"de": "Apfel"}}). Language codes are drawn from LocalizationLanguage.

LocalizationValidation

Bases: BaseAlbertModel

A validation rule on a localized field.

Enum rules carry the allowed options in value, and each option can carry translations of its display text.

Show JSON schema:
{
  "$defs": {
    "LocalizationEnumValue": {
      "description": "An enum option within a localization validation rule, with its own translations.",
      "properties": {
        "id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The ID of the enum value (format ``ENM...``).",
          "title": "Id"
        },
        "text": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The source (untranslated) display text of the enum value.",
          "title": "Text"
        },
        "localization": {
          "anyOf": [
            {
              "additionalProperties": {
                "additionalProperties": {
                  "type": "string"
                },
                "type": "object"
              },
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Translations keyed by attribute and language code (e.g. ``{\"text\": {\"de\": \"Apfel\"}}``). Language codes are drawn from [`LocalizationLanguage`][albert.resources.localizations.LocalizationLanguage].",
          "title": "Localization"
        }
      },
      "title": "LocalizationEnumValue",
      "type": "object"
    }
  },
  "description": "A validation rule on a localized field.\n\nEnum rules carry the allowed options in ``value``, and each option can carry\ntranslations of its display text.",
  "properties": {
    "datatype": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The data type the rule applies to (e.g. ``\"enum\"``, ``\"number\"``).",
      "title": "Datatype"
    },
    "value": {
      "anyOf": [
        {
          "items": {
            "$ref": "#/$defs/LocalizationEnumValue"
          },
          "type": "array"
        },
        {
          "type": "string"
        },
        {
          "type": "integer"
        },
        {
          "type": "number"
        },
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "For enum rules, the list of allowed options; otherwise the bound for ``operator``.",
      "title": "Value"
    },
    "operator": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The comparison operator for bound rules (e.g. ``\"lt\"``).",
      "title": "Operator"
    }
  },
  "title": "LocalizationValidation",
  "type": "object"
}

Fields:

datatype

datatype: str | None = None

The data type the rule applies to (e.g. "enum", "number").

value

value: (
    list[LocalizationEnumValue]
    | str
    | int
    | float
    | bool
    | None
) = None

For enum rules, the list of allowed options; otherwise the bound for operator.

operator

operator: str | None = None

The comparison operator for bound rules (e.g. "lt").

Localization

Bases: BaseAlbertModel

Translations for an entity or one of its child records in the Albert platform.

A single entity (e.g. a data template) produces one Localization for the entity itself plus one per localizable child record (data columns, parameters). Managed through LocalizationCollection (client.localizations).

Example

from albert import Albert
client = Albert()
rows = client.localizations.get_all_by_id(id="DAT1")
for row in rows:
    print(row.unique_id, row.localization)
Show JSON schema:
{
  "$defs": {
    "LocalizationEnumValue": {
      "description": "An enum option within a localization validation rule, with its own translations.",
      "properties": {
        "id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The ID of the enum value (format ``ENM...``).",
          "title": "Id"
        },
        "text": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The source (untranslated) display text of the enum value.",
          "title": "Text"
        },
        "localization": {
          "anyOf": [
            {
              "additionalProperties": {
                "additionalProperties": {
                  "type": "string"
                },
                "type": "object"
              },
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Translations keyed by attribute and language code (e.g. ``{\"text\": {\"de\": \"Apfel\"}}``). Language codes are drawn from [`LocalizationLanguage`][albert.resources.localizations.LocalizationLanguage].",
          "title": "Localization"
        }
      },
      "title": "LocalizationEnumValue",
      "type": "object"
    },
    "LocalizationValidation": {
      "description": "A validation rule on a localized field.\n\nEnum rules carry the allowed options in ``value``, and each option can carry\ntranslations of its display text.",
      "properties": {
        "datatype": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The data type the rule applies to (e.g. ``\"enum\"``, ``\"number\"``).",
          "title": "Datatype"
        },
        "value": {
          "anyOf": [
            {
              "items": {
                "$ref": "#/$defs/LocalizationEnumValue"
              },
              "type": "array"
            },
            {
              "type": "string"
            },
            {
              "type": "integer"
            },
            {
              "type": "number"
            },
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "For enum rules, the list of allowed options; otherwise the bound for ``operator``.",
          "title": "Value"
        },
        "operator": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The comparison operator for bound rules (e.g. ``\"lt\"``).",
          "title": "Operator"
        }
      },
      "title": "LocalizationValidation",
      "type": "object"
    }
  },
  "description": "Translations for an entity or one of its child records in the Albert platform.\n\nA single entity (e.g. a data template) produces one [`Localization`][albert.resources.localizations.Localization]\nfor the entity itself plus one per localizable child record (data columns,\nparameters). Managed through\n[`LocalizationCollection`][albert.collections.localizations.LocalizationCollection]\n(``client.localizations``).\n\n!!! example\n    ```python\n    from albert import Albert\n    client = Albert()\n    rows = client.localizations.get_all_by_id(id=\"DAT1\")\n    for row in rows:\n        print(row.unique_id, row.localization)\n    ```",
  "properties": {
    "albertId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The Albert ID of the localized entity (e.g. ``\"DAT1\"``).",
      "title": "Albertid"
    },
    "name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The source (untranslated) name of the entity or child record.",
      "title": "Name"
    },
    "uniqueId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Identifies the record the translations apply to: the module name for the main entity (e.g. ``\"DAT\"``), or ``\"<childId>#<position>\"`` for a child record (e.g. ``\"DAC1#COL0\"``, ``\"PRM1#ROW1\"``).",
      "title": "Uniqueid"
    },
    "description": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The source (untranslated) description of the entity.",
      "title": "Description"
    },
    "localization": {
      "anyOf": [
        {
          "additionalProperties": {
            "additionalProperties": {
              "type": "string"
            },
            "type": "object"
          },
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Translations keyed by attribute and language code (e.g. ``{\"name\": {\"de\": \"Datenvorlage\"}}``). Language codes are drawn from [`LocalizationLanguage`][albert.resources.localizations.LocalizationLanguage].",
      "title": "Localization"
    },
    "validation": {
      "anyOf": [
        {
          "items": {
            "$ref": "#/$defs/LocalizationValidation"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Validation rules on the field. Enum rules carry translations of the allowed options.",
      "title": "Validation"
    },
    "type": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The data type of the attribute (e.g. ``\"string\"``, ``\"enum\"``, ``\"number\"``).",
      "title": "Type"
    },
    "hidden": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Whether the field is hidden.",
      "title": "Hidden"
    },
    "module": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The module the record belongs to (e.g. ``\"DAT\"``, ``\"DAC\"``, ``\"PRM\"``).",
      "title": "Module"
    },
    "required": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Whether the field is required.",
      "title": "Required"
    }
  },
  "title": "Localization",
  "type": "object"
}

Fields:

id

id: str | None = None

The Albert ID of the localized entity (e.g. "DAT1").

name

name: str | None = None

The source (untranslated) name of the entity or child record.

unique_id

unique_id: str | None = None

Identifies the record the translations apply to: the module name for the main entity (e.g. "DAT"), or "<childId>#<position>" for a child record (e.g. "DAC1#COL0", "PRM1#ROW1").

description

description: str | None = None

The source (untranslated) description of the entity.

localization

localization: dict[str, dict[str, str]] | None = None

Translations keyed by attribute and language code (e.g. {"name": {"de": "Datenvorlage"}}). Language codes are drawn from LocalizationLanguage.

validation

validation: list[LocalizationValidation] | None = None

Validation rules on the field. Enum rules carry translations of the allowed options.

type

type: str | None = None

The data type of the attribute (e.g. "string", "enum", "number").

hidden

hidden: bool | None = None

Whether the field is hidden.

module

module: str | None = None

The module the record belongs to (e.g. "DAT", "DAC", "PRM").

required

required: bool | None = None

Whether the field is required.

LocalizationPatchDatum

Bases: PatchDatum

A single translation change for an entity or child record.

operation is "add" to create a translation, "update" to change an existing one (old_value must match), and "delete" to remove one.

Show JSON schema:
{
  "$defs": {
    "LocalizationLanguage": {
      "description": "A language that localizations can be written in.\n\nAttributes\n----------\nGERMAN : str\n    German (``\"de\"``).\nJAPANESE : str\n    Japanese (``\"ja\"``).\nCHINESE : str\n    Chinese (``\"zh\"``).\nSPANISH : str\n    Spanish (``\"es\"``).",
      "enum": [
        "de",
        "ja",
        "zh",
        "es"
      ],
      "title": "LocalizationLanguage",
      "type": "string"
    }
  },
  "description": "A single translation change for an entity or child record.\n\n``operation`` is ``\"add\"`` to create a translation, ``\"update\"`` to change an\nexisting one (``old_value`` must match), and ``\"delete\"`` to remove one.",
  "properties": {
    "operation": {
      "title": "Operation",
      "type": "string"
    },
    "attribute": {
      "title": "Attribute",
      "type": "string"
    },
    "newValue": {
      "anyOf": [
        {},
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Newvalue"
    },
    "oldValue": {
      "anyOf": [
        {},
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Oldvalue"
    },
    "language": {
      "anyOf": [
        {
          "$ref": "#/$defs/LocalizationLanguage"
        },
        {
          "type": "string"
        }
      ],
      "description": "The language the translation applies to. Use a [`LocalizationLanguage`][albert.resources.localizations.LocalizationLanguage] member (e.g. ``LocalizationLanguage.GERMAN``) or its language code (``\"de\"``); plain strings keep languages not yet in the enum usable.",
      "maxLength": 255,
      "minLength": 1,
      "title": "Language"
    },
    "uniqueId": {
      "description": "The record the translation applies to: the module name for the main entity (e.g. ``\"DAT\"``), or ``\"<childId>#<position>\"`` for a child record.",
      "maxLength": 255,
      "minLength": 1,
      "title": "Uniqueid",
      "type": "string"
    }
  },
  "required": [
    "operation",
    "attribute",
    "language",
    "uniqueId"
  ],
  "title": "LocalizationPatchDatum",
  "type": "object"
}

Fields:

language

The language the translation applies to. Use a LocalizationLanguage member (e.g. LocalizationLanguage.GERMAN) or its language code ("de"); plain strings keep languages not yet in the enum usable.

unique_id

unique_id: str

The record the translation applies to: the module name for the main entity (e.g. "DAT"), or "<childId>#<position>" for a child record.