# Scopes

Scope is an area which contains one or more source strings, making them unique from other scopes.

### Example

Imagine we have a word *"General"*. It may mean:

* the "the entry of Settings menu"&#x20;
* or "player's military rank".

It may (and will) be localised differently in some languages.

### Scope usage

To distinguish different localizations of the same word you can specify a scope:

```html
<ul class="menu" data-bs-scope="Settings menu">
  <li class="__">General</li>
</ul>
```

and

```html
<div class="player-info" data-bs-scope="Player info">
  Your rank: <span class="__">General</span>
</ul>
```

This will create two different scopes for "General" string, and allow it to be localised properly.

You and your team members (including proofreaders) will clearly see the scope in source strings list.

### Scope size

You can set scope directly on a source string:

```html
<span data-bs-scope="Player info">General</span>
```

or some container element:

```html
<div class="page-section" data-bs-scope="Player info">
```

or even on a whole page:

```html
<body data-bs-scope="Player info">
```

### Nesting and default scope

Scopes do not stack. Each nested scope cancels the outer scope and creates its own scope.

You can reset any item to default ("*none"*) scope by specifying an empty attribute. You may need it for strings which meaning is generic:&#x20;

```html
<div class="new-user-dialog" data-bs-scope="New user">
  ...
  <button class="__" data-bs-scope="">Cancel</button>
</div>
```

### Recommendation

It is not recommended to create an own scope for each and every page. Average project has much more generic terms and strings.

But if you face a problem with an ambiguous localisation, you can add a scope at any time.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.babelshark.net/setup/scopes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
