# glossary agent applied wrong term for locale variant pt-BR

## TL;DR

Fixes the glossary agent applying European Portuguese terms to Brazilian Portuguese content. Scope glossary entries to the exact locale variant. Use when pt-BR content shows pt-PT terms. Not for missing glossary entries.

## The error

```text
Agent applied the pt-PT glossary term to pt-BR strings; reviewers flagged the wrong variant.
```

## Fix it

### Step 1: Find the misapplied term

```bash
node -e "console.log('search the glossary for the term and check its locale scope')"
```

Expected: You see the entry scoped to pt instead of pt-PT.

### Step 2: Scope the entry to the exact variant

```bash
node -e "console.log('split the entry: pt-PT keeps the old term, pt-BR gets the Brazilian term')"
```

Expected: Each variant has its own term.

### Step 3: Re-run the glossary pass on pt-BR

```bash
node -e "console.log('confirm Brazilian terms now apply')"
```

Expected: pt-BR content uses the right terms.

## When to use this

- One regional variant shows another variant's terms
- Glossary entries are scoped to the base language only

## When NOT to use this

- The term is missing everywhere, add it to the glossary
- The translation is wrong for other reasons, check the source

## Tool and version compatibility

- Any glossary-aware translation agent
- Lokalise, Crowdin, and Phrase glossaries

## Variant phrasings

### wrong variant in es-MX vs es-ES

Same fix. Variants of Spanish diverge on many everyday terms.

### agent picks the variant inconsistently

Fallback order matters: pt-BR should fall back to pt only when no variant entry exists.

## Why it happens

Glossary agents often match on the base language tag. An entry scoped to pt applies to both pt-PT and pt-BR, and the agent cannot know the term is wrong for one variant unless the scoping is explicit.

## Edge cases

- Fallback from variant to base language is useful but must be the last resort
- Reviewers from one variant will flag the other's terms as errors
- Machine translation without variant scoping has the same problem

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_ZAN8AAD08NES-ULFH2ra1g
