> For the complete documentation index, see [llms.txt](https://guilhermesantos.gitbook.io/niro-health/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://guilhermesantos.gitbook.io/niro-health/locale-i18n/nested-texts-with-inheritance.md).

# Nested texts with inheritance

There are situations where a text can fit into several contexts.

```json
{
  "app_name": "Niro Health",
  "text_1": "I'm Love $1",
}
```

```typescript
locale.translate('text_1', '.app_name');
// output: I'm Love Niro Health
```

In the arguments you can pass properties as values. The passed properties can include '$' identifiers, making the nesting cascade mode.

```json
{
  "fallback": "Sorry the code is not working due to an error: $1",
  "users": {
    "get": {
      "error": "$1"
    }
  },
}
```

```typescript
locale.translate('users.get.error', '.fallback', 'Bad Line 404');
// output: Sorry the code is not working due to an error: Bad Line 404
```

> You may need to pass a nested property that will not use cascade mode.

```json
{
  "fallback": "Sorry the code is not working due to an error: $1 and $2. Testing ? $3",
  "users": {
    "get": {
      "error": "$1"
    }
  },
}
```

```typescript
const values = [400, 500, true];

locale.translate('users.get.error', `.fallback.nocascade[${values.join(', ')}]`);
// output: Sorry the code is not working due to an error: 400 and 500. Testing ? true
```

{% hint style="success" %}
Now you can structure texts even more dynamically, and best of all, your language file is even more organized and reduced.
{% endhint %}
