# General Translation Python SDKs: declare_var URL: https://generaltranslation.com/en-GB/docs/python/reference/functions/declare-var.mdx --- title: declare_var description: Mark a dynamic value as a non-translatable variable in General Translation Python. API reference for declare_var. --- Marks a dynamic value as a non-translatable variable so it is preserved across languages. Use it for values known only at runtime, such as user names, email addresses, and counts, embedded inside a [`t`](/docs/python/reference/functions/t) call. ## Overview [#overview] Call `declare_var` with a value and an optional keyword-only `name`. It returns an ICU `{_gt_, select, ...}` construct that embeds the value as a General Translation variable marker. ```python from gt_flask import declare_var # or: from gt_fastapi import declare_var, or: from gt_i18n import declare_var t(f"Signed in as {declare_var(email, name='email')}") ``` Signature: ```python declare_var( variable: str | int | float | bool | None, *, name: str | None = None, ) -> str ``` Re-exported from `generaltranslation.static` by `gt_i18n` and the framework packages. ## How it works [#how-it-works] * **Value formatting.** `None` becomes an empty string, `bool` becomes `"true"`/`"false"`, and other values are stringified; the result is sanitised. * **Marker construction.** It returns `{_gt_, select, other {value}}`, optionally with a `_gt_var_name {name}` clause when `name` is given. * **Runtime vs. build time.** Use it for runtime values; for a value with a finite set of build-time outcomes, use [`derive`](/docs/python/reference/functions/derive). Recover embedded values with [`decode_vars`](/docs/python/reference/functions/decode-vars). ## Parameters [#parameters] | Parameter | Description | Type | Optional | Default | | ----------------------- | -------------------------------------------------- | ------------------------------------- | -------- | ------- | | [`variable`](#variable) | The value to embed as a non-translatable variable. | `str \| int \| float \| bool \| None` | No | — | | [`name`](#name) | Keyword-only human-readable variable name. | `str` | Yes | `None` | ### `variable` [#variable] **Type** `str | int | float | bool | None` · **Required** The value to embed. `None` renders as an empty string; booleans render in lowercase. ### `name` [#name] **Type** `str` · **Optional** · **Default** `None` A keyword-only human-readable label for the variable, added as a `_gt_var_name` clause when provided. ## Returns [#returns] **Type** `str` An ICU `{_gt_, select, ...}` construct wrapping the value as a variable marker. ## Example [#example] ```python from gt_flask import t, declare_var # Preserve a runtime value inside a translated f-string message = t(f"{declare_var(name, name='name')} goes home") ```