# General Translation Changelog: gt 2.12.0: Object and dictionary derivation
URL: https://generaltranslation.com/en-GB/blog/gt-cli_v2_12_0.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: 
Authors: Ernest McCarter
Published: 2026-03-19

## Overview

[`derive()`](/docs/react/reference/functions/derive) can now resolve values from objects and arrays — not just function return values. The same support extends to Python&#39;s [`derive()`](/docs/python/reference/functions/derive) with dictionaries and lists. This means the CLI can statically extract all possible string variants from data structures at build time, creating a separate translation entry for each one.

This builds on the [tagged template support for `derive()`](/devlog/gt-react_v10_15_0) added in gt-react@10.15.0.

## Object and array access

Given an object of string variants, [`derive()`](/docs/react/reference/functions/derive) extracts every value:

```tsx
const labels = { success: "Saved", error: "Failed", pending: "Saving..." };

t`Status: ${derive(labels[status])}`;
```

The CLI resolves all three values and registers separate translation entries for each.

This works with both computed access (`obj[key]`) and static access (`obj.prop`), and supports nesting:

```tsx
const messages = {
  greeting: { formal: "Good evening", casual: "Hey" },
  farewell: { formal: "Goodbye", casual: "See ya" },
};

t`${derive(messages[category][tone])}`;
```

Arrays work the same way:

```tsx
const ranks = ["Bronze", "Silver", "Gold", "Platinum"];

t`Your rank: ${derive(ranks[level])}`;
```

## Python

The same object/array resolution works in Python with dictionaries and lists:

```python
from gt_flask import t, derive

labels = { "success": "Saved", "error": "Failed" }

t(derive(labels[status_key]))
```

```python
from gt_flask import t, derive

ranks = ["Bronze", "Silver", "Gold", "Platinum"]

t(derive(ranks[level]))
```

Pass the derived expression as the first argument, or place it inside an f-string passed as that argument. Putting it in a keyword interpolation value does not extract the dictionary or list entries.

## Requirements

* Objects and arrays must be declared with `const` (TypeScript) or at module level (Python).
* Spread syntax (`...base`) is supported and flattened at extraction time.
* TypeScript annotations (`as const`, `satisfies`) are unwrapped automatically.
* Circular spreads are detected and produce a warning instead of hanging.

## Links

* [Previous: `derive()` in tagged templates (gt-react@10.15.0)](/devlog/gt-react_v10_15_0)
* [`derive()` API reference](/docs/react/reference/functions/derive)
* [PR #1137](https://github.com/generaltranslation/gt/pull/1137)

## Sitemap

See the full [sitemap](https://generaltranslation.com/sitemap.md) for all pages.
